From dd84156dfcee48566664e19bd31eb37632dcff93 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 29 Jan 2019 16:24:05 -0800 Subject: [PATCH 001/304] perspective: Allow empty text for getCanvasTextLocation This is particularly useful for aligning text to a certain point such that it would not be centered on that point, such as left or right alignment. --- runelite-api/src/main/java/net/runelite/api/Perspective.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Perspective.java b/runelite-api/src/main/java/net/runelite/api/Perspective.java index 99116b7714..a0e2297ab9 100644 --- a/runelite-api/src/main/java/net/runelite/api/Perspective.java +++ b/runelite-api/src/main/java/net/runelite/api/Perspective.java @@ -379,7 +379,7 @@ public class Perspective @Nullable String text, int zOffset) { - if (text == null || "".equals(text)) + if (text == null) { return null; } From 201788847a8420086cbb7bc9e0467edb3fe4f6e2 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 29 Jan 2019 16:23:22 -0800 Subject: [PATCH 002/304] actor: Mark getCanvasTextLocation as Nullable --- runelite-api/src/main/java/net/runelite/api/Actor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Actor.java b/runelite-api/src/main/java/net/runelite/api/Actor.java index ce72ceafcb..14763d51a1 100644 --- a/runelite-api/src/main/java/net/runelite/api/Actor.java +++ b/runelite-api/src/main/java/net/runelite/api/Actor.java @@ -27,6 +27,7 @@ package net.runelite.api; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.image.BufferedImage; +import javax.annotation.Nullable; import net.runelite.api.annotations.VisibleForDevtools; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldArea; @@ -175,6 +176,7 @@ public interface Actor extends Renderable * @param zOffset the z-axis offset * @return the text drawing location */ + @Nullable Point getCanvasTextLocation(Graphics2D graphics, String text, int zOffset); /** From eb7ebddec389866d72400f0984603a3ef4cd7c2e Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 29 Jan 2019 16:27:15 -0800 Subject: [PATCH 003/304] player indicators: Add name position configuration This allows players to select from a number of positions where they would like highlighted player's names to be drawn relative to the player's model. Closes runelite/runelite#878 --- .../PlayerIndicatorsConfig.java | 10 +- .../PlayerIndicatorsOverlay.java | 94 ++++++++++++++----- .../playerindicators/PlayerNameLocation.java | 45 +++++++++ 3 files changed, 119 insertions(+), 30 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java index c40d4a9020..6b032bc8ee 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java @@ -155,13 +155,13 @@ public interface PlayerIndicatorsConfig extends Config @ConfigItem( position = 11, - keyName = "drawOverheadPlayerNames", - name = "Draw names above players", - description = "Configures whether or not player names should be drawn above players" + keyName = "playerNamePosition", + name = "Name position", + description = "Configures the position of drawn player names, or if they should be disabled" ) - default boolean drawOverheadPlayerNames() + default PlayerNameLocation playerNamePosition() { - return true; + return PlayerNameLocation.ABOVE_HEAD; } @ConfigItem( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java index 3795b89f1c..5373fc1eb4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Tomas Slusny + * Copyright (c) 2019, Jordan Atwood * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,10 +39,14 @@ import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.OverlayUtil; +import net.runelite.client.util.Text; @Singleton public class PlayerIndicatorsOverlay extends Overlay { + private static final int ACTOR_OVERHEAD_TEXT_MARGIN = 40; + private static final int ACTOR_HORIZONTAL_TEXT_MARGIN = 10; + private final PlayerIndicatorsService playerIndicatorsService; private final PlayerIndicatorsConfig config; private final ClanManager clanManager; @@ -66,39 +71,78 @@ public class PlayerIndicatorsOverlay extends Overlay private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color) { - if (!config.drawOverheadPlayerNames()) + final PlayerNameLocation drawPlayerNamesConfig = config.playerNamePosition(); + if (drawPlayerNamesConfig == PlayerNameLocation.DISABLED) { return; } - String name = actor.getName().replace('\u00A0', ' '); - int offset = actor.getLogicalHeight() + 40; - Point textLocation = actor.getCanvasTextLocation(graphics, name, offset); - - if (textLocation != null) + final int zOffset; + switch (drawPlayerNamesConfig) { - if (config.showClanRanks() && actor.isClanMember()) + case MODEL_CENTER: + case MODEL_RIGHT: + zOffset = actor.getLogicalHeight() / 2; + break; + default: + zOffset = actor.getLogicalHeight() + ACTOR_OVERHEAD_TEXT_MARGIN; + } + + final String name = Text.sanitize(actor.getName()); + Point textLocation = actor.getCanvasTextLocation(graphics, name, zOffset); + + if (drawPlayerNamesConfig == PlayerNameLocation.MODEL_RIGHT) + { + textLocation = actor.getCanvasTextLocation(graphics, "", zOffset); + + if (textLocation == null) { - ClanMemberRank rank = clanManager.getRank(name); - - if (rank != ClanMemberRank.UNRANKED) - { - BufferedImage clanchatImage = clanManager.getClanImage(rank); - - if (clanchatImage != null) - { - int width = clanchatImage.getWidth(); - int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent(); - Point imageLocation = new Point(textLocation.getX() - width / 2 - 1, textLocation.getY() - textHeight / 2 - clanchatImage.getHeight() / 2); - OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage); - - // move text - textLocation = new Point(textLocation.getX() + width / 2, textLocation.getY()); - } - } + return; } - OverlayUtil.renderTextLocation(graphics, textLocation, name, color); + textLocation = new Point(textLocation.getX() + ACTOR_HORIZONTAL_TEXT_MARGIN, textLocation.getY()); } + + if (textLocation == null) + { + return; + } + + if (config.showClanRanks() && actor.isClanMember()) + { + final ClanMemberRank rank = clanManager.getRank(name); + + if (rank != ClanMemberRank.UNRANKED) + { + final BufferedImage clanchatImage = clanManager.getClanImage(rank); + + if (clanchatImage != null) + { + final int clanImageWidth = clanchatImage.getWidth(); + final int clanImageTextMargin; + final int clanImageNegativeMargin; + + if (drawPlayerNamesConfig == PlayerNameLocation.MODEL_RIGHT) + { + clanImageTextMargin = clanImageWidth; + clanImageNegativeMargin = 0; + } + else + { + clanImageTextMargin = clanImageWidth / 2; + clanImageNegativeMargin = clanImageWidth / 2; + } + + final int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent(); + final Point imageLocation = new Point(textLocation.getX() - clanImageNegativeMargin - 1, textLocation.getY() - textHeight / 2 - clanchatImage.getHeight() / 2); + OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage); + + // move text + textLocation = new Point(textLocation.getX() + clanImageTextMargin, textLocation.getY()); + } + } + } + + OverlayUtil.renderTextLocation(graphics, textLocation, name, color); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java new file mode 100644 index 0000000000..14a4eff208 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.playerindicators; + +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public enum PlayerNameLocation +{ + + DISABLED("Disabled"), + ABOVE_HEAD("Above head"), + MODEL_CENTER("Center of model"), + MODEL_RIGHT("Right of model"); + + private final String name; + + @Override + public String toString() + { + return name; + } +} From ff6a2fd66028583c4addd76ca761f57a13753c1a Mon Sep 17 00:00:00 2001 From: Ron Young Date: Fri, 1 Feb 2019 10:20:34 -0600 Subject: [PATCH 004/304] TabInterface: remove deprecated widget calls --- .../plugins/banktags/tabs/TabInterface.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index 148b965043..f9c69940de 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -64,7 +64,6 @@ import net.runelite.api.SpriteID; import net.runelite.api.VarClientInt; import net.runelite.api.VarClientStr; import net.runelite.api.Varbits; -import net.runelite.api.widgets.WidgetType; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.vars.InputType; @@ -73,6 +72,8 @@ import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetConfig; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.api.widgets.WidgetSizeMode; +import net.runelite.api.widgets.WidgetType; import net.runelite.client.Notifier; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; @@ -111,6 +112,8 @@ public class TabInterface private static final int BUTTON_HEIGHT = 20; private static final int MARGIN = 1; private static final int SCROLL_TICK = 500; + private static final int INCINERATOR_WIDTH = 48; + private static final int INCINERATOR_HEIGHT = 39; private final Client client; private final ClientThread clientThread; @@ -805,17 +808,18 @@ public class TabInterface if (incinerator != null && !incinerator.isHidden()) { - // This is the required way to move incinerator, don't change it! - incinerator.setOriginalHeight(39); - incinerator.setOriginalWidth(48); - incinerator.setRelativeY(itemContainer.getHeight()); - incinerator.revalidate(); + incinerator.setOriginalHeight(INCINERATOR_HEIGHT); + incinerator.setOriginalWidth(INCINERATOR_WIDTH); + incinerator.setOriginalY(INCINERATOR_HEIGHT); Widget child = incinerator.getDynamicChildren()[0]; - child.setHeight(39); - child.setWidth(48); + child.setOriginalHeight(INCINERATOR_HEIGHT); + child.setOriginalWidth(INCINERATOR_WIDTH); + child.setWidthMode(WidgetSizeMode.ABSOLUTE); + child.setHeightMode(WidgetSizeMode.ABSOLUTE); child.setType(WidgetType.GRAPHIC); child.setSpriteId(TabSprites.INCINERATOR.getSpriteId()); + incinerator.revalidate(); bounds.setSize(TAB_WIDTH + MARGIN * 2, height - incinerator.getHeight()); } @@ -900,7 +904,6 @@ public class TabInterface private void updateWidget(Widget t, int y) { t.setOriginalY(y); - t.setRelativeY(y); t.setHidden(y < (bounds.y + BUTTON_HEIGHT + MARGIN) || y > (bounds.y + bounds.height - TAB_HEIGHT - MARGIN - BUTTON_HEIGHT)); t.revalidate(); } From d405b2572edc21a9bb32e65c786e5fb4d0c785bc Mon Sep 17 00:00:00 2001 From: Ron Young Date: Fri, 1 Feb 2019 10:25:39 -0600 Subject: [PATCH 005/304] TabInterface: move icon search into method TabManager: add remove/set icon --- .../plugins/banktags/tabs/TabInterface.java | 23 +++++++------------ .../plugins/banktags/tabs/TabManager.java | 11 +++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index f9c69940de..f141a0514c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -76,13 +76,10 @@ import net.runelite.api.widgets.WidgetSizeMode; import net.runelite.api.widgets.WidgetType; import net.runelite.client.Notifier; import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; import net.runelite.client.game.ItemManager; import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.plugins.banktags.BankTagsConfig; import net.runelite.client.plugins.banktags.BankTagsPlugin; -import static net.runelite.client.plugins.banktags.BankTagsPlugin.CONFIG_GROUP; -import static net.runelite.client.plugins.banktags.BankTagsPlugin.ICON_SEARCH; import static net.runelite.client.plugins.banktags.BankTagsPlugin.TAG_SEARCH; import static net.runelite.client.plugins.banktags.BankTagsPlugin.VAR_TAG_SUFFIX; import net.runelite.client.plugins.banktags.TagManager; @@ -118,7 +115,6 @@ public class TabInterface private final Client client; private final ClientThread clientThread; private final ItemManager itemManager; - private final ConfigManager configManager; private final TagManager tagManager; private final TabManager tabManager; private final ChatboxPanelManager chatboxPanelManager; @@ -151,7 +147,6 @@ public class TabInterface final Client client, final ClientThread clientThread, final ItemManager itemManager, - final ConfigManager configManager, final TagManager tagManager, final TabManager tabManager, final ChatboxPanelManager chatboxPanelManager, @@ -162,7 +157,6 @@ public class TabInterface this.client = client; this.clientThread = clientThread; this.itemManager = itemManager; - this.configManager = configManager; this.tagManager = tagManager; this.tabManager = tabManager; this.chatboxPanelManager = chatboxPanelManager; @@ -214,7 +208,7 @@ public class TabInterface if (config.rememberTab() && !Strings.isNullOrEmpty(config.tab())) { - openTag(TAG_SEARCH + config.tab()); + openTag(config.tab()); } } @@ -242,7 +236,7 @@ public class TabInterface tagManager.addTag(item, activeTab.getTag(), false); } - openTag(TAG_SEARCH + activeTab.getTag()); + openTag(activeTab.getTag()); } return; @@ -295,7 +289,7 @@ public class TabInterface final Iterator dataIter = Text.fromCSV(dataString).iterator(); final String name = dataIter.next(); final String icon = dataIter.next(); - configManager.setConfiguration(CONFIG_GROUP, ICON_SEARCH + name, icon); + tabManager.setIcon(name, icon); while (dataIter.hasNext()) { @@ -553,7 +547,7 @@ public class TabInterface int itemId = itemManager.canonicalize(item.getId()); iconToSet.setIconItemId(itemId); iconToSet.getIcon().setItemId(itemId); - configManager.setConfiguration(CONFIG_GROUP, ICON_SEARCH + iconToSet.getTag(), itemId + ""); + tabManager.setIcon(iconToSet.getTag(), itemId + ""); event.consume(); } @@ -600,7 +594,7 @@ public class TabInterface { if (activeTab != null && tags.contains(activeTab.getTag())) { - openTag(TAG_SEARCH + activeTab.getTag()); + openTag(activeTab.getTag()); } } @@ -715,7 +709,6 @@ public class TabInterface } tabManager.remove(tag); - configManager.unsetConfiguration(CONFIG_GROUP, ICON_SEARCH + tag); tabManager.save(); updateBounds(); @@ -916,10 +909,10 @@ public class TabInterface return itemManager.getItemComposition(item.getId()); } - private void openTag(String tag) + private void openTag(final String tag) { - bankSearch.search(InputType.SEARCH, tag, true); - activateTab(tabManager.find(tag.substring(TAG_SEARCH.length()))); + 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 diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabManager.java index 3f1430dd7c..e1995a5095 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabManager.java @@ -115,6 +115,7 @@ class TabManager { tagTab.setHidden(true); tabs.remove(tagTab); + removeIcon(tag); } } @@ -124,6 +125,16 @@ class TabManager configManager.setConfiguration(CONFIG_GROUP, TAG_TABS_CONFIG, tags); } + void removeIcon(final String tag) + { + configManager.unsetConfiguration(CONFIG_GROUP, ICON_SEARCH + Text.standardize(tag)); + } + + void setIcon(final String tag, final String icon) + { + configManager.setConfiguration(CONFIG_GROUP, ICON_SEARCH + Text.standardize(tag), icon); + } + int size() { return tabs.size(); From 91d5d32d2ee875c0e183a780fa494b5d2e60d38f Mon Sep 17 00:00:00 2001 From: Tanner Chauncy <45087016+dog-of-wisdom@users.noreply.github.com> Date: Fri, 1 Feb 2019 10:26:39 -0600 Subject: [PATCH 006/304] banktags: add tag tab renaming --- .../client/plugins/banktags/TagManager.java | 14 ++++ .../plugins/banktags/tabs/MenuIndexes.java | 1 + .../plugins/banktags/tabs/TabInterface.java | 64 ++++++++++++++++++- .../client/plugins/banktags/tabs/TagTab.java | 2 +- 4 files changed, 78 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/TagManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/TagManager.java index c20974758d..c1d5ff8c11 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/TagManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/TagManager.java @@ -167,6 +167,20 @@ public class TagManager } } + public void renameTag(String oldTag, String newTag) + { + List items = getItemsForTag(Text.standardize(oldTag)); + items.forEach(id -> + { + Collection tags = getTags(id, id < 0); + + tags.remove(Text.standardize(oldTag)); + tags.add(Text.standardize(newTag)); + + setTags(id, tags, id < 0); + }); + } + private int getItemId(int itemId, boolean variation) { itemId = Math.abs(itemId); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/MenuIndexes.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/MenuIndexes.java index afa8f6e276..51e179b143 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/MenuIndexes.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/MenuIndexes.java @@ -39,5 +39,6 @@ class MenuIndexes static final int CHANGE_ICON = 3; static final int DELETE_TAB = 4; static final int EXPORT_TAB = 5; + static final int RENAME_TAB = 6; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index f141a0514c..2daaf0f5c6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -100,6 +100,7 @@ public class TabInterface private static final String EXPORT_TAB = "Export tag tab"; private static final String IMPORT_TAB = "Import tag tab"; private static final String VIEW_TAB = "View tag tab"; + private static final String RENAME_TAB = "Rename tag tab"; private static final String CHANGE_ICON = "Change icon"; private static final String REMOVE_TAG = "Remove-tag"; private static final String TAG_GEAR = "Tag-equipment"; @@ -303,7 +304,7 @@ public class TabInterface if (activeTab != null && name.equals(activeTab.getTag())) { - openTag(TAG_SEARCH + activeTab.getTag()); + openTag(activeTab.getTag()); } notifier.notify("Tag tab " + name + " has been imported from your clipboard!"); @@ -333,7 +334,7 @@ public class TabInterface } else { - openTag(TAG_SEARCH + Text.removeTags(clicked.getName())); + openTag(Text.removeTags(clicked.getName())); } client.playSoundEffect(SoundEffectID.UI_BOOP); @@ -370,6 +371,10 @@ public class TabInterface Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null); notifier.notify("Tag tab " + tagTab.getTag() + " has been copied to your clipboard!"); break; + case Tab.RENAME_TAB: + String renameTarget = Text.standardize(event.getOpbase()); + renameTab(renameTarget); + break; } } @@ -680,6 +685,7 @@ public class TabInterface btn.setAction(2, CHANGE_ICON); btn.setAction(3, REMOVE_TAB); btn.setAction(4, EXPORT_TAB); + btn.setAction(5, RENAME_TAB); btn.setOnOpListener((JavaScriptCallback) this::handleTagTab); tagTab.setBackground(btn); } @@ -715,6 +721,60 @@ public class TabInterface scrollTab(0); } + private void renameTab(String oldTag) + { + chatboxPanelManager.openTextInput("Enter new tag name for tag \"" + oldTag + "\":") + .onDone((newTag) -> clientThread.invoke(() -> + { + if (!Strings.isNullOrEmpty(newTag) && !newTag.equalsIgnoreCase(oldTag)) + { + if (tabManager.find(newTag) == null) + { + TagTab tagTab = tabManager.find(oldTag); + tagTab.setTag(newTag); + + final String coloredName = ColorUtil.wrapWithColorTag(newTag, HILIGHT_COLOR); + tagTab.getIcon().setName(coloredName); + tagTab.getBackground().setName(coloredName); + + tabManager.removeIcon(oldTag); + tabManager.setIcon(newTag, tagTab.getIconItemId() + ""); + + tabManager.save(); + tagManager.renameTag(oldTag, newTag); + + if (activeTab != null && activeTab.equals(tagTab)) + { + openTag(newTag); + } + } + else + { + chatboxPanelManager.openTextMenuInput("The specified bank tag already exists.") + .option("1. Merge into existing tag \"" + newTag + "\".", () -> + clientThread.invoke(() -> + { + tagManager.renameTag(oldTag, newTag); + final String activeTag = activeTab != null ? activeTab.getTag() : ""; + deleteTab(oldTag); + + if (activeTag.equals(oldTag)) + { + openTag(newTag); + } + }) + ) + .option("2. Choose a different name.", () -> + clientThread.invoke(() -> + renameTab(oldTag)) + ) + .build(); + } + } + })) + .build(); + } + private void scrollTick(int direction) { // This ensures that dragging on scroll buttons do not scrolls too fast diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TagTab.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TagTab.java index d3d417f465..004e5f45ed 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TagTab.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TagTab.java @@ -33,7 +33,7 @@ import net.runelite.api.widgets.Widget; @EqualsAndHashCode(of = "tag") class TagTab { - private final String tag; + private String tag; private int iconItemId; private Widget background; private Widget icon; From 8d821abfa4c252859e8b9c90f518ffd7bf0e5449 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 4 Feb 2019 13:15:21 +0000 Subject: [PATCH 007/304] Add .getBounds() to LayoutableRenderableEntity Signed-off-by: Tomas Slusny --- .../screenmarkers/ScreenMarkerRenderable.java | 5 ++++ .../ui/overlay/components/ImageComponent.java | 11 +++++++- .../overlay/components/InfoBoxComponent.java | 17 ++++++++----- .../LayoutableRenderableEntity.java | 2 ++ .../ui/overlay/components/LineComponent.java | 25 +++++++++++++------ .../ui/overlay/components/PanelComponent.java | 23 +++++++++-------- .../components/ProgressBarComponent.java | 19 +++++++++----- .../ui/overlay/components/TitleComponent.java | 21 ++++++++++++---- 8 files changed, 88 insertions(+), 35 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerRenderable.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerRenderable.java index 0d44e01345..95b2da1207 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerRenderable.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerRenderable.java @@ -28,6 +28,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; import java.awt.Stroke; import lombok.AccessLevel; import lombok.Getter; @@ -55,6 +56,9 @@ public class ScreenMarkerRenderable implements LayoutableRenderableEntity @Setter(AccessLevel.PACKAGE) private Stroke stroke; + @Getter + private final Rectangle bounds = new Rectangle(); + @Override public Dimension render(Graphics2D graphics) { @@ -72,6 +76,7 @@ public class ScreenMarkerRenderable implements LayoutableRenderableEntity graphics.setColor(color); graphics.setStroke(stroke); graphics.drawRect(offset, offset, width - thickness, height - thickness); + bounds.setSize(preferredSize); return preferredSize; } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/ImageComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/ImageComponent.java index 05ddc35395..39ec431697 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/ImageComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/ImageComponent.java @@ -27,7 +27,9 @@ package net.runelite.client.ui.overlay.components; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; import java.awt.image.BufferedImage; +import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; @@ -36,6 +38,10 @@ import lombok.Setter; public class ImageComponent implements LayoutableRenderableEntity { private final BufferedImage image; + + @Getter + private final Rectangle bounds = new Rectangle(); + private Point preferredLocation = new Point(); @Override @@ -47,7 +53,10 @@ public class ImageComponent implements LayoutableRenderableEntity } graphics.drawImage(image, preferredLocation.x, preferredLocation.y, null); - return new Dimension(image.getWidth(), image.getHeight()); + final Dimension dimension = new Dimension(image.getWidth(), image.getHeight()); + bounds.setLocation(preferredLocation); + bounds.setSize(dimension); + return dimension; } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java index ca6c55d3be..af54d78296 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java @@ -50,6 +50,9 @@ public class InfoBoxComponent implements LayoutableRenderableEntity @Setter private Dimension preferredSize = new Dimension(DEFAULT_SIZE, DEFAULT_SIZE); + @Getter + private final Rectangle bounds = new Rectangle(); + private String text; private Color color = Color.WHITE; private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR; @@ -64,12 +67,14 @@ public class InfoBoxComponent implements LayoutableRenderableEntity } graphics.setFont(getSize() < DEFAULT_SIZE ? FontManager.getRunescapeSmallFont() : FontManager.getRunescapeFont()); - graphics.translate(preferredLocation.x, preferredLocation.y); + + final int baseX = preferredLocation.x; + final int baseY = preferredLocation.y; // Calculate dimensions final FontMetrics metrics = graphics.getFontMetrics(); final int size = getSize(); - final Rectangle bounds = new Rectangle(size, size); + final Rectangle bounds = new Rectangle(baseX, baseY, size, size); // Render background final BackgroundComponent backgroundComponent = new BackgroundComponent(); @@ -80,18 +85,18 @@ public class InfoBoxComponent implements LayoutableRenderableEntity // Render image graphics.drawImage( image, - (size - image.getWidth(null)) / 2, - (size - image.getHeight(null)) / 2, + baseX + (size - image.getWidth(null)) / 2, + baseY + (size - image.getHeight(null)) / 2, null); // Render caption final TextComponent textComponent = new TextComponent(); textComponent.setColor(color); textComponent.setText(text); - textComponent.setPosition(new Point(((size - metrics.stringWidth(text)) / 2), size - SEPARATOR)); + textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR)); textComponent.render(graphics); - graphics.translate(-preferredLocation.x, -preferredLocation.y); + this.bounds.setBounds(bounds); return bounds.getSize(); } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/LayoutableRenderableEntity.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/LayoutableRenderableEntity.java index ba7f1e7717..7a736686d0 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/LayoutableRenderableEntity.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/LayoutableRenderableEntity.java @@ -26,10 +26,12 @@ package net.runelite.client.ui.overlay.components; import java.awt.Dimension; import java.awt.Point; +import java.awt.Rectangle; import net.runelite.client.ui.overlay.RenderableEntity; public interface LayoutableRenderableEntity extends RenderableEntity { + Rectangle getBounds(); void setPreferredLocation(Point position); void setPreferredSize(Dimension dimension); } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/LineComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/LineComponent.java index efe7f407a6..f6c2f5e77c 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/LineComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/LineComponent.java @@ -31,7 +31,9 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; import lombok.Builder; +import lombok.Getter; import lombok.Setter; @Setter @@ -53,17 +55,22 @@ public class LineComponent implements LayoutableRenderableEntity @Builder.Default private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 0); + @Builder.Default + @Getter + private final Rectangle bounds = new Rectangle(); + @Override public Dimension render(Graphics2D graphics) { - graphics.translate(preferredLocation.x, preferredLocation.y); // Prevent NPEs final String left = MoreObjects.firstNonNull(this.left, ""); final String right = MoreObjects.firstNonNull(this.right, ""); final FontMetrics metrics = graphics.getFontMetrics(); - int x = 0; - int y = metrics.getHeight(); + final int baseX = preferredLocation.x; + final int baseY = preferredLocation.y + metrics.getHeight(); + int x = baseX; + int y = baseY; final int leftFullWidth = getLineWidth(left, metrics); final int rightFullWidth = getLineWidth(right, metrics); @@ -112,8 +119,10 @@ public class LineComponent implements LayoutableRenderableEntity y += metrics.getHeight(); } - graphics.translate(-preferredLocation.x, -preferredLocation.y); - return new Dimension(preferredSize.width, y - metrics.getHeight()); + final Dimension dimension = new Dimension(preferredSize.width, y - baseY); + bounds.setLocation(preferredLocation); + bounds.setSize(dimension); + return dimension; } final TextComponent leftLineComponent = new TextComponent(); @@ -129,8 +138,10 @@ public class LineComponent implements LayoutableRenderableEntity rightLineComponent.render(graphics); y += metrics.getHeight(); - graphics.translate(-preferredLocation.x, -preferredLocation.y); - return new Dimension(preferredSize.width, y - metrics.getHeight()); + final Dimension dimension = new Dimension(preferredSize.width, y - baseY); + bounds.setLocation(preferredLocation); + bounds.setSize(dimension); + return dimension; } private static int getLineWidth(final String line, final FontMetrics metrics) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/PanelComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/PanelComponent.java index 974ec37240..5ea81f2006 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/PanelComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/PanelComponent.java @@ -43,9 +43,8 @@ public class PanelComponent implements LayoutableRenderableEntity VERTICAL; } - @Setter - @Nullable - private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR; + @Getter + private final Rectangle bounds = new Rectangle(); @Setter private Point preferredLocation = new Point(); @@ -53,8 +52,12 @@ public class PanelComponent implements LayoutableRenderableEntity @Setter private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 0); + @Setter + @Nullable + private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR; + @Getter - private List children = new ArrayList<>(); + private final List children = new ArrayList<>(); @Setter private Orientation orientation = Orientation.VERTICAL; @@ -82,8 +85,6 @@ public class PanelComponent implements LayoutableRenderableEntity return null; } - graphics.translate(preferredLocation.x, preferredLocation.y); - // Calculate panel dimension final Dimension dimension = new Dimension( border.x + childDimensions.width + border.width, @@ -93,14 +94,14 @@ public class PanelComponent implements LayoutableRenderableEntity if (backgroundColor != null) { final BackgroundComponent backgroundComponent = new BackgroundComponent(); - backgroundComponent.setRectangle(new Rectangle(dimension)); + backgroundComponent.setRectangle(new Rectangle(preferredLocation, dimension)); backgroundComponent.setBackgroundColor(backgroundColor); backgroundComponent.render(graphics); } // Offset children - final int baseX = border.x; - final int baseY = border.y; + final int baseX = preferredLocation.x + border.x; + final int baseY = preferredLocation.y + border.y; int width = 0; int height = 0; int x = baseX; @@ -174,7 +175,9 @@ public class PanelComponent implements LayoutableRenderableEntity // Cache children bounds childDimensions.setSize(totalWidth, totalHeight); - graphics.translate(-preferredLocation.x, -preferredLocation.y); + // Cache bounds + bounds.setLocation(preferredLocation); + bounds.setSize(dimension); return dimension; } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/ProgressBarComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/ProgressBarComponent.java index 0db182739a..ba4634deec 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/ProgressBarComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/ProgressBarComponent.java @@ -29,7 +29,9 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; import java.text.DecimalFormat; +import lombok.Getter; import lombok.Setter; @Setter @@ -43,6 +45,7 @@ public class ProgressBarComponent implements LayoutableRenderableEntity private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.0"); private static final DecimalFormat DECIMAL_FORMAT_ABS = new DecimalFormat("#0"); + private long minimum; private long maximum = 100; private double value; @@ -53,14 +56,16 @@ public class ProgressBarComponent implements LayoutableRenderableEntity private Point preferredLocation = new Point(); private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 16); + @Getter + private final Rectangle bounds = new Rectangle(); + @Override public Dimension render(Graphics2D graphics) { - graphics.translate(preferredLocation.x, preferredLocation.y); final FontMetrics metrics = graphics.getFontMetrics(); - final int barX = 0; - final int barY = 0; + final int barX = preferredLocation.x; + final int barY = preferredLocation.y; final long span = maximum - minimum; final double currentValue = value - minimum; @@ -82,7 +87,7 @@ public class ProgressBarComponent implements LayoutableRenderableEntity final int progressTextY = barY + ((height - metrics.getHeight()) / 2) + metrics.getHeight(); final int progressFill = (int) (width * Math.min(1, pc)); - //Draw bar + // Draw bar graphics.setColor(backgroundColor); graphics.fillRect(barX, barY, width, height); graphics.setColor(foregroundColor); @@ -94,7 +99,9 @@ public class ProgressBarComponent implements LayoutableRenderableEntity textComponent.setText(textToWrite); textComponent.render(graphics); - graphics.translate(-preferredLocation.x, -preferredLocation.y); - return new Dimension(width, height); + final Dimension dimension = new Dimension(width, height); + bounds.setLocation(preferredLocation); + bounds.setSize(dimension); + return dimension; } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TitleComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TitleComponent.java index 093d596fe9..fa4c9bc3bb 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TitleComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TitleComponent.java @@ -29,7 +29,9 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; import lombok.Builder; +import lombok.Getter; import lombok.Setter; @Setter @@ -47,17 +49,26 @@ public class TitleComponent implements LayoutableRenderableEntity @Builder.Default private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 0); + @Builder.Default + @Getter + private final Rectangle bounds = new Rectangle(); + @Override public Dimension render(Graphics2D graphics) { - graphics.translate(preferredLocation.x, preferredLocation.y); + final int baseX = preferredLocation.x; + final int baseY = preferredLocation.y; final FontMetrics metrics = graphics.getFontMetrics(); final TextComponent titleComponent = new TextComponent(); titleComponent.setText(text); titleComponent.setColor(color); - titleComponent.setPosition(new Point((preferredSize.width - metrics.stringWidth(text)) / 2, metrics.getHeight())); - final Dimension dimension = titleComponent.render(graphics); - graphics.translate(-preferredLocation.x, -preferredLocation.y); - return new Dimension(preferredSize.width, dimension.height); + titleComponent.setPosition(new Point( + baseX + ((preferredSize.width - metrics.stringWidth(text)) / 2), + baseY + metrics.getHeight())); + final Dimension rendered = titleComponent.render(graphics); + final Dimension dimension = new Dimension(preferredSize.width, rendered.height); + bounds.setLocation(preferredLocation); + bounds.setSize(dimension); + return dimension; } } From a536c9e775e8433cf84b365f4bb31e52a8633379 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 4 Feb 2019 20:54:40 +0100 Subject: [PATCH 008/304] Use new LayoutableRenderableEntity#getBounds in InfoboxOverlay Signed-off-by: Tomas Slusny --- .../ui/overlay/components/InfoBoxComponent.java | 13 ++----------- .../client/ui/overlay/infobox/InfoBoxOverlay.java | 10 ++-------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java index af54d78296..be055179bb 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java @@ -44,15 +44,11 @@ public class InfoBoxComponent implements LayoutableRenderableEntity @Getter private String tooltip; - @Getter - private Point preferredLocation = new Point(); - - @Setter - private Dimension preferredSize = new Dimension(DEFAULT_SIZE, DEFAULT_SIZE); - @Getter private final Rectangle bounds = new Rectangle(); + private Point preferredLocation = new Point(); + private Dimension preferredSize = new Dimension(DEFAULT_SIZE, DEFAULT_SIZE); private String text; private Color color = Color.WHITE; private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR; @@ -100,11 +96,6 @@ public class InfoBoxComponent implements LayoutableRenderableEntity return bounds.getSize(); } - public Dimension getPreferredSize() - { - return new Dimension(getSize(), getSize()); - } - private int getSize() { return Math.max(preferredSize.width, preferredSize.height); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java index 15165a4edb..fecd9f1090 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java @@ -37,7 +37,6 @@ import net.runelite.api.Client; import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayUtil; import net.runelite.client.ui.overlay.components.InfoBoxComponent; import net.runelite.client.ui.overlay.components.LayoutableRenderableEntity; import net.runelite.client.ui.overlay.components.PanelComponent; @@ -116,15 +115,10 @@ public class InfoBoxOverlay extends Overlay if (!Strings.isNullOrEmpty(component.getTooltip())) { - final Rectangle intersectionRectangle = new Rectangle(component.getPreferredLocation(), component.getPreferredSize()); - - // Move the intersection based on overlay position + // Create intersection rectangle + final Rectangle intersectionRectangle = new Rectangle(component.getBounds()); intersectionRectangle.translate(getBounds().x, getBounds().y); - // Move the intersection based on overlay "orientation" - final Point transformed = OverlayUtil.transformPosition(getPosition(), intersectionRectangle.getSize()); - intersectionRectangle.translate(transformed.x, transformed.y); - if (intersectionRectangle.contains(mouse)) { tooltipManager.add(new Tooltip(component.getTooltip())); From db1ca3c594ed69f0fefc10fd0bd06e8fbd21a997 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 7 Feb 2019 19:22:34 +0100 Subject: [PATCH 009/304] Unhide barrows widgets on plugin shutdown Signed-off-by: Tomas Slusny --- .../client/plugins/barrows/BarrowsPlugin.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java index 014f7cda98..42c1853a2f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java @@ -49,7 +49,9 @@ import net.runelite.api.events.WallObjectChanged; import net.runelite.api.events.WallObjectDespawned; import net.runelite.api.events.WallObjectSpawned; import net.runelite.api.events.WidgetLoaded; +import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; +import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatMessageBuilder; import net.runelite.client.chat.ChatMessageManager; @@ -128,6 +130,19 @@ public class BarrowsPlugin extends Plugin overlayManager.remove(brotherOverlay); walls.clear(); ladders.clear(); + + // Restore widgets + final Widget potential = client.getWidget(WidgetInfo.BARROWS_POTENTIAL); + if (potential != null) + { + potential.setHidden(false); + } + + final Widget barrowsBrothers = client.getWidget(WidgetInfo.BARROWS_BROTHERS); + if (barrowsBrothers != null) + { + barrowsBrothers.setHidden(false); + } } @Subscribe From 95640a6ed9a35b871b834f39c4c5e59c0211a5e3 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 7 Feb 2019 19:22:53 +0100 Subject: [PATCH 010/304] Unhide NMZ widgets on plugin shutdown Signed-off-by: Tomas Slusny --- .../plugins/nightmarezone/NightmareZonePlugin.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZonePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZonePlugin.java index 69fa0b7164..3c409987af 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZonePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZonePlugin.java @@ -33,6 +33,8 @@ import net.runelite.api.Varbits; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameTick; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.Notifier; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; @@ -81,6 +83,13 @@ public class NightmareZonePlugin extends Plugin { overlayManager.remove(overlay); overlay.removeAbsorptionCounter(); + + Widget nmzWidget = client.getWidget(WidgetInfo.NIGHTMARE_ZONE); + + if (nmzWidget != null) + { + nmzWidget.setHidden(false); + } } @Subscribe From c238926ca7464560c6d8b8efd7124bb9d71a53c5 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 7 Feb 2019 19:23:06 +0100 Subject: [PATCH 011/304] Unhide raids widgets on plugin shutdown Signed-off-by: Tomas Slusny --- .../java/net/runelite/client/plugins/raids/RaidsPlugin.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 0d4633fe94..72a386f5c7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -166,6 +166,12 @@ public class RaidsPlugin extends Plugin inRaidChambers = false; raid = null; timer = null; + + final Widget widget = client.getWidget(WidgetInfo.RAIDS_POINTS_INFOBOX); + if (widget != null) + { + widget.setHidden(false); + } } @Subscribe From 53c831ce0243c73ed6f4589abd05b7d948a75538 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 7 Feb 2019 19:34:40 +0100 Subject: [PATCH 012/304] Do not draw yellow dot for local player in barrows plugin It is already drawn as white square later. Closes #6918 Signed-off-by: Tomas Slusny --- .../net/runelite/client/plugins/barrows/BarrowsOverlay.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java index dfd175cae7..e0b41c5451 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java @@ -94,6 +94,12 @@ class BarrowsOverlay extends Overlay final List players = client.getPlayers(); for (Player player : players) { + if (player == local) + { + // Skip local player as we draw square for it later + continue; + } + net.runelite.api.Point minimapLocation = player.getMinimapLocation(); if (minimapLocation != null) { From 4c8605633960da5f61d426fa2a02e1d7e06e8ad1 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 7 Feb 2019 19:39:10 +0100 Subject: [PATCH 013/304] Use correct player dot color in barrows plugin Signed-off-by: Tomas Slusny --- .../net/runelite/client/plugins/barrows/BarrowsOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java index dfd175cae7..0bc1554b9c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java @@ -90,7 +90,7 @@ class BarrowsOverlay extends Overlay } // Player dots - graphics.setColor(npcColor); + graphics.setColor(playerColor); final List players = client.getPlayers(); for (Player player : players) { From 10543ac207f3a98655b24b89b94104405845105a Mon Sep 17 00:00:00 2001 From: Spedwards Date: Fri, 8 Feb 2019 11:08:00 +1100 Subject: [PATCH 014/304] Update Wyrm bone xp in skill calc based on passed polls (#7614) --- .../plugins/skillcalculator/skill_prayer.json | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json index 7cfb4a790e..f09040662d 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json @@ -235,12 +235,6 @@ "name": "Babydragon Bones", "xp": 30 }, - { - "level": 1, - "icon": 22780, - "name": "Wyrm Bones", - "xp": 30 - }, { "level": 1, "icon": 3398, @@ -248,6 +242,12 @@ "xp": 46.5, "ignoreBonus": true }, + { + "level": 1, + "icon": 22780, + "name": "Wyrm Bones", + "xp": 50 + }, { "level": 1, "icon": 4834, @@ -261,12 +261,6 @@ "xp": 59.5, "ignoreBonus": true }, - { - "level": 1, - "icon": 22783, - "name": "Drake Bones", - "xp": 60 - }, { "level": 1, "icon": 6812, @@ -279,6 +273,12 @@ "name": "Dragon Bones", "xp": 72 }, + { + "level": 1, + "icon": 22783, + "name": "Drake Bones", + "xp": 80 + }, { "level": 1, "icon": 3402, @@ -305,18 +305,18 @@ "name": "Lava Dragon Bones", "xp": 85 }, - { - "level": 1, - "icon": 22786, - "name": "Hydra Bones", - "xp": 90 - }, { "level": 1, "icon": 4832, "name": "Raurg Bones", "xp": 96 }, + { + "level": 1, + "icon": 22786, + "name": "Hydra Bones", + "xp": 110 + }, { "level": 1, "icon": 6729, From fc2bd0b7a0115ff47b49c42f8436e869813f092a Mon Sep 17 00:00:00 2001 From: syngfaa Date: Fri, 8 Feb 2019 01:09:43 +0100 Subject: [PATCH 015/304] Fix SOUL_JOURNEY typo in Kourend Library plugin (#7733) --- .../runelite/client/plugins/kourendlibrary/Book.java | 2 +- .../client/plugins/kourendlibrary/Library.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Book.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Book.java index 974ef66f78..49f6ccf7f9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Book.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Book.java @@ -59,7 +59,7 @@ enum Book TRISTESSAS_TRAGEDY(ItemID.TRISTESSAS_TRAGEDY, "Tristessa's Tragedy", "The Tragedy of Tristessa."), TREACHERY_OF_ROYALTY(ItemID.TREACHERY_OF_ROYALTY, "The Treachery of Royalty", "The Treachery of Royalty, by Professor Answith."), TRANSPORTATION_INCANTATIONS(ItemID.TRANSPORTATION_INCANTATIONS, "Transportation Incantations", "Transportation Incantations, by Amon Ducot."), - SOUL_JORUNEY(ItemID.SOUL_JOURNEY, "Soul Journey", "The Journey of Souls, by Aretha."), + SOUL_JOURNEY(ItemID.SOUL_JOURNEY, "Soul Journey", "The Journey of Souls, by Aretha."), VARLAMORE_ENVOY(ItemID.VARLAMORE_ENVOY, "Varlamore Envoy", "The Envoy to Varlamore, by Deryk Paulson."); private static final Map BY_ID = buildById(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Library.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Library.java index 62ebba956f..02618031db 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Library.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Library.java @@ -299,7 +299,7 @@ class Library DARK_MANUSCRIPT_13515, BYRNES_CORONATION_SPEECH, DARK_MANUSCRIPT_13517, - SOUL_JORUNEY, + SOUL_JOURNEY, DARK_MANUSCRIPT_13518, TRANSPORTATION_INCANTATIONS ), @@ -322,7 +322,7 @@ class Library DARK_MANUSCRIPT_13514, EATHRAM_RADA_EXTRACT, DARK_MANUSCRIPT_13522, - SOUL_JORUNEY, + SOUL_JOURNEY, WINTERTODT_PARABLE, TWILL_ACCORD, DARK_MANUSCRIPT_13515, @@ -348,7 +348,7 @@ class Library DARK_MANUSCRIPT_13519, BYRNES_CORONATION_SPEECH, DARK_MANUSCRIPT_13517, - SOUL_JORUNEY, + SOUL_JOURNEY, DARK_MANUSCRIPT_13522, WINTERTODT_PARABLE, TWILL_ACCORD, @@ -384,7 +384,7 @@ class Library TREACHERY_OF_ROYALTY, DARK_MANUSCRIPT_13518, TRANSPORTATION_INCANTATIONS, - SOUL_JORUNEY, + SOUL_JOURNEY, VARLAMORE_ENVOY ), Arrays.asList( @@ -409,7 +409,7 @@ class Library IDEOLOGY_OF_DARKNESS, WINTERTODT_PARABLE, TWILL_ACCORD, - SOUL_JORUNEY, + SOUL_JOURNEY, DARK_MANUSCRIPT_13515, EATHRAM_RADA_EXTRACT, DARK_MANUSCRIPT_13518, From d7e605f051fe51845dd1812fc635b3ff0e0ded53 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Feb 2019 09:20:15 -0500 Subject: [PATCH 016/304] api: add MessageNode and timestamp to ChatMessage event --- .../java/net/runelite/api/events/ChatMessage.java | 9 +++++++++ .../main/java/net/runelite/mixins/RSClientMixin.java | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java index 9b5e12b6fd..bcc6e00a11 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java @@ -27,6 +27,7 @@ package net.runelite.api.events; import lombok.AllArgsConstructor; import lombok.Data; import net.runelite.api.ChatMessageType; +import net.runelite.api.MessageNode; /** * An event where a new chat message is received. @@ -40,6 +41,10 @@ import net.runelite.api.ChatMessageType; @AllArgsConstructor public class ChatMessage { + /** + * The underlying MessageNode for the message. + */ + private MessageNode messageNode; /** * The type of message received. */ @@ -59,4 +64,8 @@ public class ChatMessage * current name of the clan chat the client is in. */ private String sender; + /** + * Timestamp of the message. + */ + private int timestamp; } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 0c99443490..b67eea80ab 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -27,6 +27,7 @@ package net.runelite.mixins; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; +import java.util.Map; import javax.annotation.Nullable; import javax.inject.Named; import net.runelite.api.ChatMessageType; @@ -51,6 +52,7 @@ import static net.runelite.api.MenuAction.PLAYER_SEVENTH_OPTION; import static net.runelite.api.MenuAction.PLAYER_SIXTH_OPTION; import static net.runelite.api.MenuAction.PLAYER_THIRD_OPTION; import net.runelite.api.MenuEntry; +import net.runelite.api.MessageNode; import net.runelite.api.NPC; import net.runelite.api.Node; import net.runelite.api.PacketBuffer; @@ -100,6 +102,7 @@ import net.runelite.api.mixins.Shadow; import net.runelite.api.vars.AccountType; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.rs.api.RSChatLineBuffer; import net.runelite.rs.api.RSClanMemberManager; import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSDeque; @@ -1236,7 +1239,7 @@ public abstract class RSClientMixin implements RSClient } @Inject - @MethodHook("addChatMessage") + @MethodHook(value = "addChatMessage", end = true) public static void onAddChatMessage(int type, String name, String message, String sender) { Logger logger = client.getLogger(); @@ -1245,8 +1248,13 @@ public abstract class RSClientMixin implements RSClient logger.debug("Chat message type {}: {}", ChatMessageType.of(type), message); } + // Get the message node which was added + Map chatLineMap = client.getChatLineMap(); + RSChatLineBuffer chatLineBuffer = chatLineMap.get(type); + MessageNode messageNode = chatLineBuffer.getLines()[0]; + final ChatMessageType chatMessageType = ChatMessageType.of(type); - final ChatMessage chatMessage = new ChatMessage(chatMessageType, name, message, sender); + final ChatMessage chatMessage = new ChatMessage(messageNode, chatMessageType, name, message, sender, messageNode.getTimestamp()); client.getCallbacks().post(chatMessage); } From d4682746c7b6de4bdc62f8fe14901ce3c1553bbf Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Feb 2019 09:21:35 -0500 Subject: [PATCH 017/304] api: remove SetMessage event --- .../net/runelite/api/events/SetMessage.java | 43 ------------------- .../runelite/mixins/RSMessageNodeMixin.java | 19 -------- 2 files changed, 62 deletions(-) delete mode 100644 runelite-api/src/main/java/net/runelite/api/events/SetMessage.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/SetMessage.java b/runelite-api/src/main/java/net/runelite/api/events/SetMessage.java deleted file mode 100644 index 0dde863bcc..0000000000 --- a/runelite-api/src/main/java/net/runelite/api/events/SetMessage.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.runelite.api.events; - -import lombok.Data; -import net.runelite.api.ChatMessageType; -import net.runelite.api.MessageNode; - -/** - * An event where a {@link MessageNode} has had its message set. - *

- * Called whenever a message is received in the chat box. - *

- * Editing the {@link #messageNode} properties will reflect the change when - * the message in the chat is rendered. The original values of the message - * are held by the other fields of this event. - */ -@Data -public class SetMessage -{ - /** - * The updated message node. - */ - private MessageNode messageNode; - /** - * The set message type. - */ - private ChatMessageType type; - /** - * The name of the player that sent the message. - */ - private String name; - /** - * The sender of the message (ie. clan name). - */ - private String sender; - /** - * The new message value. - */ - private String value; - /** - * Timestamp of the message. - */ - private int timestamp; -} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java index c8ed6cc772..da716252e7 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java @@ -25,7 +25,6 @@ package net.runelite.mixins; import net.runelite.api.ChatMessageType; -import net.runelite.api.events.SetMessage; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.Mixin; @@ -49,15 +48,6 @@ public abstract class RSMessageNodeMixin implements RSMessageNode RSMessageNodeMixin() { rl$timestamp = (int) (System.currentTimeMillis() / 1000L); - - final SetMessage setMessage = new SetMessage(); - setMessage.setMessageNode(this); - setMessage.setType(getType()); - setMessage.setName(getName()); - setMessage.setSender(getSender()); - setMessage.setValue(getValue()); - setMessage.setTimestamp(rl$timestamp); - client.getCallbacks().post(setMessage); } @Inject @@ -103,14 +93,5 @@ public abstract class RSMessageNodeMixin implements RSMessageNode // Clear the runelite formatted message then. runeLiteFormatMessage = null; rl$timestamp = (int) (System.currentTimeMillis() / 1000L); - - final SetMessage setMessage = new SetMessage(); - setMessage.setMessageNode(this); - setMessage.setType(ChatMessageType.of(type)); - setMessage.setName(name); - setMessage.setSender(sender); - setMessage.setValue(value); - setMessage.setTimestamp(rl$timestamp); - client.getCallbacks().post(setMessage); } } From b0f29aab0a8afcad2d15157afc3ea80cdbdc9cb7 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Feb 2019 10:34:42 -0500 Subject: [PATCH 018/304] client: update SetMessage usages to ChatMessage --- .../net/runelite/api/events/ChatMessage.java | 2 + .../net/runelite/client/chat/ChatCommand.java | 4 +- .../client/chat/ChatCommandManager.java | 20 +++--- .../client/chat/ChatMessageManager.java | 12 ++-- .../chatcommands/ChatCommandsPlugin.java | 63 +++++++++---------- .../chathistory/ChatHistoryPlugin.java | 20 +++--- .../ChatNotificationsPlugin.java | 26 ++++---- .../plugins/clanchat/ClanChatPlugin.java | 12 ++-- .../client/plugins/slayer/SlayerPlugin.java | 9 ++- .../plugins/wintertodt/WintertodtPlugin.java | 24 +++++-- .../chatcommands/ChatCommandsPluginTest.java | 22 +++---- .../ChatNotificationsPluginTest.java | 10 +-- .../plugins/cooking/CookingPluginTest.java | 2 +- .../plugins/examine/ExaminePluginTest.java | 4 +- .../itemcharges/ItemChargePluginTest.java | 8 +-- .../screenshot/ScreenshotPluginTest.java | 12 ++-- .../plugins/slayer/SlayerPluginTest.java | 57 +++++++++-------- 17 files changed, 160 insertions(+), 147 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java index bcc6e00a11..0f5182e22b 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java @@ -26,6 +26,7 @@ package net.runelite.api.events; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import net.runelite.api.ChatMessageType; import net.runelite.api.MessageNode; @@ -39,6 +40,7 @@ import net.runelite.api.MessageNode; */ @Data @AllArgsConstructor +@NoArgsConstructor public class ChatMessage { /** diff --git a/runelite-client/src/main/java/net/runelite/client/chat/ChatCommand.java b/runelite-client/src/main/java/net/runelite/client/chat/ChatCommand.java index fb2de339a3..6b4fb9eec2 100644 --- a/runelite-client/src/main/java/net/runelite/client/chat/ChatCommand.java +++ b/runelite-client/src/main/java/net/runelite/client/chat/ChatCommand.java @@ -28,7 +28,7 @@ import java.util.function.BiConsumer; import java.util.function.BiPredicate; import lombok.AllArgsConstructor; import lombok.Getter; -import net.runelite.api.events.SetMessage; +import net.runelite.api.events.ChatMessage; import net.runelite.client.events.ChatInput; @AllArgsConstructor @@ -37,6 +37,6 @@ class ChatCommand { private final String name; private boolean async; - private final BiConsumer execute; + private final BiConsumer execute; private final BiPredicate input; } diff --git a/runelite-client/src/main/java/net/runelite/client/chat/ChatCommandManager.java b/runelite-client/src/main/java/net/runelite/client/chat/ChatCommandManager.java index 4d062d5c91..415afd8d80 100644 --- a/runelite-client/src/main/java/net/runelite/client/chat/ChatCommandManager.java +++ b/runelite-client/src/main/java/net/runelite/client/chat/ChatCommandManager.java @@ -34,7 +34,7 @@ import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.GameState; -import net.runelite.api.events.SetMessage; +import net.runelite.api.events.ChatMessage; import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.ChatInput; @@ -59,22 +59,22 @@ public class ChatCommandManager implements ChatboxInputListener commandManager.register(this); } - public void registerCommand(String command, BiConsumer execute) + public void registerCommand(String command, BiConsumer execute) { registerCommand(command, execute, null); } - public void registerCommand(String command, BiConsumer execute, BiPredicate input) + public void registerCommand(String command, BiConsumer execute, BiPredicate input) { commands.put(command.toLowerCase(), new ChatCommand(command, false, execute, input)); } - public void registerCommandAsync(String command, BiConsumer execute) + public void registerCommandAsync(String command, BiConsumer execute) { registerCommandAsync(command, execute, null); } - public void registerCommandAsync(String command, BiConsumer execute, BiPredicate input) + public void registerCommandAsync(String command, BiConsumer execute, BiPredicate input) { commands.put(command.toLowerCase(), new ChatCommand(command, true, execute, input)); } @@ -85,14 +85,14 @@ public class ChatCommandManager implements ChatboxInputListener } @Subscribe - public void onSetMessage(SetMessage setMessage) + public void onChatMessage(ChatMessage chatMessage) { if (client.getGameState() != GameState.LOGGED_IN) { return; } - switch (setMessage.getType()) + switch (chatMessage.getType()) { case PUBLIC: case PUBLIC_MOD: @@ -104,7 +104,7 @@ public class ChatCommandManager implements ChatboxInputListener return; } - String message = setMessage.getValue(); + String message = chatMessage.getMessage(); String command = extractCommand(message); if (command == null) @@ -120,11 +120,11 @@ public class ChatCommandManager implements ChatboxInputListener if (chatCommand.isAsync()) { - scheduledExecutorService.execute(() -> chatCommand.getExecute().accept(setMessage, message)); + scheduledExecutorService.execute(() -> chatCommand.getExecute().accept(chatMessage, message)); } else { - chatCommand.getExecute().accept(setMessage, message); + chatCommand.getExecute().accept(chatMessage, message); } } diff --git a/runelite-client/src/main/java/net/runelite/client/chat/ChatMessageManager.java b/runelite-client/src/main/java/net/runelite/client/chat/ChatMessageManager.java index b563773915..0dc2d7de1d 100644 --- a/runelite-client/src/main/java/net/runelite/client/chat/ChatMessageManager.java +++ b/runelite-client/src/main/java/net/runelite/client/chat/ChatMessageManager.java @@ -42,10 +42,10 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.MessageNode; import net.runelite.api.Varbits; +import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ResizeableChanged; import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.SetMessage; import net.runelite.api.events.VarbitChanged; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ChatColorConfig; @@ -103,10 +103,10 @@ public class ChatMessageManager } @Subscribe - public void onSetMessage(SetMessage setMessage) + public void onChatMessage(ChatMessage chatMessage) { - MessageNode messageNode = setMessage.getMessageNode(); - ChatMessageType chatMessageType = setMessage.getType(); + MessageNode messageNode = chatMessage.getMessageNode(); + ChatMessageType chatMessageType = chatMessage.getType(); boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; Color usernameColor = null; @@ -125,7 +125,7 @@ public class ChatMessageManager case PUBLIC: case PUBLIC_MOD: { - boolean isFriend = client.isFriended(setMessage.getName(), true) && !client.getLocalPlayer().getName().equals(setMessage.getName()); + boolean isFriend = client.isFriended(chatMessage.getName(), true) && !client.getLocalPlayer().getName().equals(chatMessage.getName()); if (isFriend) { @@ -149,7 +149,7 @@ public class ChatMessageManager messageNode.setName(ColorUtil.wrapWithColorTag(messageNode.getName(), usernameColor)); } - String sender = setMessage.getSender(); + String sender = chatMessage.getSender(); if (senderColor != null && !Strings.isNullOrEmpty(sender)) { messageNode.setSender(ColorUtil.wrapWithColorTag(sender, senderColor)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index a927782809..42a3a9baba 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -43,7 +43,6 @@ import net.runelite.api.MessageNode; import net.runelite.api.VarPlayer; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameTick; -import net.runelite.api.events.SetMessage; import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.vars.AccountType; @@ -360,14 +359,14 @@ public class ChatCommandsPlugin extends Plugin return true; } - private void killCountLookup(SetMessage setMessage, String message) + private void killCountLookup(ChatMessage chatMessage, String message) { if (!config.killcount()) { return; } - ChatMessageType type = setMessage.getType(); + ChatMessageType type = chatMessage.getType(); String search = message.substring(KILLCOUNT_COMMAND_STRING.length() + 1); final String player; @@ -377,7 +376,7 @@ public class ChatCommandsPlugin extends Plugin } else { - player = sanitize(setMessage.getName()); + player = sanitize(chatMessage.getName()); } search = longBossName(search); @@ -403,20 +402,20 @@ public class ChatCommandsPlugin extends Plugin .build(); log.debug("Setting response {}", response); - final MessageNode messageNode = setMessage.getMessageNode(); + final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(response); chatMessageManager.update(messageNode); client.refreshChat(); } - private void questPointsLookup(SetMessage setMessage, String message) + private void questPointsLookup(ChatMessage chatMessage, String message) { if (!config.qp()) { return; } - ChatMessageType type = setMessage.getType(); + ChatMessageType type = chatMessage.getType(); final String player; if (type.equals(ChatMessageType.PRIVATE_MESSAGE_SENT)) @@ -425,7 +424,7 @@ public class ChatCommandsPlugin extends Plugin } else { - player = sanitize(setMessage.getName()); + player = sanitize(chatMessage.getName()); } int qp; @@ -447,7 +446,7 @@ public class ChatCommandsPlugin extends Plugin .build(); log.debug("Setting response {}", response); - final MessageNode messageNode = setMessage.getMessageNode(); + final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(response); chatMessageManager.update(messageNode); client.refreshChat(); @@ -477,14 +476,14 @@ public class ChatCommandsPlugin extends Plugin return true; } - private void personalBestLookup(SetMessage setMessage, String message) + private void personalBestLookup(ChatMessage chatMessage, String message) { if (!config.pb()) { return; } - ChatMessageType type = setMessage.getType(); + ChatMessageType type = chatMessage.getType(); String search = message.substring(PB_COMMAND.length() + 1); final String player; @@ -494,7 +493,7 @@ public class ChatCommandsPlugin extends Plugin } else { - player = sanitize(setMessage.getName()); + player = sanitize(chatMessage.getName()); } search = longBossName(search); @@ -523,7 +522,7 @@ public class ChatCommandsPlugin extends Plugin .build(); log.debug("Setting response {}", response); - final MessageNode messageNode = setMessage.getMessageNode(); + final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(response); chatMessageManager.update(messageNode); client.refreshChat(); @@ -565,17 +564,17 @@ public class ChatCommandsPlugin extends Plugin * Looks up the item price and changes the original message to the * response. * - * @param setMessage The chat message containing the command. + * @param chatMessage The chat message containing the command. * @param message The chat message */ - private void itemPriceLookup(SetMessage setMessage, String message) + private void itemPriceLookup(ChatMessage chatMessage, String message) { if (!config.price()) { return; } - MessageNode messageNode = setMessage.getMessageNode(); + MessageNode messageNode = chatMessage.getMessageNode(); String search = message.substring(PRICE_COMMAND_STRING.length() + 1); List results = itemManager.search(search); @@ -621,10 +620,10 @@ public class ChatCommandsPlugin extends Plugin * Looks up the player skill and changes the original message to the * response. * - * @param setMessage The chat message containing the command. + * @param chatMessage The chat message containing the command. * @param message The chat message */ - private void playerSkillLookup(SetMessage setMessage, String message) + private void playerSkillLookup(ChatMessage chatMessage, String message) { if (!config.lvl()) { @@ -652,7 +651,7 @@ public class ChatCommandsPlugin extends Plugin return; } - final HiscoreLookup lookup = getCorrectLookupFor(setMessage); + final HiscoreLookup lookup = getCorrectLookupFor(chatMessage); try { @@ -682,7 +681,7 @@ public class ChatCommandsPlugin extends Plugin .build(); log.debug("Setting response {}", response); - final MessageNode messageNode = setMessage.getMessageNode(); + final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(response); chatMessageManager.update(messageNode); client.refreshChat(); @@ -693,14 +692,14 @@ public class ChatCommandsPlugin extends Plugin } } - private void combatLevelLookup(SetMessage setMessage, String message) + private void combatLevelLookup(ChatMessage chatMessage, String message) { if (!config.lvl()) { return; } - ChatMessageType type = setMessage.getType(); + ChatMessageType type = chatMessage.getType(); String player; if (type == ChatMessageType.PRIVATE_MESSAGE_SENT) @@ -709,7 +708,7 @@ public class ChatCommandsPlugin extends Plugin } else { - player = sanitize(setMessage.getName()); + player = sanitize(chatMessage.getName()); } try @@ -767,7 +766,7 @@ public class ChatCommandsPlugin extends Plugin .build(); log.debug("Setting response {}", response); - final MessageNode messageNode = setMessage.getMessageNode(); + final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(response); chatMessageManager.update(messageNode); client.refreshChat(); @@ -778,7 +777,7 @@ public class ChatCommandsPlugin extends Plugin } } - private void clueLookup(SetMessage setMessage, String message) + private void clueLookup(ChatMessage chatMessage, String message) { if (!config.clue()) { @@ -799,7 +798,7 @@ public class ChatCommandsPlugin extends Plugin try { final Skill hiscoreSkill; - final HiscoreLookup lookup = getCorrectLookupFor(setMessage); + final HiscoreLookup lookup = getCorrectLookupFor(chatMessage); final HiscoreResult result = hiscoreClient.lookup(lookup.getName(), lookup.getEndpoint()); if (result == null) @@ -858,7 +857,7 @@ public class ChatCommandsPlugin extends Plugin String response = chatMessageBuilder.build(); log.debug("Setting response {}", response); - final MessageNode messageNode = setMessage.getMessageNode(); + final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(response); chatMessageManager.update(messageNode); client.refreshChat(); @@ -872,22 +871,22 @@ public class ChatCommandsPlugin extends Plugin /** * Gets correct lookup data for message * - * @param setMessage chat message + * @param chatMessage chat message * @return hiscore lookup data */ - private HiscoreLookup getCorrectLookupFor(final SetMessage setMessage) + private HiscoreLookup getCorrectLookupFor(final ChatMessage chatMessage) { final String player; final HiscoreEndpoint ironmanStatus; - if (setMessage.getType().equals(ChatMessageType.PRIVATE_MESSAGE_SENT)) + if (chatMessage.getType().equals(ChatMessageType.PRIVATE_MESSAGE_SENT)) { player = client.getLocalPlayer().getName(); ironmanStatus = hiscoreEndpoint; } else { - player = sanitize(setMessage.getName()); + player = sanitize(chatMessage.getName()); if (player.equals(client.getLocalPlayer().getName())) { @@ -897,7 +896,7 @@ public class ChatCommandsPlugin extends Plugin else { // Get ironman status from their icon in chat - ironmanStatus = getHiscoreEndpointByName(setMessage.getName()); + ironmanStatus = getHiscoreEndpointByName(chatMessage.getName()); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java index 4f2ae79818..6ac89bf605 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java @@ -30,8 +30,8 @@ import java.util.Queue; import java.util.Set; import javax.inject.Inject; import net.runelite.api.ChatMessageType; +import net.runelite.api.events.ChatMessage; import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.SetMessage; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; import net.runelite.client.eventbus.Subscribe; @@ -76,11 +76,11 @@ public class ChatHistoryPlugin extends Plugin } @Subscribe - public void onSetMessage(SetMessage message) + public void onChatMessage(ChatMessage chatMessage) { // Start sending old messages right after the welcome message, as that is most reliable source // of information that chat history was reset - if (message.getValue().equals(WELCOME_MESSAGE)) + if (chatMessage.getMessage().equals(WELCOME_MESSAGE)) { QueuedMessage queuedMessage; @@ -92,15 +92,15 @@ public class ChatHistoryPlugin extends Plugin return; } - if (ALLOWED_HISTORY.contains(message.getType())) + if (ALLOWED_HISTORY.contains(chatMessage.getType())) { final QueuedMessage queuedMessage = QueuedMessage.builder() - .type(message.getType()) - .name(message.getName()) - .sender(message.getSender()) - .value(nbsp(message.getValue())) - .runeLiteFormattedMessage(nbsp(message.getMessageNode().getRuneLiteFormatMessage())) - .timestamp(message.getTimestamp()) + .type(chatMessage.getType()) + .name(chatMessage.getName()) + .sender(chatMessage.getSender()) + .value(nbsp(chatMessage.getMessage())) + .runeLiteFormattedMessage(nbsp(chatMessage.getMessageNode().getRuneLiteFormatMessage())) + .timestamp(chatMessage.getTimestamp()) .build(); if (!messageQueue.contains(queuedMessage)) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java index fd148c1e90..0bfd952e01 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java @@ -35,9 +35,9 @@ import java.util.stream.Collectors; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.MessageNode; +import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.SetMessage; import net.runelite.client.Notifier; import net.runelite.client.RuneLiteProperties; import net.runelite.client.chat.ChatColorType; @@ -124,29 +124,29 @@ public class ChatNotificationsPlugin extends Plugin } @Subscribe - public void onSetMessage(SetMessage event) + public void onChatMessage(ChatMessage chatMessage) { - MessageNode messageNode = event.getMessageNode(); + MessageNode messageNode = chatMessage.getMessageNode(); String nodeValue = Text.removeTags(messageNode.getValue()); boolean update = false; - switch (event.getType()) + switch (chatMessage.getType()) { case TRADE: - if (event.getValue().contains("wishes to trade with you.") && config.notifyOnTrade()) + if (chatMessage.getMessage().contains("wishes to trade with you.") && config.notifyOnTrade()) { - notifier.notify(event.getValue()); + notifier.notify(chatMessage.getMessage()); } break; case DUEL: - if (event.getValue().contains("wishes to duel with you.") && config.notifyOnDuel()) + if (chatMessage.getMessage().contains("wishes to duel with you.") && config.notifyOnDuel()) { - notifier.notify(event.getValue()); + notifier.notify(chatMessage.getMessage()); } break; case GAME: // Don't notify for notification messages - if (event.getName().equals(runeLiteProperties.getTitle())) + if (chatMessage.getName().equals(runeLiteProperties.getTitle())) { return; } @@ -170,7 +170,7 @@ public class ChatNotificationsPlugin extends Plugin if (config.notifyOnOwnName()) { - sendNotification(event); + sendNotification(chatMessage); } } } @@ -196,7 +196,7 @@ public class ChatNotificationsPlugin extends Plugin if (config.notifyOnHighlight()) { - sendNotification(event); + sendNotification(chatMessage); } } } @@ -208,7 +208,7 @@ public class ChatNotificationsPlugin extends Plugin } } - private void sendNotification(SetMessage message) + private void sendNotification(ChatMessage message) { String name = Text.removeTags(message.getName()); String sender = message.getSender(); @@ -224,7 +224,7 @@ public class ChatNotificationsPlugin extends Plugin stringBuilder.append(name).append(": "); } - stringBuilder.append(Text.removeTags(message.getValue())); + stringBuilder.append(Text.removeTags(message.getMessage())); String notification = stringBuilder.toString(); notifier.notify(notification); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index b5ee817198..0b738c3f4b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -35,13 +35,13 @@ import net.runelite.api.ClanMemberRank; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.VarClientStr; -import net.runelite.api.widgets.WidgetType; +import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameTick; -import net.runelite.api.events.SetMessage; import net.runelite.api.events.VarClientStrChanged; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.api.widgets.WidgetType; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ClanManager; @@ -134,20 +134,20 @@ public class ClanChatPlugin extends Plugin } @Subscribe - public void onSetMessage(SetMessage setMessage) + public void onChatMessage(ChatMessage chatMessage) { if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) { return; } - if (setMessage.getType() == ChatMessageType.CLANCHAT && client.getClanChatCount() > 0) + if (chatMessage.getType() == ChatMessageType.CLANCHAT && client.getClanChatCount() > 0) { - insertClanRankIcon(setMessage); + insertClanRankIcon(chatMessage); } } - private void insertClanRankIcon(final SetMessage message) + private void insertClanRankIcon(final ChatMessage message) { final ClanMemberRank rank = clanManager.getRank(message.getName()); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index 3d3d64b25b..ff8d6e39bb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -60,7 +60,6 @@ import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.SetMessage; import net.runelite.api.vars.SlayerUnlock; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; @@ -724,14 +723,14 @@ public class SlayerPlugin extends Plugin counter = null; } - void taskLookup(SetMessage setMessage, String message) + void taskLookup(ChatMessage chatMessage, String message) { if (!config.taskCommand()) { return; } - ChatMessageType type = setMessage.getType(); + ChatMessageType type = chatMessage.getType(); final String player; if (type.equals(ChatMessageType.PRIVATE_MESSAGE_SENT)) @@ -740,7 +739,7 @@ public class SlayerPlugin extends Plugin } else { - player = Text.removeTags(setMessage.getName()) + player = Text.removeTags(chatMessage.getName()) .replace('\u00A0', ' '); } @@ -787,7 +786,7 @@ public class SlayerPlugin extends Plugin .append(sb.toString()) .build(); - final MessageNode messageNode = setMessage.getMessageNode(); + final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(response); chatMessageManager.update(messageNode); client.refreshChat(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java index 32605d4ed0..f0da75dc18 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java @@ -32,7 +32,21 @@ import javax.inject.Inject; import lombok.AccessLevel; import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import static net.runelite.api.AnimationID.*; +import static net.runelite.api.AnimationID.CONSTRUCTION; +import static net.runelite.api.AnimationID.FIREMAKING; +import static net.runelite.api.AnimationID.FLETCHING_BOW_CUTTING; +import static net.runelite.api.AnimationID.IDLE; +import static net.runelite.api.AnimationID.LOOKING_INTO; +import static net.runelite.api.AnimationID.WOODCUTTING_3A_AXE; +import static net.runelite.api.AnimationID.WOODCUTTING_ADAMANT; +import static net.runelite.api.AnimationID.WOODCUTTING_BLACK; +import static net.runelite.api.AnimationID.WOODCUTTING_BRONZE; +import static net.runelite.api.AnimationID.WOODCUTTING_DRAGON; +import static net.runelite.api.AnimationID.WOODCUTTING_INFERNAL; +import static net.runelite.api.AnimationID.WOODCUTTING_IRON; +import static net.runelite.api.AnimationID.WOODCUTTING_MITHRIL; +import static net.runelite.api.AnimationID.WOODCUTTING_RUNE; +import static net.runelite.api.AnimationID.WOODCUTTING_STEEL; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.InventoryID; @@ -43,9 +57,9 @@ import static net.runelite.api.ItemID.BRUMA_ROOT; import net.runelite.api.MessageNode; import net.runelite.api.Player; import net.runelite.api.events.AnimationChanged; +import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameTick; import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.SetMessage; import net.runelite.client.Notifier; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ConfigManager; @@ -192,21 +206,21 @@ public class WintertodtPlugin extends Plugin } @Subscribe - public void onSetMessage(SetMessage setMessage) + public void onSetMessage(ChatMessage chatMessage) { if (!isInWintertodt) { return; } - ChatMessageType chatMessageType = setMessage.getType(); + ChatMessageType chatMessageType = chatMessage.getType(); if (chatMessageType != ChatMessageType.SERVER && chatMessageType != ChatMessageType.FILTERED) { return; } - MessageNode messageNode = setMessage.getMessageNode(); + MessageNode messageNode = chatMessage.getMessageNode(); final WintertodtInterruptType interruptType; if (messageNode.getValue().startsWith("The cold of")) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 74e5fc25ae..cc6703db91 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -80,7 +80,7 @@ public class ChatCommandsPluginTest { when(client.getUsername()).thenReturn("Adam"); - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", "Your Corporeal Beast kill count is: 4.", null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", "Your Corporeal Beast kill count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); verify(configManager).setConfiguration("killcount.adam", "corporeal beast", 4); @@ -91,7 +91,7 @@ public class ChatCommandsPluginTest { when(client.getUsername()).thenReturn("Adam"); - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", "Your completed Theatre of Blood count is: 73.", null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", "Your completed Theatre of Blood count is: 73.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); verify(configManager).setConfiguration("killcount.adam", "theatre of blood", 73); @@ -102,7 +102,7 @@ public class ChatCommandsPluginTest { when(client.getUsername()).thenReturn("Adam"); - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", "Your subdued Wintertodt count is: 4.", null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", "Your subdued Wintertodt count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); verify(configManager).setConfiguration("killcount.adam", "wintertodt", 4); @@ -113,7 +113,7 @@ public class ChatCommandsPluginTest { when(client.getUsername()).thenReturn("Adam"); - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", "Your Kree'arra kill count is: 4.", null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", "Your Kree'arra kill count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); verify(configManager).setConfiguration("killcount.adam", "kree'arra", 4); @@ -124,7 +124,7 @@ public class ChatCommandsPluginTest { when(client.getUsername()).thenReturn("Adam"); - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", "Your Barrows chest count is: 277.", null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", "Your Barrows chest count is: 277.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); verify(configManager).setConfiguration("killcount.adam", "barrows chests", 277); @@ -138,10 +138,10 @@ public class ChatCommandsPluginTest when(client.getUsername()).thenReturn("Adam"); // This sets lastBoss - ChatMessage chatMessage = new ChatMessage(SERVER, "", "Your Kree'arra kill count is: 4.", null); + ChatMessage chatMessage = new ChatMessage(null, SERVER, "", "Your Kree'arra kill count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - chatMessage = new ChatMessage(SERVER, "", FIGHT_DURATION, null); + chatMessage = new ChatMessage(null, SERVER, "", FIGHT_DURATION, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(79)); @@ -155,10 +155,10 @@ public class ChatCommandsPluginTest when(client.getUsername()).thenReturn("Adam"); // This sets lastBoss - ChatMessage chatMessage = new ChatMessage(SERVER, "", "Your Zulrah kill count is: 4.", null); + ChatMessage chatMessage = new ChatMessage(null, SERVER, "", "Your Zulrah kill count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - chatMessage = new ChatMessage(SERVER, "", FIGHT_DURATION, null); + chatMessage = new ChatMessage(null, SERVER, "", FIGHT_DURATION, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); verify(configManager).setConfiguration(eq("personalbest.adam"), eq("zulrah"), eq(55)); @@ -172,10 +172,10 @@ public class ChatCommandsPluginTest when(client.getUsername()).thenReturn("Adam"); // This sets lastBoss - ChatMessage chatMessage = new ChatMessage(SERVER, "", "Your Kree'arra kill count is: 4.", null); + ChatMessage chatMessage = new ChatMessage(null, SERVER, "", "Your Kree'arra kill count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - chatMessage = new ChatMessage(SERVER, "", NEW_PB, null); + chatMessage = new ChatMessage(null, SERVER, "", NEW_PB, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(181)); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java index a120339da0..2105f089ef 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java @@ -33,7 +33,7 @@ import javax.inject.Inject; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.MessageNode; -import net.runelite.api.events.SetMessage; +import net.runelite.api.events.ChatMessage; import net.runelite.client.Notifier; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.util.Text; @@ -83,12 +83,12 @@ public class ChatNotificationsPluginTest MessageNode messageNode = mock(MessageNode.class); when(messageNode.getValue()).thenReturn("Deathbeam, Deathbeam OSRS"); - SetMessage setMessage = new SetMessage(); - setMessage.setType(ChatMessageType.PUBLIC); - setMessage.setMessageNode(messageNode); + ChatMessage chatMessage = new ChatMessage(); + chatMessage.setType(ChatMessageType.PUBLIC); + chatMessage.setMessageNode(messageNode); chatNotificationsPlugin.startUp(); // load highlight config - chatNotificationsPlugin.onSetMessage(setMessage); + chatNotificationsPlugin.onChatMessage(chatMessage); verify(messageNode).setValue("Deathbeam, Deathbeam OSRS"); } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java index 33b969015d..024a4de8b3 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java @@ -79,7 +79,7 @@ public class CookingPluginTest { for (String message : COOKING_MESSAGES) { - ChatMessage chatMessage = new ChatMessage(ChatMessageType.FILTERED, "", message, ""); + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.FILTERED, "", message, "", 0); cookingPlugin.onChatMessage(chatMessage); } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java index 7c00bab4a9..f7416f4aad 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java @@ -94,7 +94,7 @@ public class ExaminePluginTest menuOptionClicked.setId(ItemID.ABYSSAL_WHIP); examinePlugin.onMenuOptionClicked(menuOptionClicked); - ChatMessage chatMessage = new ChatMessage(ChatMessageType.EXAMINE_ITEM, "", "A weapon from the abyss.", ""); + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.EXAMINE_ITEM, "", "A weapon from the abyss.", "", 0); examinePlugin.onChatMessage(chatMessage); // This passes due to not mocking the ItemComposition for the whip @@ -112,7 +112,7 @@ public class ExaminePluginTest menuOptionClicked.setId(ItemID.ABYSSAL_WHIP); examinePlugin.onMenuOptionClicked(menuOptionClicked); - ChatMessage chatMessage = new ChatMessage(ChatMessageType.EXAMINE_ITEM, "", "100000 x Abyssal whip", ""); + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.EXAMINE_ITEM, "", "100000 x Abyssal whip", "", 0); examinePlugin.onChatMessage(chatMessage); verify(examineClient, never()).submitItem(anyInt(), anyString()); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java index 36ffcf643e..b8fc81a16a 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java @@ -76,19 +76,19 @@ public class ItemChargePluginTest @Test public void testOnChatMessage() { - ChatMessage chatMessage = new ChatMessage(ChatMessageType.SERVER, "", CHECK, ""); + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", CHECK, "", 0); itemChargePlugin.onChatMessage(chatMessage); assertEquals(10, itemChargePlugin.getDodgyCharges()); - chatMessage = new ChatMessage(ChatMessageType.SERVER, "", PROTECT, ""); + chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", PROTECT, "", 0); itemChargePlugin.onChatMessage(chatMessage); assertEquals(9, itemChargePlugin.getDodgyCharges()); - chatMessage = new ChatMessage(ChatMessageType.SERVER, "", PROTECT_1, ""); + chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", PROTECT_1, "", 0); itemChargePlugin.onChatMessage(chatMessage); assertEquals(1, itemChargePlugin.getDodgyCharges()); - chatMessage = new ChatMessage(ChatMessageType.SERVER, "", BREAK, ""); + chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", BREAK, "", 0); itemChargePlugin.onChatMessage(chatMessage); assertEquals(10, itemChargePlugin.getDodgyCharges()); } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java index 18e6e23700..be5b08e71b 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java @@ -110,7 +110,7 @@ public class ScreenshotPluginTest @Test public void testClueScroll() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Seth", CLUE_SCROLL, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Seth", CLUE_SCROLL, null, 0); screenshotPlugin.onChatMessage(chatMessageEvent); assertEquals("medium", screenshotPlugin.getClueType()); @@ -120,7 +120,7 @@ public class ScreenshotPluginTest @Test public void testBarrowsChest() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Seth", BARROWS_CHEST, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Seth", BARROWS_CHEST, null, 0); screenshotPlugin.onChatMessage(chatMessageEvent); assertEquals(310, screenshotPlugin.getBarrowsNumber()); @@ -129,7 +129,7 @@ public class ScreenshotPluginTest @Test public void testChambersOfXericChest() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Seth", CHAMBERS_OF_XERIC_CHEST, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Seth", CHAMBERS_OF_XERIC_CHEST, null, 0); screenshotPlugin.onChatMessage(chatMessageEvent); assertEquals(489, screenshotPlugin.getChambersOfXericNumber()); @@ -138,7 +138,7 @@ public class ScreenshotPluginTest @Test public void testTheatreOfBloodChest() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Magic fTail", THEATRE_OF_BLOOD_CHEST, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Magic fTail", THEATRE_OF_BLOOD_CHEST, null, 0); screenshotPlugin.onChatMessage(chatMessageEvent); assertEquals(73, screenshotPlugin.gettheatreOfBloodNumber()); @@ -147,7 +147,7 @@ public class ScreenshotPluginTest @Test public void testValuableDrop() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", VALUABLE_DROP, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", VALUABLE_DROP, null, 0); screenshotPlugin.onChatMessage(chatMessageEvent); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); @@ -156,7 +156,7 @@ public class ScreenshotPluginTest @Test public void testUntradeableDrop() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", UNTRADEABLE_DROP, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", UNTRADEABLE_DROP, null, 0); screenshotPlugin.onChatMessage(chatMessageEvent); verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java index c0a16d3df0..6bfa00f4f2 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java @@ -38,7 +38,6 @@ import net.runelite.api.Player; import net.runelite.api.coords.LocalPoint; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameTick; -import net.runelite.api.events.SetMessage; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.Notifier; @@ -255,7 +254,7 @@ public class SlayerPluginTest @Test public void testPartnerTask() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", TASK_NEW_FROM_PARTNER, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", TASK_NEW_FROM_PARTNER, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals("Dust Devils", slayerPlugin.getTaskName()); @@ -265,7 +264,7 @@ public class SlayerPluginTest @Test public void testCheckSlayerGem() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", TASK_CHECKSLAYERGEM, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", TASK_CHECKSLAYERGEM, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals("Suqahs", slayerPlugin.getTaskName()); assertEquals(211, slayerPlugin.getAmount()); @@ -274,7 +273,7 @@ public class SlayerPluginTest @Test public void testCheckSlayerGemWildernessTask() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", TASK_CHECKSLAYERGEM_WILDERNESS, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", TASK_CHECKSLAYERGEM_WILDERNESS, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals("Suqahs", slayerPlugin.getTaskName()); assertEquals(211, slayerPlugin.getAmount()); @@ -284,7 +283,7 @@ public class SlayerPluginTest @Test public void testCheckSlayerGemKonarTask() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", TASK_CHECKSLAYERGEM_KONAR, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", TASK_CHECKSLAYERGEM_KONAR, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals("Blue dragons", slayerPlugin.getTaskName()); @@ -322,7 +321,7 @@ public class SlayerPluginTest @Test public void testOneTask() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_ONE, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Perterter", TASK_ONE, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(1, slayerPlugin.getStreak()); @@ -333,7 +332,7 @@ public class SlayerPluginTest @Test public void testNoPoints() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE_NO_POINTS, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Perterter", TASK_COMPLETE_NO_POINTS, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(3, slayerPlugin.getStreak()); @@ -344,7 +343,7 @@ public class SlayerPluginTest @Test public void testPoints() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_POINTS, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Perterter", TASK_POINTS, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(9, slayerPlugin.getStreak()); @@ -356,7 +355,7 @@ public class SlayerPluginTest @Test public void testLargeStreak() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_LARGE_STREAK, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Perterter", TASK_LARGE_STREAK, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(2465, slayerPlugin.getStreak()); @@ -371,7 +370,7 @@ public class SlayerPluginTest slayerPlugin.setTaskName("cows"); slayerPlugin.setAmount(42); - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Perterter", TASK_COMPLETE, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals("", slayerPlugin.getTaskName()); @@ -384,7 +383,7 @@ public class SlayerPluginTest slayerPlugin.setTaskName("cows"); slayerPlugin.setAmount(42); - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_CANCELED, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Perterter", TASK_CANCELED, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals("", slayerPlugin.getTaskName()); @@ -394,7 +393,7 @@ public class SlayerPluginTest @Test public void testSuperiorNotification() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Superior", SUPERIOR_MESSAGE, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "Superior", SUPERIOR_MESSAGE, null, 0); when(slayerConfig.showSuperiorNotification()).thenReturn(true); slayerPlugin.onChatMessage(chatMessageEvent); @@ -408,7 +407,7 @@ public class SlayerPluginTest @Test public void testBraceletSlaughter() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", BRACLET_SLAUGHTER, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", BRACLET_SLAUGHTER, null, 0); slayerPlugin.setAmount(42); slayerPlugin.setSlaughterChargeCount(10); @@ -418,18 +417,18 @@ public class SlayerPluginTest assertEquals(9, slayerPlugin.getSlaughterChargeCount()); assertEquals(43, slayerPlugin.getAmount()); - chatMessageEvent = new ChatMessage(SERVER, "", CHAT_BRACELET_SLAUGHTER_CHARGE, null); + chatMessageEvent = new ChatMessage(null, SERVER, "", CHAT_BRACELET_SLAUGHTER_CHARGE, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(12, slayerPlugin.getSlaughterChargeCount()); - chatMessageEvent = new ChatMessage(SERVER, "", CHAT_BRACELET_SLAUGHTER_CHARGE_ONE, null); + chatMessageEvent = new ChatMessage(null, SERVER, "", CHAT_BRACELET_SLAUGHTER_CHARGE_ONE, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(1, slayerPlugin.getSlaughterChargeCount()); slayerPlugin.setSlaughterChargeCount(1); - chatMessageEvent = new ChatMessage(SERVER, "", BRACLET_SLAUGHTER_V3, null); + chatMessageEvent = new ChatMessage(null, SERVER, "", BRACLET_SLAUGHTER_V3, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(30, slayerPlugin.getSlaughterChargeCount()); @@ -442,7 +441,7 @@ public class SlayerPluginTest slayerPlugin.onGameTick(new GameTick()); assertEquals(30, slayerPlugin.getSlaughterChargeCount()); - chatMessageEvent = new ChatMessage(SERVER, "", BRACLET_SLAUGHTER_V2, null); + chatMessageEvent = new ChatMessage(null, SERVER, "", BRACLET_SLAUGHTER_V2, null, 0); slayerPlugin.setAmount(42); slayerPlugin.setSlaughterChargeCount(2); @@ -456,7 +455,7 @@ public class SlayerPluginTest @Test public void testBraceletExpeditious() { - ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", BRACLET_EXPEDITIOUS, null); + ChatMessage chatMessageEvent = new ChatMessage(null, SERVER, "", BRACLET_EXPEDITIOUS, null, 0); slayerPlugin.setAmount(42); slayerPlugin.setExpeditiousChargeCount(10); @@ -466,18 +465,18 @@ public class SlayerPluginTest assertEquals(41, slayerPlugin.getAmount()); assertEquals(9, slayerPlugin.getExpeditiousChargeCount()); - chatMessageEvent = new ChatMessage(SERVER, "", CHAT_BRACELET_EXPEDITIOUS_CHARGE, null); + chatMessageEvent = new ChatMessage(null, SERVER, "", CHAT_BRACELET_EXPEDITIOUS_CHARGE, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(12, slayerPlugin.getExpeditiousChargeCount()); - chatMessageEvent = new ChatMessage(SERVER, "", CHAT_BRACELET_EXPEDITIOUS_CHARGE_ONE, null); + chatMessageEvent = new ChatMessage(null, SERVER, "", CHAT_BRACELET_EXPEDITIOUS_CHARGE_ONE, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(1, slayerPlugin.getExpeditiousChargeCount()); slayerPlugin.setExpeditiousChargeCount(1); - chatMessageEvent = new ChatMessage(SERVER, "", BRACLET_EXPEDITIOUS_V3, null); + chatMessageEvent = new ChatMessage(null, SERVER, "", BRACLET_EXPEDITIOUS_V3, null, 0); slayerPlugin.onChatMessage(chatMessageEvent); assertEquals(30, slayerPlugin.getExpeditiousChargeCount()); @@ -490,7 +489,7 @@ public class SlayerPluginTest slayerPlugin.onGameTick(new GameTick()); assertEquals(30, slayerPlugin.getExpeditiousChargeCount()); - chatMessageEvent = new ChatMessage(SERVER, "", BRACLET_EXPEDITIOUS_V2, null); + chatMessageEvent = new ChatMessage(null, SERVER, "", BRACLET_EXPEDITIOUS_V2, null, 0); slayerPlugin.setAmount(42); slayerPlugin.setExpeditiousChargeCount(2); @@ -511,7 +510,7 @@ public class SlayerPluginTest slayerPlugin.setTaskName("Suqahs"); slayerPlugin.setAmount(231); - ChatMessage chatMessage = new ChatMessage(SERVER, "", TASK_UPDATE_COMBAT_BRACELET, null); + ChatMessage chatMessage = new ChatMessage(null, SERVER, "", TASK_UPDATE_COMBAT_BRACELET, null, 0); slayerPlugin.onChatMessage(chatMessage); assertEquals("Suqahs", slayerPlugin.getTaskName()); @@ -531,7 +530,7 @@ public class SlayerPluginTest when(slayerConfig.taskCommand()).thenReturn(true); when(chatClient.getTask(anyString())).thenReturn(task); - SetMessage setMessage = new SetMessage(); + ChatMessage setMessage = new ChatMessage(); setMessage.setType(ChatMessageType.PUBLIC); setMessage.setName("Adam"); setMessage.setMessageNode(mock(MessageNode.class)); @@ -553,12 +552,12 @@ public class SlayerPluginTest when(slayerConfig.taskCommand()).thenReturn(true); when(chatClient.getTask(anyString())).thenReturn(task); - SetMessage setMessage = new SetMessage(); - setMessage.setType(ChatMessageType.PUBLIC); - setMessage.setName("Adam"); - setMessage.setMessageNode(mock(MessageNode.class)); + ChatMessage chatMessage = new ChatMessage(); + chatMessage.setType(ChatMessageType.PUBLIC); + chatMessage.setName("Adam"); + chatMessage.setMessageNode(mock(MessageNode.class)); - slayerPlugin.taskLookup(setMessage, "!task"); + slayerPlugin.taskLookup(chatMessage, "!task"); verify(chatMessageManager, never()).update(any(MessageNode.class)); } From 4e6552a1f19b736714ebce29d44550b5817f17e9 Mon Sep 17 00:00:00 2001 From: Henry Zhang Date: Thu, 7 Feb 2019 22:58:44 -0800 Subject: [PATCH 019/304] Migrate onSetMessage to onChatMessage These were probably just missed. They cause warnings in the console and make it so the Wintertodt plugin doesn't start --- .../runelite/client/plugins/wintertodt/WintertodtPlugin.java | 2 +- .../plugins/chatnotifications/ChatNotificationsPluginTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java index f0da75dc18..67ac3ec635 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java @@ -206,7 +206,7 @@ public class WintertodtPlugin extends Plugin } @Subscribe - public void onSetMessage(ChatMessage chatMessage) + public void onChatMessage(ChatMessage chatMessage) { if (!isInWintertodt) { diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java index 2105f089ef..68d2a8cc1a 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java @@ -76,7 +76,7 @@ public class ChatNotificationsPluginTest } @Test - public void onSetMessage() + public void onChatMessage() { when(config.highlightWordsString()).thenReturn("Deathbeam, Deathbeam OSRS , test"); From b000818393c026f73ac7e473f143817446b30b4d Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Thu, 7 Feb 2019 23:09:56 -0800 Subject: [PATCH 020/304] item stats: Represent boost data as ints Particularly since exposing StatBoosts and StatChanges through the item stats service, it has become evident that storing stat change data as a human-readable string is not especially useful for consumers of the service as they must handle string processing, particularly for special cases such as range stat boosts or spicy stews. This patch changes StatChanges to expose their relative, theoretical, and absolute change values as ints instead for ease of consumption, and adds methods to get human-readable versions of these relative and theoretical values for display purposes. Fixes runelite/runelite#6594 --- .../plugins/itemstats/ItemStatOverlay.java | 4 +- .../plugins/itemstats/RangeStatBoost.java | 34 ++--- .../plugins/itemstats/RangeStatChange.java | 117 ++++++++++++++++++ .../client/plugins/itemstats/StatBoost.java | 7 +- .../client/plugins/itemstats/StatChange.java | 35 +++++- .../plugins/itemstats/special/SpicyStew.java | 12 +- .../plugins/statusbars/StatusBarsOverlay.java | 20 +-- 7 files changed, 173 insertions(+), 56 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatChange.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java index 986321e966..73113bd0ac 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java @@ -258,7 +258,7 @@ public class ItemStatOverlay extends Overlay if (config.relative()) { - b.append(c.getRelative()); + b.append(c.getFormattedRelative()); } if (config.theoretical()) @@ -267,7 +267,7 @@ public class ItemStatOverlay extends Overlay { b.append("/"); } - b.append(c.getTheoretical()); + b.append(c.getFormattedTheoretical()); } if (config.absolute() && (config.relative() || config.theoretical())) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatBoost.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatBoost.java index abe47cea1c..13011b9f6a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatBoost.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatBoost.java @@ -42,33 +42,21 @@ public class RangeStatBoost extends SingleEffect @Override public StatChange effect(Client client) { - final StatChange a = this.a.effect(client); - final StatChange b = this.b.effect(client); + final StatChange changeA = this.a.effect(client); + final StatChange changeB = this.b.effect(client); - final StatChange r = new StatChange(); - r.setAbsolute(concat(a.getAbsolute(), b.getAbsolute())); - r.setRelative(concat(a.getRelative(), b.getRelative())); - r.setTheoretical(concat(a.getTheoretical(), b.getTheoretical())); - r.setStat(a.getStat()); + final RangeStatChange r = new RangeStatChange(); + r.setMinAbsolute(Math.min(changeA.getAbsolute(), changeB.getAbsolute())); + r.setAbsolute(Math.max(changeA.getAbsolute(), changeB.getAbsolute())); + r.setMinRelative(Math.min(changeA.getRelative(), changeB.getRelative())); + r.setRelative(Math.max(changeA.getRelative(), changeB.getRelative())); + r.setMinTheoretical(Math.min(changeA.getTheoretical(), changeB.getTheoretical())); + r.setTheoretical(Math.max(changeA.getTheoretical(), changeB.getTheoretical())); + r.setStat(changeA.getStat()); - final int avg = (a.getPositivity().ordinal() + b.getPositivity().ordinal()) / 2; + final int avg = (changeA.getPositivity().ordinal() + changeB.getPositivity().ordinal()) / 2; r.setPositivity(Positivity.values()[avg]); return r; } - - private String concat(String a, String b) - { - // If they share a operator, strip b's duplicate - if (a.length() > 1 && b.length() > 1) - { - final char a0 = a.charAt(0); - if ((a0 == '+' || a0 == '-' || a0 == '±') && b.charAt(0) == a0) - { - b = b.substring(1); - } - } - - return a + "~" + b; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatChange.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatChange.java new file mode 100644 index 0000000000..90b614bf10 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatChange.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2016-2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.itemstats; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * A stat change which can result in different magnitudes of change to the stat + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class RangeStatChange extends StatChange +{ + /** + * Minimum relative change that will occur if the stat boost is applied now. + * In this class, {@code relative} is representative of the maximum relative change that will + * occur. + */ + private int minRelative; + + /** + * Minimum theoretical change that can occur before boost cap is enforced. + * In this class, {@code theoretical} is representative of the maximum theoretical change that + * will occur. + */ + private int minTheoretical; + + /** + * Minimum absolute total of the stat after applying the boost. + * In this class, {@code absolute} is representative of the maximum absolute change that will + * occur. + */ + private int minAbsolute; + + /** + * Returns a human-readable formatted relative boost. + * Should be the boost range in the format "±N" (for minimum -N and maximum +N values), + * "+MIN~MAX" (for minimum and maximum values of the same sign), + * "-MIN~+MAX" (for negative minimum and positive maximum values), or + * "+MAX" (for equal minimum and maximum values). + * + * @return The formatted relative boost amount + */ + @Override + public String getFormattedRelative() + { + return concat(minRelative, getRelative()); + } + + /** + * Returns a human-readable formatted theoretical boost. + * Should be the boost range in the format "±N" (for minimum -N and maximum +N values), + * "+MIN~MAX" (for minimum and maximum values of the same sign), + * "-MIN~+MAX" (for negative minimum and positive maximum values), or + * "+MAX" (for equal minimum and maximum values). + * + * @return The formatted theoretical boost amount + */ + @Override + public String getFormattedTheoretical() + { + return concat(minTheoretical, getTheoretical()); + } + + private static String concat(int changeA, int changeB) + { + if (changeA == changeB) + { + return formatBoost(changeA); + } + else if (changeA * -1 == changeB) + { + return "±" + Math.abs(changeA); + } + + final StringBuilder sb = new StringBuilder(); + + sb.append(String.format("%+d", changeA)); + sb.append('~'); + + // If they share a operator, strip b's duplicate + if (changeA < 0 && changeB < 0 + || changeA >= 0 && changeB >= 0) + { + sb.append(Math.abs(changeB)); + } + else + { + sb.append(String.format("%+d", changeB)); + } + + return sb.toString(); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatBoost.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatBoost.java index 1bc59d7412..cc5f7797f2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatBoost.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatBoost.java @@ -88,10 +88,9 @@ public abstract class StatBoost extends SingleEffect { out.setPositivity(Positivity.WORSE); } - out.setAbsolute(Integer.toString(newValue)); - out.setRelative(String.format("%+d", delta)); - out.setTheoretical(String.format("%+d", calcedDelta)); + out.setAbsolute(newValue); + out.setRelative(delta); + out.setTheoretical(calcedDelta); return out; } - } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatChange.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatChange.java index 3157748083..e9453984f4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatChange.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatChange.java @@ -40,23 +40,48 @@ public class StatChange /** * Relative change that will occur if the stat boost is applied now. - * Should be a number prefixed by "+" or "-". */ - private String relative; + private int relative; /** * Theoretical change that can occur before boost cap is enforced. - * Should be a number prefixed by "+" or "-". */ - private String theoretical; + private int theoretical; /** * Absolute total of the stat after applying the boost. */ - private String absolute; + private int absolute; /** * How beneficial this stat boost will be to the player. */ private Positivity positivity; + + /** + * Returns a human-readable formatted relative boost. + * Should be the boost amount prefixed by "+" or "-". + * + * @return The formatted relative boost amount + */ + public String getFormattedRelative() + { + return formatBoost(relative); + } + + /** + * Returns a human-readable formatted theoretical boost. + * Should be the boost amount prefixed by "+" or "-". + * + * @return The formatted theoretical boost amount + */ + public String getFormattedTheoretical() + { + return formatBoost(theoretical); + } + + static String formatBoost(int boost) + { + return String.format("%+d", boost); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/SpicyStew.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/SpicyStew.java index 8dab7fd601..7eee548751 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/SpicyStew.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/SpicyStew.java @@ -132,11 +132,14 @@ public class SpicyStew implements Effect int currentBoost = currentValue - currentBase; // Can be negative int spiceBoostCapped = (currentBoost <= 0) ? spiceBoost : Math.max(0, spiceBoost - currentBoost); - StatChange change = new StatChange(); + final RangeStatChange change = new RangeStatChange(); change.setStat(stat); - change.setRelative("±" + spiceBoostCapped); - change.setTheoretical("±" + spiceBoost); - change.setAbsolute(String.valueOf(stat.getValue(client) + spiceBoostCapped)); + change.setMinRelative(-spiceBoost); + change.setRelative(spiceBoostCapped); + change.setMinTheoretical(-spiceBoost); + change.setTheoretical(spiceBoost); + change.setMinAbsolute(Math.max(-spiceBoost, -currentValue)); + change.setAbsolute(stat.getValue(client) + spiceBoostCapped); Positivity positivity; if (spiceBoostCapped == 0) @@ -155,5 +158,4 @@ public class SpicyStew implements Effect return change; } - } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java index 0deb55c2ab..ada42169ad 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java @@ -24,8 +24,6 @@ */ package net.runelite.client.plugins.statusbars; -import com.google.common.base.Strings; -import com.google.common.primitives.Ints; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; @@ -196,28 +194,16 @@ class StatusBarsOverlay extends Overlay for (final StatChange c : statsChanges.getStatChanges()) { - final String strVar = c.getTheoretical(); - - if (Strings.isNullOrEmpty(strVar)) - { - continue; - } - - final Integer value = Ints.tryParse(strVar.startsWith("+") ? strVar.substring(1) : strVar); - - if (value == null) - { - continue; - } + final int theoreticalBoost = c.getTheoretical(); if (c.getStat().getName().equals(Skill.HITPOINTS.getName())) { - foodHealValue = value; + foodHealValue = theoreticalBoost; } if (c.getStat().getName().equals(Skill.PRAYER.getName())) { - prayerHealValue = value; + prayerHealValue = theoreticalBoost; } if (foodHealValue != 0 && prayerHealValue != 0) From e4d85cdc46a0946ea80d8b3995af6b5ede8233f8 Mon Sep 17 00:00:00 2001 From: WillThomas Date: Fri, 8 Feb 2019 07:19:00 +0000 Subject: [PATCH 021/304] Reorder skill calc json values based on prayer XP (#7751) Ourg bones are wrongly positioned in the list of bones, fix this. Signed-off-by: Will Thomas --- .../client/plugins/skillcalculator/skill_prayer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json index f09040662d..292fab6b8f 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json @@ -248,12 +248,6 @@ "name": "Wyrm Bones", "xp": 50 }, - { - "level": 1, - "icon": 4834, - "name": "Ourg Bones", - "xp": 140 - }, { "level": 1, "icon": 3400, @@ -323,6 +317,12 @@ "name": "Dagannoth Bones", "xp": 125 }, + { + "level": 1, + "icon": 4834, + "name": "Ourg Bones", + "xp": 140 + }, { "level": 70, "icon": 22124, From 13c2e2eb41e46f68ec4892a8a385a9788aae3fb6 Mon Sep 17 00:00:00 2001 From: Henry Zhang Date: Thu, 7 Feb 2019 23:27:24 -0800 Subject: [PATCH 022/304] Make sure WorldHopperPlugin's executor is active on startup We can't submit tasks to shutdown Executors. These need to be recreated on startup --- .../client/plugins/worldhopper/WorldHopperPlugin.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java index 07f4d727a5..b545939202 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java @@ -131,7 +131,7 @@ public class WorldHopperPlugin extends Plugin @Inject private WorldHopperConfig config; - private final ScheduledExecutorService hopperExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor()); + private ScheduledExecutorService hopperExecutorService; private NavigationButton navButton; private WorldSwitcherPanel panel; @@ -201,6 +201,8 @@ public class WorldHopperPlugin extends Plugin } worldResultFuture = executorService.scheduleAtFixedRate(this::tick, 0, WORLD_FETCH_TIMER, TimeUnit.MINUTES); + + hopperExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor()); pingFuture = hopperExecutorService.scheduleAtFixedRate(this::pingWorlds, WORLD_PING_TIMER, WORLD_PING_TIMER, TimeUnit.MINUTES); } @@ -221,6 +223,7 @@ public class WorldHopperPlugin extends Plugin clientToolbar.removeNavigation(navButton); hopperExecutorService.shutdown(); + hopperExecutorService = null; } @Subscribe From ba47ec1d1caf0ee21e80fafea2fa8fbcc86c343d Mon Sep 17 00:00:00 2001 From: Kalle Date: Fri, 8 Feb 2019 18:09:57 +0200 Subject: [PATCH 023/304] Fix anagram clue "A Basic Anti Pot" (answer changed to 6) (#7764) Fixes #7752 --- .../client/plugins/cluescrolls/clues/AnagramClue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java index 4c4d0adcd2..61b83c4c11 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java @@ -49,7 +49,7 @@ public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueSc { private static final Set CLUES = ImmutableSet.of( new AnagramClue("A BAKER", "Baraek", new WorldPoint(3217, 3434, 0), "Varrock square", "5"), - new AnagramClue("A BASIC ANTI POT", "Captain Tobias", new WorldPoint(3026, 3216, 0), "Port Sarim", "7"), + new AnagramClue("A BASIC ANTI POT", "Captain Tobias", new WorldPoint(3026, 3216, 0), "Port Sarim", "6"), new AnagramClue("A HEART", "Aretha", new WorldPoint(1814, 3851, 0), "Soul altar", "2"), new AnagramClue("A ZEN SHE", "Zenesha", new WorldPoint(2652, 3295, 0), "Platebody Southern Ardougne centre square"), new AnagramClue("ACE MATCH ELM", "Cam The Camel", new WorldPoint(3300, 3231, 0), "North of the glider in Al Kharid"), @@ -257,4 +257,4 @@ public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueSc { return new int[] {objectId}; } -} \ No newline at end of file +} From b4de9b6cc4b6bbdf674afb68cb1fcbe38a0b4aa3 Mon Sep 17 00:00:00 2001 From: Nokkasiili <46995454+Nokkasiili@users.noreply.github.com> Date: Sat, 9 Feb 2019 00:22:57 +0200 Subject: [PATCH 024/304] Fix isVisable and isMinimapVisable spelling (Visable -> Visible) (#7766) --- .../src/main/java/net/runelite/api/NPCComposition.java | 4 ++-- .../net/runelite/client/plugins/barrows/BarrowsOverlay.java | 2 +- .../src/main/java/net/runelite/rs/api/RSNPCComposition.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NPCComposition.java b/runelite-api/src/main/java/net/runelite/api/NPCComposition.java index 2a3a26343d..0386ba954f 100644 --- a/runelite-api/src/main/java/net/runelite/api/NPCComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/NPCComposition.java @@ -63,14 +63,14 @@ public interface NPCComposition * * @return the mini-map visible state */ - boolean isMinimapVisable(); + boolean isMinimapVisible(); /** * Gets whether the NPC is visible. * * @return the visible state */ - boolean isVisable(); + boolean isVisible(); /** * Gets the ID of the NPC. diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java index e665badb17..1c480719ec 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java @@ -77,7 +77,7 @@ class BarrowsOverlay extends Overlay { final NPCComposition composition = npc.getComposition(); - if (composition != null && !composition.isMinimapVisable()) + if (composition != null && !composition.isMinimapVisible()) { continue; } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSNPCComposition.java b/runescape-api/src/main/java/net/runelite/rs/api/RSNPCComposition.java index 0ed50491f6..87c781cea8 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSNPCComposition.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSNPCComposition.java @@ -47,11 +47,11 @@ public interface RSNPCComposition extends NPCComposition @Import("isMinimapVisible") @Override - boolean isMinimapVisable(); + boolean isMinimapVisible(); @Import("isVisible") @Override - boolean isVisable(); + boolean isVisible(); @Import("id") @Override From a211e39cfd203daf40f56a0558afe752f8bf3093 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 8 Feb 2019 18:27:15 -0500 Subject: [PATCH 025/304] plugin manager test: check plugins don't error when registering with eventbus --- .../java/net/runelite/client/plugins/PluginManagerTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java index 0981299754..8f63169574 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java @@ -47,6 +47,7 @@ import java.util.Set; import net.runelite.api.Client; import net.runelite.client.RuneLite; import net.runelite.client.RuneLiteModule; +import net.runelite.client.eventbus.EventBus; import net.runelite.client.rs.ClientUpdateCheckMode; import static org.junit.Assert.assertEquals; import org.junit.Before; @@ -117,6 +118,10 @@ public class PluginManagerTest pluginManager.loadCorePlugins(); plugins = pluginManager.getPlugins(); + // Check that the plugins register with the eventbus without errors + EventBus eventBus = new EventBus(); + plugins.forEach(eventBus::register); + expected = pluginClasses.stream() .map(cl -> (PluginDescriptor) cl.getAnnotation(PluginDescriptor.class)) .filter(Objects::nonNull) From 06cc5d2ff90ac7788c2f9cf84673f69ec28d1f85 Mon Sep 17 00:00:00 2001 From: bjornenalfa Date: Fri, 8 Feb 2019 16:57:17 +0100 Subject: [PATCH 026/304] Add Rada's Blessings to Prayer plugin --- .../java/net/runelite/client/plugins/prayer/PrayerItems.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerItems.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerItems.java index df12b4f247..dbc5fb031b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerItems.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerItems.java @@ -41,6 +41,9 @@ enum PrayerItems ANCIENT_BLESSING(ItemID.ANCIENT_BLESSING, 1), HONOURABLE_BLESSING(ItemID.HONOURABLE_BLESSING, 1), WAR_BLESSING(ItemID.WAR_BLESSING, 1), + RADAS_BLESSING_2(ItemID.RADAS_BLESSING_2, 1), + RADAS_BLESSING_3(ItemID.RADAS_BLESSING_3, 1), + RADAS_BLESSING_4(ItemID.RADAS_BLESSING_4, 2), // Rings EXPLORERS_RING(ItemID.EXPLORERS_RING, 1), From 52c0bb92d8e9f588f572418b20e2436e3406cd51 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 6 Feb 2019 00:55:14 +0100 Subject: [PATCH 027/304] Push sidebar non-tab buttons to bottom Push sidebar non-tab buttons with custom chrome disabled to bottom. Signed-off-by: Tomas Slusny --- .../main/java/net/runelite/client/ui/ClientPluginToolbar.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientPluginToolbar.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientPluginToolbar.java index 13d05def08..e7a280b998 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ClientPluginToolbar.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientPluginToolbar.java @@ -30,6 +30,7 @@ import java.awt.Component; import java.awt.Dimension; import java.util.Map; import java.util.TreeMap; +import javax.swing.Box; import javax.swing.JToolBar; /** @@ -57,7 +58,6 @@ public class ClientPluginToolbar extends JToolBar setMinimumSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT)); setPreferredSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT)); setMaximumSize(new Dimension(TOOLBAR_WIDTH, Integer.MAX_VALUE)); - addSeparator(); } void addComponent(final NavigationButton button, final Component c) @@ -86,6 +86,7 @@ public class ClientPluginToolbar extends JToolBar if (!entry.getKey().isTab() && !isDelimited) { isDelimited = true; + add(Box.createVerticalGlue()); addSeparator(); } From 860aa89a4d12a0f73843796b6bf623759dae70fa Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 9 Feb 2019 11:41:30 -0500 Subject: [PATCH 028/304] http api: rename OSB ge classes with OSB prefix --- ...andExchangeClient.java => OSBGrandExchangeClient.java} | 6 +++--- ...andExchangeResult.java => OSBGrandExchangeResult.java} | 2 +- ...ngeController.java => OSBGrandExchangeController.java} | 6 +++--- ...dExchangeService.java => OSBGrandExchangeService.java} | 4 ++-- .../client/plugins/grandexchange/GrandExchangePlugin.java | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) rename http-api/src/main/java/net/runelite/http/api/osbuddy/{GrandExchangeClient.java => OSBGrandExchangeClient.java} (92%) rename http-api/src/main/java/net/runelite/http/api/osbuddy/{GrandExchangeResult.java => OSBGrandExchangeResult.java} (97%) rename http-service/src/main/java/net/runelite/http/service/osbuddy/{GrandExchangeController.java => OSBGrandExchangeController.java} (92%) rename http-service/src/main/java/net/runelite/http/service/osbuddy/{GrandExchangeService.java => OSBGrandExchangeService.java} (97%) diff --git a/http-api/src/main/java/net/runelite/http/api/osbuddy/GrandExchangeClient.java b/http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeClient.java similarity index 92% rename from http-api/src/main/java/net/runelite/http/api/osbuddy/GrandExchangeClient.java rename to http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeClient.java index d80a739d29..ffdfad2035 100644 --- a/http-api/src/main/java/net/runelite/http/api/osbuddy/GrandExchangeClient.java +++ b/http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeClient.java @@ -35,9 +35,9 @@ import okhttp3.Request; import okhttp3.Response; @Slf4j -public class GrandExchangeClient +public class OSBGrandExchangeClient { - public GrandExchangeResult lookupItem(int itemId) throws IOException + public OSBGrandExchangeResult lookupItem(int itemId) throws IOException { final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() .addPathSegment("osb") @@ -59,7 +59,7 @@ public class GrandExchangeClient } final InputStream in = response.body().byteStream(); - return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), GrandExchangeResult.class); + return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), OSBGrandExchangeResult.class); } catch (JsonParseException ex) { diff --git a/http-api/src/main/java/net/runelite/http/api/osbuddy/GrandExchangeResult.java b/http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeResult.java similarity index 97% rename from http-api/src/main/java/net/runelite/http/api/osbuddy/GrandExchangeResult.java rename to http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeResult.java index 993ee0d567..13e5f5e8e4 100644 --- a/http-api/src/main/java/net/runelite/http/api/osbuddy/GrandExchangeResult.java +++ b/http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeResult.java @@ -28,7 +28,7 @@ import java.time.Instant; import lombok.Data; @Data -public class GrandExchangeResult +public class OSBGrandExchangeResult { private int item_id; private int buy_average; diff --git a/http-service/src/main/java/net/runelite/http/service/osbuddy/GrandExchangeController.java b/http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeController.java similarity index 92% rename from http-service/src/main/java/net/runelite/http/service/osbuddy/GrandExchangeController.java rename to http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeController.java index 92ba9093e7..847c415772 100644 --- a/http-service/src/main/java/net/runelite/http/service/osbuddy/GrandExchangeController.java +++ b/http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeController.java @@ -35,12 +35,12 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/osb/ge") -public class GrandExchangeController +public class OSBGrandExchangeController { - private final GrandExchangeService grandExchangeService; + private final OSBGrandExchangeService grandExchangeService; @Autowired - public GrandExchangeController(GrandExchangeService grandExchangeService) + public OSBGrandExchangeController(OSBGrandExchangeService grandExchangeService) { this.grandExchangeService = grandExchangeService; } diff --git a/http-service/src/main/java/net/runelite/http/service/osbuddy/GrandExchangeService.java b/http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeService.java similarity index 97% rename from http-service/src/main/java/net/runelite/http/service/osbuddy/GrandExchangeService.java rename to http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeService.java index f7addee899..797d7e76e2 100644 --- a/http-service/src/main/java/net/runelite/http/service/osbuddy/GrandExchangeService.java +++ b/http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeService.java @@ -40,7 +40,7 @@ import org.sql2o.Sql2o; @Service @Slf4j -public class GrandExchangeService +public class OSBGrandExchangeService { private static final String CREATE_GRAND_EXCHANGE_PRICES = "CREATE TABLE IF NOT EXISTS `osb_ge` (\n" + " `item_id` int(11) NOT NULL,\n" @@ -56,7 +56,7 @@ public class GrandExchangeService private final Sql2o sql2o; @Autowired - public GrandExchangeService(@Qualifier("Runelite SQL2O") Sql2o sql2o) + public OSBGrandExchangeService(@Qualifier("Runelite SQL2O") Sql2o sql2o) { this.sql2o = sql2o; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index cd4f3f050e..c26e39ebb5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -73,8 +73,8 @@ import net.runelite.client.ui.NavigationButton; import net.runelite.client.util.ImageUtil; import net.runelite.client.util.StackFormatter; import net.runelite.client.util.Text; -import net.runelite.http.api.osbuddy.GrandExchangeClient; -import net.runelite.http.api.osbuddy.GrandExchangeResult; +import net.runelite.http.api.osbuddy.OSBGrandExchangeClient; +import net.runelite.http.api.osbuddy.OSBGrandExchangeResult; @PluginDescriptor( name = "Grand Exchange", @@ -86,7 +86,7 @@ public class GrandExchangePlugin extends Plugin { private static final int OFFER_CONTAINER_ITEM = 21; private static final int OFFER_DEFAULT_ITEM_ID = 6512; - private static final GrandExchangeClient CLIENT = new GrandExchangeClient(); + private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient(); private static final String OSB_GE_TEXT = "
OSBuddy Actively traded price: "; private static final String BUY_LIMIT_GE_TEXT = "
Buy limit: "; @@ -346,7 +346,7 @@ public class GrandExchangePlugin extends Plugin try { - final GrandExchangeResult result = CLIENT.lookupItem(itemId); + final OSBGrandExchangeResult result = CLIENT.lookupItem(itemId); final String text = geText.getText() + OSB_GE_TEXT + StackFormatter.formatNumber(result.getOverall_average()); geText.setText(text); } From 1994de7270a05ea276643661c780b84d630a1c2a Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 3 Feb 2019 16:56:19 -0500 Subject: [PATCH 029/304] client: add poison plugin to track poison damage Co-authored-by: Hydrox6 --- .../main/java/net/runelite/api/VarPlayer.java | 8 + .../client/plugins/poison/PoisonConfig.java | 45 ++++ .../client/plugins/poison/PoisonInfobox.java | 54 ++++ .../client/plugins/poison/PoisonOverlay.java | 88 ++++++ .../client/plugins/poison/PoisonPlugin.java | 253 ++++++++++++++++++ 5 files changed, 448 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonInfobox.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java diff --git a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java index c358d95da8..37b71aaf66 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java +++ b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java @@ -49,6 +49,14 @@ public enum VarPlayer NMZ_REWARD_POINTS(1060), + /** + * -1 : Poison immune + * Normal poison damage is ceil( this / 5.0f ) + * If this is greater than or equal to 1000000, the player is envenomed. + * Venom damage is (this - 999997) * 2 + */ + POISON(102), + /** * 0 : not started * greater than 0 : in progress diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java new file mode 100644 index 0000000000..2595009205 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2018 Hydrox6 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.poison; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup(PoisonConfig.GROUP) +public interface PoisonConfig extends Config +{ + String GROUP = "poison"; + + @ConfigItem( + keyName = "showInfoboxes", + name = "Show Infoboxes", + description = "Configures whether to show the infoboxes" + ) + default boolean showInfoboxes() + { + return false; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonInfobox.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonInfobox.java new file mode 100644 index 0000000000..44d7746781 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonInfobox.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018 Hydrox6 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.poison; + +import java.awt.Color; +import java.time.temporal.ChronoUnit; +import java.awt.image.BufferedImage; +import net.runelite.client.ui.overlay.infobox.Timer; + +class PoisonInfobox extends Timer +{ + private final PoisonPlugin plugin; + + PoisonInfobox(BufferedImage image, PoisonPlugin plugin) + { + super(PoisonPlugin.POISON_TICK_MILLIS, ChronoUnit.MILLIS, image, plugin); + this.plugin = plugin; + } + + @Override + public String getTooltip() + { + return plugin.createTooltip(); + } + + @Override + public Color getTextColor() + { + return Color.RED.brighter(); + } +} + diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonOverlay.java new file mode 100644 index 0000000000..758811f292 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonOverlay.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2018 Hydrox6 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.poison; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.Point; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayLayer; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.tooltip.Tooltip; +import net.runelite.client.ui.overlay.tooltip.TooltipManager; + +class PoisonOverlay extends Overlay +{ + private final PoisonPlugin plugin; + private final Client client; + private final TooltipManager tooltipManager; + + @Inject + private PoisonOverlay(final PoisonPlugin plugin, final Client client, final TooltipManager tooltipManager) + { + this.plugin = plugin; + this.client = client; + this.tooltipManager = tooltipManager; + setPosition(OverlayPosition.DYNAMIC); + setLayer(OverlayLayer.ABOVE_WIDGETS); + } + + @Override + public Dimension render(Graphics2D graphics) + { + if (plugin.getLastDamage() <= 0) + { + return null; + } + + final Widget healthOrb = client.getWidget(WidgetInfo.MINIMAP_HEALTH_ORB); + + if (healthOrb == null || healthOrb.isHidden()) + { + return null; + } + + final Rectangle bounds = healthOrb.getBounds(); + + if (bounds.getX() <= 0) + { + return null; + } + + final Point mousePosition = client.getMouseCanvasPosition(); + + if (bounds.contains(mousePosition.getX(), mousePosition.getY())) + { + tooltipManager.add(new Tooltip(plugin.createTooltip())); + } + + return null; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java new file mode 100644 index 0000000000..68b9889a2a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2018 Hydrox6 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.poison; + +import com.google.inject.Provides; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.text.MessageFormat; +import java.time.Duration; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import javax.inject.Inject; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; +import net.runelite.api.SpriteID; +import net.runelite.api.VarPlayer; +import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.VarbitChanged; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.SpriteManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.FontManager; +import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.ui.overlay.infobox.InfoBoxManager; +import net.runelite.client.util.ColorUtil; + +@PluginDescriptor( + name = "Poison", + description = "Tracks current damage values for Poison and Venom", + tags = {"combat", "poison", "venom"} +) +@Slf4j +public class PoisonPlugin extends Plugin +{ + static final int POISON_TICK_MILLIS = 18200; + private static final int VENOM_THRESHOLD = 1000000; + private static final int VENOM_MAXIUMUM_DAMAGE = 20; + + @Inject + private Client client; + + @Inject + private PoisonOverlay poisonOverlay; + + @Inject + private OverlayManager overlayManager; + + @Inject + private InfoBoxManager infoBoxManager; + + @Inject + private SpriteManager spriteManager; + + @Inject + private PoisonConfig config; + + @Getter + private int lastDamage; + private boolean envenomed; + private PoisonInfobox infobox; + private Instant poisonNaturalCure; + private Instant nextPoisonTick; + private int lastValue = -1; + + @Provides + PoisonConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(PoisonConfig.class); + } + + @Override + protected void startUp() throws Exception + { + overlayManager.add(poisonOverlay); + } + + @Override + protected void shutDown() throws Exception + { + overlayManager.remove(poisonOverlay); + + if (infobox != null) + { + infoBoxManager.removeInfoBox(infobox); + infobox = null; + } + + envenomed = false; + lastDamage = 0; + poisonNaturalCure = null; + nextPoisonTick = null; + lastValue = -1; + + } + + @Subscribe + public void onVarbitChanged(VarbitChanged event) + { + final int poisonValue = client.getVar(VarPlayer.POISON); + if (poisonValue == lastValue) + { + return; + } + + lastValue = poisonValue; + nextPoisonTick = Instant.now().plus(Duration.of(POISON_TICK_MILLIS, ChronoUnit.MILLIS)); + + final int damage = nextDamage(poisonValue); + this.lastDamage = damage; + + envenomed = poisonValue >= VENOM_THRESHOLD; + + if (poisonValue < VENOM_THRESHOLD) + { + poisonNaturalCure = Instant.now().plus(Duration.of(POISON_TICK_MILLIS * poisonValue, ChronoUnit.MILLIS)); + } + else + { + poisonNaturalCure = null; + } + + if (config.showInfoboxes()) + { + if (infobox != null) + { + infoBoxManager.removeInfoBox(infobox); + infobox = null; + } + + if (damage > 0) + { + final BufferedImage image = getSplat(envenomed ? SpriteID.HITSPLAT_DARK_GREEN_VENOM : SpriteID.HITSPLAT_GREEN_POISON, damage); + + if (image != null) + { + infobox = new PoisonInfobox(image, this); + infoBoxManager.addInfoBox(infobox); + } + } + } + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (event.getGroup().equals(PoisonConfig.GROUP) && !config.showInfoboxes() && infobox != null) + { + infoBoxManager.removeInfoBox(infobox); + infobox = null; + } + } + + private static int nextDamage(int poisonValue) + { + int damage; + + if (poisonValue >= VENOM_THRESHOLD) + { + //Venom Damage starts at 6, and increments in twos; + //The VarPlayer increments in values of 1, however. + poisonValue -= VENOM_THRESHOLD - 3; + damage = poisonValue * 2; + //Venom Damage caps at 20, but the VarPlayer keeps increasing + if (damage > VENOM_MAXIUMUM_DAMAGE) + { + damage = VENOM_MAXIUMUM_DAMAGE; + } + } + else + { + damage = (int) Math.ceil(poisonValue / 5.0f); + } + + return damage; + } + + private BufferedImage getSplat(int id, int damage) + { + //Get a copy of the hitsplat to get a clean one each time + final BufferedImage rawSplat = spriteManager.getSprite(id, 0); + if (rawSplat == null) + { + return null; + } + + final BufferedImage splat = new BufferedImage( + rawSplat.getColorModel(), + rawSplat.copyData(null), + rawSplat.getColorModel().isAlphaPremultiplied(), + null); + + final Graphics g = splat.getGraphics(); + g.setFont(FontManager.getRunescapeSmallFont()); + + // Align the text in the centre of the hitsplat + final FontMetrics metrics = g.getFontMetrics(); + final String text = String.valueOf(damage); + final int x = (splat.getWidth() - metrics.stringWidth(text)) / 2; + final int y = (splat.getHeight() - metrics.getHeight()) / 2 + metrics.getAscent(); + + g.setColor(Color.BLACK); + g.drawString(String.valueOf(damage), x + 1, y + 1); + g.setColor(Color.WHITE); + g.drawString(String.valueOf(damage), x, y); + return splat; + } + + private static String getFormattedTime(Instant endTime) + { + final Duration timeLeft = Duration.between(Instant.now(), endTime); + int seconds = (int) (timeLeft.toMillis() / 1000L); + int minutes = seconds / 60; + int secs = seconds % 60; + + return String.format("%d:%02d", minutes, secs); + } + + String createTooltip() + { + String line1 = MessageFormat.format("Next {0} damage: {1}
Time until damage: {2}", + envenomed ? "venom" : "poison", ColorUtil.wrapWithColorTag(String.valueOf(lastDamage), Color.RED), getFormattedTime(nextPoisonTick)); + String line2 = envenomed ? "" : MessageFormat.format("
Time until cure: {0}", getFormattedTime(poisonNaturalCure)); + + return line1 + line2; + } +} \ No newline at end of file From bc932a794285f60d418e9b5042d0e4ac4906b603 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 9 Feb 2019 22:53:09 -0500 Subject: [PATCH 030/304] scene uploader: swap seColor/nwColor which had their mappings swapped --- .../java/net/runelite/client/plugins/gpu/SceneUploader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java index 1c28371c56..445f6c60d1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java @@ -300,7 +300,7 @@ class SceneUploader int vertexCx = localX + Perspective.LOCAL_TILE_SIZE; int vertexCy = localY; int vertexCz = seHeight; - final int c2 = nwColor; + final int c2 = seColor; // 1,1 int vertexAx = localX + Perspective.LOCAL_TILE_SIZE; @@ -312,7 +312,7 @@ class SceneUploader int vertexBx = localX; int vertexBy = localY + Perspective.LOCAL_TILE_SIZE; int vertexBz = nwHeight; - final int c4 = seColor; + final int c4 = nwColor; vertexBuffer.put(vertexAx, vertexAz, vertexAy, c3); vertexBuffer.put(vertexBx, vertexBz, vertexBy, c4); From b99c8d748083ebfbf8eecc7e399ce9a0d29d5aaf Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 10 Feb 2019 14:22:08 +0100 Subject: [PATCH 031/304] Clear Cerberus ghost on LOADING game state When leaving the are with cerberus ghosts player will not receive despawn events for them and so they will be stuck (they are just GCed later instead). This solves the issue and goes in line with rest of logic we have that relies on spawn/despawn events. Signed-off-by: Tomas Slusny --- .../net/runelite/client/plugins/cerberus/CerberusPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java index 2087e31844..322e8c38cd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java @@ -75,7 +75,7 @@ public class CerberusPlugin extends Plugin @Subscribe public void onGameStateChanged(GameStateChanged event) { - if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING) + if (event.getGameState() == GameState.LOADING) { ghosts.clear(); } From fb6012dbfda3fe755a913de01222f627c1c2b380 Mon Sep 17 00:00:00 2001 From: Kalle Date: Sun, 10 Feb 2019 16:30:29 +0200 Subject: [PATCH 032/304] World Map: Fix Ape Atoll tree type --- .../net/runelite/client/plugins/worldmap/RareTreeLocation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java index 69eaedcddc..ca30b23271 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java @@ -38,7 +38,6 @@ enum RareTreeLocation TEAK("Teak tree", 35, // Ape Atoll new WorldPoint(2774, 2697, 0), - new WorldPoint(2716, 2710, 0), // Desert new WorldPoint(3510, 3073, 0), @@ -85,6 +84,7 @@ enum RareTreeLocation new WorldPoint(1237, 3770, 0), // Ape Atoll + new WorldPoint(2716, 2710, 0), new WorldPoint(2725, 2735, 0), // Mos Le'Harmless From 55395b67084747457cd3b7057da9bc937afa2802 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 10 Feb 2019 11:26:47 -0500 Subject: [PATCH 033/304] loottracker service: correct kills foreign key --- .../runelite/http/service/loottracker/LootTrackerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java index 386a1d04b0..d39e159228 100644 --- a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java +++ b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java @@ -49,7 +49,7 @@ public class LootTrackerService + " `type` enum('NPC', 'PLAYER', 'EVENT', 'UNKNOWN') NOT NULL,\n" + " `eventId` VARCHAR(255) NOT NULL,\n" + " PRIMARY KEY (id),\n" - + " FOREIGN KEY (accountId) REFERENCES sessions(user) ON DELETE CASCADE,\n" + + " FOREIGN KEY (accountId) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE,\n" + " INDEX idx_acc (accountId, time)," + " INDEX idx_time (time)" + ") ENGINE=InnoDB"; From 31e1e2563b7b7cca4b66d5d9f20d8bc00a2854b9 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 10 Feb 2019 12:35:18 -0500 Subject: [PATCH 034/304] api: add method to find instanced tiles in the scene Use in groundmarkers plugin --- .../net/runelite/api/coords/WorldPoint.java | 47 ++++++++- .../groundmarkers/GroundMarkerPlugin.java | 96 ++++--------------- 2 files changed, 62 insertions(+), 81 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index 3f164c1845..a0a23e6674 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -25,6 +25,10 @@ */ package net.runelite.api.coords; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; import lombok.Value; import net.runelite.api.Client; import static net.runelite.api.Constants.CHUNK_SIZE; @@ -150,7 +154,8 @@ public class WorldPoint } /** - * Gets the coordinate of the tile that contains the passed local point. + * Gets the coordinate of the tile that contains the passed local point, + * accounting for instances. * * @param client the client * @param localPoint the local coordinate @@ -190,6 +195,46 @@ public class WorldPoint } } + /** + * Get occurrences of a tile on the scene, accounting for instances. There may be + * more than one if the same template chunk occurs more than once on the scene. + * @param client + * @param worldPoint + * @return + */ + public static Collection toLocalInstance(Client client, WorldPoint worldPoint) + { + if (!client.isInInstancedRegion()) + { + return Collections.singleton(worldPoint); + } + + // find instance chunks using the template point. there might be more than one. + List worldPoints = new ArrayList<>(); + final int z = client.getPlane(); + int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks(); + for (int x = 0; x < instanceTemplateChunks[z].length; ++x) + { + for (int y = 0; y < instanceTemplateChunks[z][x].length; ++y) + { + int chunkData = instanceTemplateChunks[z][x][y]; + int rotation = chunkData >> 1 & 0x3; + int templateChunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE; + int templateChunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE; + if (worldPoint.getX() >= templateChunkX && worldPoint.getX() < templateChunkX + CHUNK_SIZE + && worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE) + { + WorldPoint p = new WorldPoint(client.getBaseX() + x * CHUNK_SIZE + (worldPoint.getX() & (CHUNK_SIZE - 1)), + client.getBaseY() + y * CHUNK_SIZE + (worldPoint.getY() & (CHUNK_SIZE - 1)), + worldPoint.getPlane()); + p = rotate(p, rotation); + worldPoints.add(p); + } + } + } + return worldPoints; + } + /** * Rotate the coordinates in the chunk according to chunk rotation * diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 12ceda382a..2cb7ebf1c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -34,13 +34,13 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import javax.inject.Inject; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; -import static net.runelite.api.Constants.CHUNK_SIZE; import net.runelite.api.GameState; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; @@ -155,87 +155,23 @@ public class GroundMarkerPlugin extends Plugin return Collections.EMPTY_LIST; } - List worldPoints = new ArrayList<>(); - for (GroundMarkerPoint point : points) - { - int regionId = point.getRegionId(); - int regionX = point.getRegionX(); - int regionY = point.getRegionY(); - int z = point.getZ(); - - // world point of the tile marker - WorldPoint worldPoint = new WorldPoint( - ((regionId >>> 8) << 6) + regionX, - ((regionId & 0xff) << 6) + regionY, - z - ); - - if (!client.isInInstancedRegion()) + return points.stream() + .map(point -> { - worldPoints.add(worldPoint); - continue; - } + int regionId = point.getRegionId(); + int regionX = point.getRegionX(); + int regionY = point.getRegionY(); + int z = point.getZ(); - // find instance chunks using the template point. there might be more than one. - int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks(); - for (int x = 0; x < instanceTemplateChunks[z].length; ++x) - { - for (int y = 0; y < instanceTemplateChunks[z][x].length; ++y) - { - int chunkData = instanceTemplateChunks[z][x][y]; - int rotation = chunkData >> 1 & 0x3; - int templateChunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE; - int templateChunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE; - if (worldPoint.getX() >= templateChunkX && worldPoint.getX() < templateChunkX + CHUNK_SIZE - && worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE) - { - WorldPoint p = new WorldPoint(client.getBaseX() + x * CHUNK_SIZE + (worldPoint.getX() & (CHUNK_SIZE - 1)), - client.getBaseY() + y * CHUNK_SIZE + (worldPoint.getY() & (CHUNK_SIZE - 1)), - worldPoint.getPlane()); - p = rotate(p, rotation); - worldPoints.add(p); - } - } - } - } - return worldPoints; - } - - /** - * Rotate the chunk containing the given point to rotation 0 - * - * @param point point - * @param rotation rotation - * @return world point - */ - private static WorldPoint rotateInverse(WorldPoint point, int rotation) - { - return rotate(point, 4 - rotation); - } - - /** - * Rotate the coordinates in the chunk according to chunk rotation - * - * @param point point - * @param rotation rotation - * @return world point - */ - private static WorldPoint rotate(WorldPoint point, int rotation) - { - int chunkX = point.getX() & ~(CHUNK_SIZE - 1); - int chunkY = point.getY() & ~(CHUNK_SIZE - 1); - int x = point.getX() & (CHUNK_SIZE - 1); - int y = point.getY() & (CHUNK_SIZE - 1); - switch (rotation) - { - case 1: - return new WorldPoint(chunkX + y, chunkY + (CHUNK_SIZE - 1 - x), point.getPlane()); - case 2: - return new WorldPoint(chunkX + (CHUNK_SIZE - 1 - x), chunkY + (CHUNK_SIZE - 1 - y), point.getPlane()); - case 3: - return new WorldPoint(chunkX + (CHUNK_SIZE - 1 - y), chunkY + x, point.getPlane()); - } - return point; + // world point of the tile marker + return new WorldPoint( + ((regionId >>> 8) << 6) + regionX, + ((regionId & 0xff) << 6) + regionY, + z + ); + }) + .flatMap(wp -> WorldPoint.toLocalInstance(client, wp).stream()) + .collect(Collectors.toList()); } @Subscribe From 79feaad931833cc3ed086ab26a971bb4ef7cf3a7 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 11 Feb 2019 05:41:42 +0100 Subject: [PATCH 035/304] Add kebos swamp cryptic clue --- .../runelite/client/plugins/cluescrolls/clues/CrypticClue.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java index 200a223aa3..b4d5b46391 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java @@ -301,7 +301,8 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc new CrypticClue("Search the open crate found in a small farmhouse in Hosidius. Cabbages grow outside.", CRATE_27533, new WorldPoint(1687, 3628, 0), "The house is east of the Mess in Great Kourend."), new CrypticClue("Dig under Ithoi's cabin.", new WorldPoint(2529, 2838, 0), "Dig under Ithoi's cabin in the Corsair Cove."), new CrypticClue("Search the drawers, upstairs in the bank to the East of Varrock.", new WorldPoint(3250, 3420, 1), "Search the drawers upstairs in Varrock east bank"), - new CrypticClue("Speak to Hazelmere.", "Hazelmere", new WorldPoint(2677, 3088, 1), "Located upstairs in the house to the north of fairy ring CLS. Answer: 6859") + new CrypticClue("Speak to Hazelmere.", "Hazelmere", new WorldPoint(2677, 3088, 1), "Located upstairs in the house to the north of fairy ring CLS. Answer: 6859"), + new CrypticClue("The effects of this fire are magnified.", new WorldPoint(1179, 3626, 0), "Dig by the fire beside Ket'sal K'uk in the westernmost part of the Kebos Swamp. ") ); private String text; From a694ffc3ba56393be5ebdb9da9bd53ee4524a920 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 11 Feb 2019 06:49:03 +0100 Subject: [PATCH 036/304] Add hydra slayer helms to slayer plugin --- .../java/net/runelite/client/plugins/slayer/SlayerOverlay.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java index f0edfc1928..675381b1fb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java @@ -73,6 +73,8 @@ class SlayerOverlay extends Overlay ItemID.RED_SLAYER_HELMET_I, ItemID.TURQUOISE_SLAYER_HELMET, ItemID.TURQUOISE_SLAYER_HELMET_I, + ItemID.HYDRA_SLAYER_HELMET, + ItemID.HYDRA_SLAYER_HELMET_I, ItemID.SLAYER_RING_ETERNAL, ItemID.ENCHANTED_GEM, ItemID.ETERNAL_GEM, From 3a5ac9f725d8ba152fa2f4d501a53f54ab18f3c1 Mon Sep 17 00:00:00 2001 From: Matthew Abel <32851341+Mabel5@users.noreply.github.com> Date: Mon, 11 Feb 2019 04:14:23 -0500 Subject: [PATCH 037/304] Hide auto retaliate from combat options (#7713) Closes #7686 --- .../java/net/runelite/api/widgets/WidgetID.java | 1 + .../java/net/runelite/api/widgets/WidgetInfo.java | 1 + .../plugins/attackstyles/AttackStylesConfig.java | 13 ++++++++++++- .../plugins/attackstyles/AttackStylesPlugin.java | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index bb9d8b6000..9f07f9ba37 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -513,6 +513,7 @@ public class WidgetID static final int SPELL_BOX = 25; static final int SPELL_ICON = 27; static final int SPELL_TEXT = 28; + static final int AUTO_RETALIATE = 29; } static class VolcanicMine diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index ef02681690..556dc57bf5 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -305,6 +305,7 @@ public enum WidgetInfo COMBAT_SPELL_BOX(WidgetID.COMBAT_GROUP_ID, WidgetID.Combat.SPELL_BOX), COMBAT_SPELL_ICON(WidgetID.COMBAT_GROUP_ID, WidgetID.Combat.SPELL_ICON), COMBAT_SPELL_TEXT(WidgetID.COMBAT_GROUP_ID, WidgetID.Combat.SPELL_TEXT), + COMBAT_AUTO_RETALIATE(WidgetID.COMBAT_GROUP_ID, WidgetID.Combat.AUTO_RETALIATE), DIALOG_OPTION(WidgetID.DIALOG_OPTION_GROUP_ID, 0), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java index 111fb9dc85..c3715481d1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java @@ -97,11 +97,22 @@ public interface AttackStylesConfig extends Config return false; } + @ConfigItem( + keyName = "hideAutoRetaliate", + name = "Hide auto retaliate", + description = "Hide auto retaliate from the combat options tab", + position = 7 + ) + default boolean hideAutoRetaliate() + { + return false; + } + @ConfigItem( keyName = "removeWarnedStyles", name = "Remove warned styles", description = "Remove warned styles from the combat options tab", - position = 7 + position = 8 ) default boolean removeWarnedStyles() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java index 4b6de0ea1d..db7a9ed751 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java @@ -126,6 +126,7 @@ public class AttackStylesPlugin extends Plugin overlayManager.remove(overlay); hideWarnedStyles(false); processWidgets(); + hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), false); } public AttackStyle getAttackStyle() @@ -174,6 +175,7 @@ public class AttackStylesPlugin extends Plugin hideWidget(client.getWidget(widgetKey), widgetsToHide.get(equippedWeaponType, widgetKey)); } } + hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), config.hideAutoRetaliate()); } @Subscribe From 3623efe9e5b6d3d7b490983ce1cb1afd5e2cc94b Mon Sep 17 00:00:00 2001 From: Andrew Fulton Date: Mon, 11 Feb 2019 03:18:00 -0600 Subject: [PATCH 038/304] client: flash only during LOGGED_IN game state (#7782) Fixes #7316 --- .../src/main/java/net/runelite/client/Notifier.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/Notifier.java b/runelite-client/src/main/java/net/runelite/client/Notifier.java index 491c397202..b48a2f6e71 100644 --- a/runelite-client/src/main/java/net/runelite/client/Notifier.java +++ b/runelite-client/src/main/java/net/runelite/client/Notifier.java @@ -154,13 +154,13 @@ public class Notifier public void processFlash(final Graphics2D graphics) { - if (flashStart == null) + if (flashStart == null || client.getGameCycle() % 40 >= 20) { return; } - - if (client.getGameCycle() % 40 >= 20) + else if (client.getGameState() != GameState.LOGGED_IN) { + flashStart = null; return; } From be8bdaeb7afe222d063ac063e25c4a8f0e567a20 Mon Sep 17 00:00:00 2001 From: Jakob Ankarhem Date: Mon, 11 Feb 2019 10:31:16 +0100 Subject: [PATCH 039/304] Remove dulling from progress bar positions (#7781) This makes the positions more visible. Closes #7170 --- .../main/java/net/runelite/client/ui/components/ProgressBar.java | 1 - 1 file changed, 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/ProgressBar.java b/runelite-client/src/main/java/net/runelite/client/ui/components/ProgressBar.java index b5d335e9fb..a90d53eb87 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/components/ProgressBar.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/ProgressBar.java @@ -94,7 +94,6 @@ public class ProgressBar extends DimmableJPanel super.paint(g); g.setColor(getForeground()); g.fillRect(0, 0, topWidth, 16); - g.setColor(getForeground().darker()); for (final Double position : positions) { From fbeef873551821589ac6f96b030dc647326bdef4 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Mon, 11 Feb 2019 09:33:10 +0000 Subject: [PATCH 040/304] Delay party instruction message if user is not logged in (#7696) Currently, if the user joins a party whilst on the login screen, they don't get the instructional message on how to leave the party --- .../client/plugins/party/PartyPlugin.java | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java index 03110fe35c..73abcdb172 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java @@ -128,6 +128,7 @@ public class PartyPlugin extends Plugin implements KeyListener private int lastHp, lastPray; private boolean hotkeyDown, doSync; + private boolean sendAlert; @Override public void configure(Binder binder) @@ -161,6 +162,7 @@ public class PartyPlugin extends Plugin implements KeyListener keyManager.unregisterKeyListener(this); hotkeyDown = false; doSync = false; + sendAlert = false; } @Provides @@ -284,6 +286,12 @@ public class PartyPlugin extends Plugin implements KeyListener @Subscribe public void onGameTick(final GameTick event) { + if (sendAlert && client.getGameState() == GameState.LOGGED_IN) + { + sendAlert = false; + sendInstructionMessage(); + } + if (doSync && !party.getMembers().isEmpty()) { // Request sync @@ -381,15 +389,7 @@ public class PartyPlugin extends Plugin implements KeyListener if (localMember != null && partyData.getMemberId().equals(localMember.getMemberId())) { - final String helpMessage = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("To leave party hold SHIFT and right click party stats overlay.") - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.GAME) - .runeLiteFormattedMessage(helpMessage) - .build()); + sendAlert = true; } } @@ -510,4 +510,17 @@ public class PartyPlugin extends Plugin implements KeyListener hotkeyDown = false; } } + + private void sendInstructionMessage() + { + final String helpMessage = new ChatMessageBuilder() + .append(ChatColorType.HIGHLIGHT) + .append("To leave party hold SHIFT and right click party stats overlay.") + .build(); + + chatMessageManager.queue(QueuedMessage.builder() + .type(ChatMessageType.GAME) + .runeLiteFormattedMessage(helpMessage) + .build()); + } } From 0559d0d5b4c0d40dd7ce6b92a93a90e76c7d6809 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 5 Feb 2019 12:46:28 +0000 Subject: [PATCH 041/304] Use CLANCHAT_INFO for party messages This makes more sense for party messages, mainly if we will be sending party-related messages with source in future. Signed-off-by: Tomas Slusny --- .../net/runelite/client/plugins/party/PartyPlugin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java index 73abcdb172..0e910ff338 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java @@ -191,7 +191,7 @@ public class PartyPlugin extends Plugin implements KeyListener .build(); chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.GAME) + .type(ChatMessageType.CLANCHAT_INFO) .runeLiteFormattedMessage(leaveMessage) .build()); } @@ -381,7 +381,7 @@ public class PartyPlugin extends Plugin implements KeyListener .build(); chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.GAME) + .type(ChatMessageType.CLANCHAT_INFO) .runeLiteFormattedMessage(joinMessage) .build()); @@ -430,7 +430,7 @@ public class PartyPlugin extends Plugin implements KeyListener .build(); chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.GAME) + .type(ChatMessageType.CLANCHAT_INFO) .runeLiteFormattedMessage(joinMessage) .build()); } @@ -519,7 +519,7 @@ public class PartyPlugin extends Plugin implements KeyListener .build(); chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.GAME) + .type(ChatMessageType.CLANCHAT_INFO) .runeLiteFormattedMessage(helpMessage) .build()); } From 4d35ea0c20a863769fda40af4ea0b5997da70067 Mon Sep 17 00:00:00 2001 From: Noah Pittinger Date: Mon, 11 Feb 2019 23:51:13 -0500 Subject: [PATCH 042/304] Add EqualsAndHashCode to Lombok data/value that do not extend Object --- .../main/java/net/runelite/http/api/ws/messages/party/Join.java | 2 ++ .../java/net/runelite/http/api/ws/messages/party/UserJoin.java | 2 ++ .../java/net/runelite/http/api/ws/messages/party/UserPart.java | 2 ++ .../java/net/runelite/http/api/ws/messages/party/UserSync.java | 2 ++ .../runelite/protocol/api/handshake/LoginHandshakePacket.java | 2 ++ .../runelite/protocol/api/handshake/UpdateHandshakePacket.java | 2 ++ .../src/main/java/net/runelite/client/events/ChatboxInput.java | 2 ++ .../java/net/runelite/client/events/PrivateMessageInput.java | 2 ++ .../net/runelite/client/plugins/discord/DiscordUserInfo.java | 2 ++ .../runelite/client/plugins/party/messages/LocationUpdate.java | 2 ++ .../net/runelite/client/plugins/party/messages/TilePing.java | 2 ++ 11 files changed, 22 insertions(+) diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Join.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Join.java index 1c4cf2f73a..21aed0f653 100644 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Join.java +++ b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Join.java @@ -25,10 +25,12 @@ package net.runelite.http.api.ws.messages.party; import java.util.UUID; +import lombok.EqualsAndHashCode; import lombok.Value; import net.runelite.http.api.ws.WebsocketMessage; @Value +@EqualsAndHashCode(callSuper = true) public class Join extends WebsocketMessage { private final UUID partyId; diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserJoin.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserJoin.java index 05d27b6790..81abe76827 100644 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserJoin.java +++ b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserJoin.java @@ -25,10 +25,12 @@ package net.runelite.http.api.ws.messages.party; import java.util.UUID; +import lombok.EqualsAndHashCode; import lombok.Value; import net.runelite.http.api.ws.WebsocketMessage; @Value +@EqualsAndHashCode(callSuper = true) public class UserJoin extends WebsocketMessage { private final UUID memberId; diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserPart.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserPart.java index e3efbe4a9c..e80c6002bd 100644 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserPart.java +++ b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserPart.java @@ -25,10 +25,12 @@ package net.runelite.http.api.ws.messages.party; import java.util.UUID; +import lombok.EqualsAndHashCode; import lombok.Value; import net.runelite.http.api.ws.WebsocketMessage; @Value +@EqualsAndHashCode(callSuper = true) public class UserPart extends WebsocketMessage { private final UUID memberId; diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserSync.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserSync.java index eca9844845..c95038c9fa 100644 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserSync.java +++ b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserSync.java @@ -24,9 +24,11 @@ */ package net.runelite.http.api.ws.messages.party; +import lombok.EqualsAndHashCode; import lombok.Value; @Value +@EqualsAndHashCode(callSuper = true) public class UserSync extends PartyMemberMessage { } diff --git a/protocol-api/src/main/java/net/runelite/protocol/api/handshake/LoginHandshakePacket.java b/protocol-api/src/main/java/net/runelite/protocol/api/handshake/LoginHandshakePacket.java index 4a6090504e..16ccb85694 100644 --- a/protocol-api/src/main/java/net/runelite/protocol/api/handshake/LoginHandshakePacket.java +++ b/protocol-api/src/main/java/net/runelite/protocol/api/handshake/LoginHandshakePacket.java @@ -25,8 +25,10 @@ package net.runelite.protocol.api.handshake; import lombok.Data; +import lombok.EqualsAndHashCode; @Data +@EqualsAndHashCode(callSuper = true) public class LoginHandshakePacket extends HandshakePacket { diff --git a/protocol-api/src/main/java/net/runelite/protocol/api/handshake/UpdateHandshakePacket.java b/protocol-api/src/main/java/net/runelite/protocol/api/handshake/UpdateHandshakePacket.java index 9d1b20c8f2..86b39d41e8 100644 --- a/protocol-api/src/main/java/net/runelite/protocol/api/handshake/UpdateHandshakePacket.java +++ b/protocol-api/src/main/java/net/runelite/protocol/api/handshake/UpdateHandshakePacket.java @@ -26,9 +26,11 @@ package net.runelite.protocol.api.handshake; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @Data +@EqualsAndHashCode(callSuper = true) @NoArgsConstructor @AllArgsConstructor public class UpdateHandshakePacket extends HandshakePacket diff --git a/runelite-client/src/main/java/net/runelite/client/events/ChatboxInput.java b/runelite-client/src/main/java/net/runelite/client/events/ChatboxInput.java index 6388c8b433..cad7d38077 100644 --- a/runelite-client/src/main/java/net/runelite/client/events/ChatboxInput.java +++ b/runelite-client/src/main/java/net/runelite/client/events/ChatboxInput.java @@ -25,8 +25,10 @@ package net.runelite.client.events; import lombok.Data; +import lombok.EqualsAndHashCode; @Data +@EqualsAndHashCode(callSuper = true) public abstract class ChatboxInput extends ChatInput { private final String value; diff --git a/runelite-client/src/main/java/net/runelite/client/events/PrivateMessageInput.java b/runelite-client/src/main/java/net/runelite/client/events/PrivateMessageInput.java index fc31fae7f1..80a189f273 100644 --- a/runelite-client/src/main/java/net/runelite/client/events/PrivateMessageInput.java +++ b/runelite-client/src/main/java/net/runelite/client/events/PrivateMessageInput.java @@ -25,8 +25,10 @@ package net.runelite.client.events; import lombok.Data; +import lombok.EqualsAndHashCode; @Data +@EqualsAndHashCode(callSuper = true) public abstract class PrivateMessageInput extends ChatInput { private final String target; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordUserInfo.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordUserInfo.java index b358a7d01e..360d58652e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordUserInfo.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordUserInfo.java @@ -24,10 +24,12 @@ */ package net.runelite.client.plugins.discord; +import lombok.EqualsAndHashCode; import lombok.Value; import net.runelite.http.api.ws.messages.party.PartyMemberMessage; @Value +@EqualsAndHashCode(callSuper = true) class DiscordUserInfo extends PartyMemberMessage { private final String userId; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java index 0ff6569379..f5bf7131ce 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java @@ -24,11 +24,13 @@ */ package net.runelite.client.plugins.party.messages; +import lombok.EqualsAndHashCode; import lombok.Value; import net.runelite.api.coords.WorldPoint; import net.runelite.http.api.ws.messages.party.PartyMemberMessage; @Value +@EqualsAndHashCode(callSuper = true) public class LocationUpdate extends PartyMemberMessage { private final WorldPoint worldPoint; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/TilePing.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/TilePing.java index 1378403333..fb4f812a81 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/TilePing.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/TilePing.java @@ -24,11 +24,13 @@ */ package net.runelite.client.plugins.party.messages; +import lombok.EqualsAndHashCode; import lombok.Value; import net.runelite.api.coords.WorldPoint; import net.runelite.http.api.ws.messages.party.PartyMemberMessage; @Value +@EqualsAndHashCode(callSuper = true) public class TilePing extends PartyMemberMessage { private final WorldPoint point; From 6941b697324bacf9aecacbaac617242da9db3f85 Mon Sep 17 00:00:00 2001 From: Ryan Bohannon Date: Mon, 11 Feb 2019 23:55:14 -0700 Subject: [PATCH 043/304] Add agility shortcut entry for Taverly Dungeon upper level --- .../client/plugins/worldmap/AgilityShortcutLocation.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutLocation.java index dd2e3771b6..c0b95cfa32 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutLocation.java @@ -118,6 +118,7 @@ enum AgilityShortcutLocation SHILO_VILLAGE_STEPPING_STONES("Stepping Stones", 77, new WorldPoint(2863, 2974, 0)), KHARAZI_JUNGLE_VINE_CLIMB("Vine", 79, new WorldPoint(2897, 2939, 0)), TAVERLEY_DUNGEON_SPIKED_BLADES("Strange Floor", 80, new WorldPoint(2877, 9813, 0)), + TAVERLEY_DUNGEON_ROCKS("Rocks", 70, new WorldPoint(2887, 9823, 0)), SLAYER_DUNGEON_CHASM_JUMP("Spiked Blades", 81, new WorldPoint(2770, 10003, 0)), LAVA_MAZE_NORTH_JUMP("Stepping Stone", 82, new WorldPoint(3092, 3880, 0)), BRIMHAVEN_DUNGEON_EAST_STEPPING_NORTH("Stepping Stones", 83, new WorldPoint(2685, 9547, 0)), From a690e1aadfbd22717e562e0dde7fe55387d2dc8a Mon Sep 17 00:00:00 2001 From: rejectedpromise <28940139+rejectedpromise@users.noreply.github.com> Date: Tue, 12 Feb 2019 00:27:51 -0700 Subject: [PATCH 044/304] Add new lines at .rs2asm to resolve build warnings (#7812) --- runelite-client/src/main/scripts/BankSearchFilter.rs2asm | 2 +- runelite-client/src/main/scripts/SendPrivateMessage.rs2asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm index 60b9f12aa6..80a0db4021 100644 --- a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm +++ b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm @@ -67,4 +67,4 @@ LABEL34: load_int 1 return load_int -1 - return \ No newline at end of file + return diff --git a/runelite-client/src/main/scripts/SendPrivateMessage.rs2asm b/runelite-client/src/main/scripts/SendPrivateMessage.rs2asm index f2102c1328..3e1e3a8d47 100644 --- a/runelite-client/src/main/scripts/SendPrivateMessage.rs2asm +++ b/runelite-client/src/main/scripts/SendPrivateMessage.rs2asm @@ -31,4 +31,4 @@ sload 0 sload 1 privmsg - return \ No newline at end of file + return From 5b03cf3a688f6b94d0ca58e50363777b5ce25e0b Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 12 Feb 2019 08:54:58 +0100 Subject: [PATCH 045/304] Fix unmapped target property "time" warning Signed-off-by: Tomas Slusny --- .../src/main/java/net/runelite/http/service/xp/XpMapper.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http-service/src/main/java/net/runelite/http/service/xp/XpMapper.java b/http-service/src/main/java/net/runelite/http/service/xp/XpMapper.java index ad72f43c47..068c6e5438 100644 --- a/http-service/src/main/java/net/runelite/http/service/xp/XpMapper.java +++ b/http-service/src/main/java/net/runelite/http/service/xp/XpMapper.java @@ -38,6 +38,8 @@ public interface XpMapper XpData xpEntityToXpData(XpEntity xpEntity); + @Mapping(target = "time", ignore = true) + @Mapping(source = "attack.experience", target = "attack_xp") @Mapping(source = "defence.experience", target = "defence_xp") @Mapping(source = "strength.experience", target = "strength_xp") From 1715a369c0ceea64a5b53650ebc5437066e1291e Mon Sep 17 00:00:00 2001 From: Max Weber Date: Tue, 12 Feb 2019 04:03:10 -0700 Subject: [PATCH 046/304] mixins: Fix DecorativeObject ConvexHulls --- .../net/runelite/api/DecorativeObject.java | 1 + .../mixins/RSDecorativeObjectMixin.java | 39 ++++++++++++++++++- .../runelite/rs/api/RSDecorativeObject.java | 6 +++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/DecorativeObject.java b/runelite-api/src/main/java/net/runelite/api/DecorativeObject.java index c2bbd14cf3..145531fa5d 100644 --- a/runelite-api/src/main/java/net/runelite/api/DecorativeObject.java +++ b/runelite-api/src/main/java/net/runelite/api/DecorativeObject.java @@ -38,6 +38,7 @@ public interface DecorativeObject extends TileObject * @see net.runelite.api.model.Jarvis */ Polygon getConvexHull(); + Polygon getConvexHull2(); Renderable getRenderable(); Renderable getRenderable2(); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSDecorativeObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSDecorativeObjectMixin.java index f278609c9b..7ae4685ef3 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSDecorativeObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSDecorativeObjectMixin.java @@ -82,6 +82,29 @@ public abstract class RSDecorativeObjectMixin implements RSDecorativeObject return model; } + @Inject + private RSModel getModel2() + { + RSRenderable renderable = getRenderable2(); + if (renderable == null) + { + return null; + } + + RSModel model; + + if (renderable instanceof Model) + { + model = (RSModel) renderable; + } + else + { + model = renderable.getModel(); + } + + return model; + } + @Inject @Override public Area getClickbox() @@ -100,6 +123,20 @@ public abstract class RSDecorativeObjectMixin implements RSDecorativeObject return null; } - return model.getConvexHull(getX(), getY(), getOrientation()); + return model.getConvexHull(getX() + getXOffset(), getY() + getYOffset(), 0); + } + + @Inject + @Override + public Polygon getConvexHull2() + { + RSModel model = getModel2(); + + if (model == null) + { + return null; + } + + return model.getConvexHull(getX(), getY(), 0); } } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSDecorativeObject.java b/runescape-api/src/main/java/net/runelite/rs/api/RSDecorativeObject.java index 1a53a49cb9..910c5acc1b 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSDecorativeObject.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSDecorativeObject.java @@ -39,6 +39,12 @@ public interface RSDecorativeObject extends DecorativeObject @Import("y") int getY(); + @Import("offsetX") + int getXOffset(); + + @Import("offsetY") + int getYOffset(); + @Import("rotation") int getOrientation(); From 29e971887db6dbfb1ca89fe39d6668c97808445c Mon Sep 17 00:00:00 2001 From: Max Weber Date: Tue, 12 Feb 2019 04:03:41 -0700 Subject: [PATCH 047/304] DevTools: draw both DecorativeObject Renderables --- .../runelite/client/plugins/devtools/DevToolsOverlay.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java index 0b9be07b7e..fd96de011c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java @@ -347,6 +347,12 @@ class DevToolsOverlay extends Overlay { graphics.drawPolygon(p); } + + p = decorObject.getConvexHull2(); + if (p != null) + { + graphics.drawPolygon(p); + } } } From d186632c4c95cfcf46ce8589b3ea96a8b8258a75 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 12 Feb 2019 11:55:20 +0000 Subject: [PATCH 048/304] Use ItemVariations when using Reset option for shift-click Signed-off-by: Tomas Slusny --- .../client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index e6420bdc99..8300333570 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -179,6 +179,7 @@ public class MenuEntrySwapperPlugin extends Plugin private void unsetSwapConfig(int itemId) { + itemId = ItemVariationMapping.map(itemId); configManager.unsetConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId); } From 90b00b234fce06c2622f101209799992c54b3773 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 26 Nov 2018 01:20:14 -0700 Subject: [PATCH 049/304] runelite-client: centralize sprite overrides --- .../runelite/client/game/SpriteManager.java | 36 ++++++++++++++++ .../runelite/client/game/SpriteOverride.java | 42 +++++++++++++++++++ .../plugins/banktags/BankTagsPlugin.java | 12 +++--- .../plugins/banktags/tabs/TabSprites.java | 33 +++------------ .../net/runelite/client/util/ImageUtil.java | 16 ++++++- 5 files changed, 104 insertions(+), 35 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/game/SpriteOverride.java diff --git a/runelite-client/src/main/java/net/runelite/client/game/SpriteManager.java b/runelite-client/src/main/java/net/runelite/client/game/SpriteManager.java index f0df8286cd..f177377818 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/SpriteManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/SpriteManager.java @@ -28,6 +28,7 @@ import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.inject.Inject; import java.awt.image.BufferedImage; +import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import javax.annotation.Nullable; @@ -36,11 +37,14 @@ import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.SwingUtilities; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.SpritePixels; import net.runelite.client.callback.ClientThread; +import net.runelite.client.util.ImageUtil; +@Slf4j @Singleton public class SpriteManager { @@ -127,4 +131,36 @@ public class SpriteManager }); }); } + + public void addSpriteOverrides(SpriteOverride[] add) + { + if (add.length <= 0) + { + return; + } + + clientThread.invokeLater(() -> + { + Map overrides = client.getSpriteOverrides(); + Class owner = add[0].getClass(); + for (SpriteOverride o : add) + { + BufferedImage image = ImageUtil.getResourceStreamFromClass(owner, o.getFileName()); + SpritePixels sp = ImageUtil.getImageSpritePixels(image, client); + overrides.put(o.getSpriteId(), sp); + } + }); + } + + public void removeSpriteOverrides(SpriteOverride[] remove) + { + clientThread.invokeLater(() -> + { + Map overrides = client.getSpriteOverrides(); + for (SpriteOverride o : remove) + { + overrides.remove(o.getSpriteId()); + } + }); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/game/SpriteOverride.java b/runelite-client/src/main/java/net/runelite/client/game/SpriteOverride.java new file mode 100644 index 0000000000..a4f894d5c0 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/game/SpriteOverride.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2018 Abex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.game; + +import net.runelite.api.SpriteID; + +public interface SpriteOverride +{ + /** + * An ID for a sprite. Negative numbers are used by RuneLite specific sprites + * + * @see SpriteID + */ + int getSpriteId(); + + /** + * The file name for the resource to be loaded, relative to the implementing class + */ + String getFileName(); +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java index 620cc586be..6a3a7f3416 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java @@ -60,6 +60,7 @@ import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; +import net.runelite.client.game.SpriteManager; import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.input.KeyListener; import net.runelite.client.input.KeyManager; @@ -125,6 +126,9 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis @Inject private KeyManager keyManager; + @Inject + private SpriteManager spriteManager; + private boolean shiftPressed = false; @Provides @@ -139,7 +143,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis keyManager.registerKeyListener(this); mouseManager.registerMouseWheelListener(this); clientThread.invokeLater(tabInterface::init); - client.getSpriteOverrides().putAll(TabSprites.toMap(client)); + spriteManager.addSpriteOverrides(TabSprites.values()); } @Override @@ -148,11 +152,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis keyManager.unregisterKeyListener(this); mouseManager.unregisterMouseWheelListener(this); clientThread.invokeLater(tabInterface::destroy); - - for (TabSprites value : TabSprites.values()) - { - client.getSpriteOverrides().remove(value.getSpriteId()); - } + spriteManager.removeSpriteOverrides(TabSprites.values()); shiftPressed = false; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabSprites.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabSprites.java index e7706679b0..20f9d0dfb6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabSprites.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabSprites.java @@ -25,17 +25,12 @@ */ package net.runelite.client.plugins.banktags.tabs; -import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.Map; import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.SpritePixels; -import net.runelite.client.util.ImageUtil; +import lombok.RequiredArgsConstructor; +import net.runelite.client.game.SpriteOverride; -@Slf4j -public enum TabSprites +@RequiredArgsConstructor +public enum TabSprites implements SpriteOverride { INCINERATOR(-200, "incinerator.png"), TAB_BACKGROUND(-201, "tag-tab.png"), @@ -46,23 +41,7 @@ public enum TabSprites @Getter private final int spriteId; - private final BufferedImage image; - TabSprites(final int spriteId, final String imageName) - { - this.spriteId = spriteId; - this.image = ImageUtil.getResourceStreamFromClass(this.getClass(), imageName); - } - - public static Map toMap(Client client) - { - final Map map = new HashMap<>(); - - for (TabSprites value : values()) - { - map.put(value.spriteId, ImageUtil.getImageSpritePixels(value.image, client)); - } - - return map; - } + @Getter + private final String fileName; } diff --git a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java index 1fa63d815e..16a6b1c78a 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java @@ -30,6 +30,7 @@ import java.awt.Image; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; +import java.awt.image.DirectColorModel; import java.awt.image.PixelGrabber; import java.awt.image.RescaleOp; import java.io.IOException; @@ -426,8 +427,19 @@ public class ImageUtil try { - new PixelGrabber(image, 0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth()) - .grabPixels(); + PixelGrabber g = new PixelGrabber(image, 0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth()); + g.setColorModel(new DirectColorModel(32, 0xff0000, 0xff00, 0xff, 0xff000000)); + g.grabPixels(); + + // Make any fully transparent pixels fully black, because the sprite draw routines + // check for == 0, not actual transparency + for (int i = 0; i < pixels.length; i++) + { + if ((pixels[i] & 0xFF000000) == 0) + { + pixels[i] = 0; + } + } } catch (InterruptedException ex) { From e287a34a574ea3f9e86c437a4f84e70412a3b13e Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sat, 1 Dec 2018 16:14:44 -0700 Subject: [PATCH 050/304] ChatboxTextInput: Don't set built in update update is desgined to be fully replaced by child classes, so it should not access private state --- .../net/runelite/client/game/chatbox/ChatboxTextInput.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java index e340027d1a..848f461288 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java @@ -95,12 +95,13 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse @Getter private int fontID = FontID.QUILL_8; + @Getter + private boolean built = false; + // This is a lambda so I can have atomic updates for it's captures private ToIntFunction getCharOffset = null; private Predicate isInBounds = null; - private boolean built = false; - @Inject protected ChatboxTextInput(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread) { @@ -209,7 +210,6 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse protected void update() { - this.built = true; Widget container = chatboxPanelManager.getContainerWidget(); container.deleteAllChildren(); @@ -369,6 +369,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse @Override protected void open() { + this.built = true; update(); } From d2713c2138e4940e0cd0bd3c4afcf028e3ea807c Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 12 Feb 2019 22:49:01 +0100 Subject: [PATCH 051/304] Add offset to loot tracker API Signed-off-by: Tomas Slusny --- .../http/service/loottracker/LootTrackerController.java | 4 ++-- .../http/service/loottracker/LootTrackerService.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerController.java b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerController.java index 36e0a2333d..d5a09f44d2 100644 --- a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerController.java +++ b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerController.java @@ -66,7 +66,7 @@ public class LootTrackerController } @RequestMapping - public Collection getLootRecords(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "count", defaultValue = "1024") int count) throws IOException + public Collection getLootRecords(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "count", defaultValue = "1024") int count, @RequestParam(value = "start", defaultValue = "0") int start) throws IOException { SessionEntry e = auth.handle(request, response); if (e == null) @@ -75,7 +75,7 @@ public class LootTrackerController return null; } - return service.get(e.getUser(), count); + return service.get(e.getUser(), count, start); } @DeleteMapping diff --git a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java index d39e159228..86b7115a80 100644 --- a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java +++ b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java @@ -66,7 +66,7 @@ public class LootTrackerService private static final String INSERT_KILL_QUERY = "INSERT INTO kills (accountId, type, eventId) VALUES (:accountId, :type, :eventId)"; private static final String INSERT_DROP_QUERY = "INSERT INTO drops (killId, itemId, itemQuantity) VALUES (LAST_INSERT_ID(), :itemId, :itemQuantity)"; - private static final String SELECT_LOOT_QUERY = "SELECT killId,time,type,eventId,itemId,itemQuantity FROM kills JOIN drops ON drops.killId = kills.id WHERE accountId = :accountId ORDER BY TIME DESC LIMIT :limit"; + private static final String SELECT_LOOT_QUERY = "SELECT killId,time,type,eventId,itemId,itemQuantity FROM kills JOIN drops ON drops.killId = kills.id WHERE accountId = :accountId ORDER BY TIME DESC LIMIT :limit OFFSET :offset"; private static final String DELETE_LOOT_ACCOUNT = "DELETE FROM kills WHERE accountId = :accountId"; private static final String DELETE_LOOT_ACCOUNT_EVENTID = "DELETE FROM kills WHERE accountId = :accountId AND eventId = :eventId"; @@ -119,7 +119,7 @@ public class LootTrackerService } } - public Collection get(int accountId, int limit) + public Collection get(int accountId, int limit, int offset) { List lootResults; @@ -128,6 +128,7 @@ public class LootTrackerService lootResults = con.createQuery(SELECT_LOOT_QUERY) .addParameter("accountId", accountId) .addParameter("limit", limit) + .addParameter("offset", offset) .executeAndFetch(LootResult.class); } From 35e6e341bb9db6bbe8dab17e7bacfde709bbcdc9 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 26 Nov 2018 19:33:30 -0700 Subject: [PATCH 052/304] Add Wiki plugin This has the side affect of making the click mask around the run orb correct in fixed mode --- .../main/java/net/runelite/api/Client.java | 5 + .../main/java/net/runelite/api/SpriteID.java | 2 +- .../java/net/runelite/api/widgets/Widget.java | 52 +++ .../runelite/api/widgets/WidgetConfig.java | 51 +++ .../net/runelite/api/widgets/WidgetID.java | 9 + .../net/runelite/api/widgets/WidgetInfo.java | 7 +- .../devtools/WidgetInfoTableModel.java | 3 + .../client/plugins/wiki/WikiPlugin.java | 289 +++++++++++++++++ .../wiki/WikiSearchChatboxTextInput.java | 302 ++++++++++++++++++ .../client/plugins/wiki/WikiSprite.java | 44 +++ .../wiki/fixed_mode_minimap_clickmask.png | Bin 0 -> 2027 bytes .../net/runelite/client/plugins/wiki/wiki.png | Bin 0 -> 3092 bytes .../client/plugins/wiki/wiki_selected.png | Bin 0 -> 3025 bytes .../java/net/runelite/rs/api/RSClient.java | 4 + .../java/net/runelite/rs/api/RSWidget.java | 36 +++ 15 files changed, 802 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSprite.java create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/wiki/fixed_mode_minimap_clickmask.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/wiki/wiki.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/wiki/wiki_selected.png diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index ca51dc74a9..652eb00806 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1569,4 +1569,9 @@ public interface Client extends GameEngine int getRasterizer3D_clipMidY2(); void checkClickbox(Model model, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash); + + /** + * Sets if a widget is in target mode + */ + void setSpellSelected(boolean selected); } diff --git a/runelite-api/src/main/java/net/runelite/api/SpriteID.java b/runelite-api/src/main/java/net/runelite/api/SpriteID.java index 2c4ac4f878..e707854c12 100644 --- a/runelite-api/src/main/java/net/runelite/api/SpriteID.java +++ b/runelite-api/src/main/java/net/runelite/api/SpriteID.java @@ -1172,7 +1172,7 @@ public final class SpriteID public static final int MINIMAP_ORB_XP_ACTIVATED = 1197; public static final int MINIMAP_ORB_XP_HOVERED = 1198; public static final int MINIMAP_ORB_XP_ACTIVATED_HOVERED = 1199; - public static final int UNKNOWN_BLACK_BLOBS = 1200; + public static final int MINIMAP_CLICK_MASK = 1200; public static final int OPTIONS_ZOOM_SLIDER_THUMB = 1201; public static final int EMOTE_SIT_UP = 1202; public static final int EMOTE_STAR_JUMP = 1203; diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java b/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java index 3aa6e23f13..ed4277a2a3 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java @@ -79,6 +79,7 @@ public interface Widget /** * Gets the current click configuration of the widget. + * @see WidgetConfig * * @see WidgetConfig */ @@ -551,6 +552,13 @@ public interface Widget */ void setOnMouseOverListener(Object... args); + /** + * Sets a script to be ran every frame when the mouse is in the widget bounds + * + * @param args A ScriptID, then the args for the script + */ + void setOnMouseRepeatListener(Object... args); + /** * Sets a script to be ran when the mouse leaves the widget bounds * @@ -565,6 +573,20 @@ public interface Widget */ void setOnTimerListener(Object... args); + /** + * Sets a script to be ran when the target mode has been activated for this widget + * + * @param args A ScriptID, then the args for the script + */ + void setOnTargetEnterListener(Object... args); + + /** + * Sets a script to be ran when the target mode has been deactivated for this widget + * + * @param args A ScriptID, then the args for the script + */ + void setOnTargetLeaveListener(Object... args); + /** * If this widget has any listeners on it */ @@ -769,4 +791,34 @@ public interface Widget * Sets if the rectangle is filled or just stroked */ void setFilled(boolean filled); + + /** + * Verb for spell targets + */ + String getTargetVerb(); + + /** + * Verb for spell targets + */ + void setTargetVerb(String targetVerb); + + /** + * Can widgets under this widgets be clicked in this widgets bounding box + */ + boolean getNoClickThrough(); + + /** + * Can widgets under this widgets be clicked in this widgets bounding box + */ + void setNoClickThrough(boolean noClickThrough); + + /** + * Can widgets under this widgets be scrolled in this widgets bounding box + */ + boolean getNoScrollThrough(); + + /** + * Can widgets under this widgets be scrolled in this widgets bounding box + */ + void setNoScrollThrough(boolean noScrollThrough); } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetConfig.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetConfig.java index 0b8f6a587d..31829b5417 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetConfig.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetConfig.java @@ -24,6 +24,8 @@ */ package net.runelite.api.widgets; +import net.runelite.api.MenuAction; + /** * Utility class used for defining options to be used on the click mask * of a {@link Widget}. @@ -36,12 +38,61 @@ public class WidgetConfig * Enables displaying a ninth option on a menu. */ public static final int SHOW_MENU_OPTION_NINE = 1 << 9; + + /** + * Can this widget be used on a item on the floor + */ + public static final int USE_GROUND_ITEM = 1 << 11; + + /** + * Can this widget be used on a NPC + */ + public static final int USE_NPC = 2 << 11; + + /** + * Can this widget be used on a game object + */ + public static final int USE_OBJECT = 4 << 11; + + /** + * Can this widget be used on a player + */ + public static final int USE_PLAYER = 8 << 11; + + /** + * Can this widget be used on a item in your inventory + */ + public static final int USE_ITEM = 16 << 11; + + /** + * Can this widget be used on a widget with the WIDGET_USE_TARGET flag + */ + public static final int USE_WIDGET = 32 << 11; + /** * Controls whether or not a widget can have another dragged onto it. */ public static final int DRAG_ON = 1 << 17; + /** * Controls whether or not a widget can be dragged around. */ public static final int DRAG = 1 << 20; + + /** + * Can widgets with USE_WIDGET be used on this widget + */ + public static final int WIDGET_USE_TARGET = 1 << 21; + + /** + * Is the widget an (inventory?) item + */ + public static final int ITEM = 1 << 30; + + /** + * Add a USE option + * + * @see MenuAction#ITEM_USE + */ + public static final int ITEM_USE_OP = 1 << 31; } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 9f07f9ba37..e919c0f992 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -125,6 +125,7 @@ public class WidgetID public static final int SKOTIZO_GROUP_ID = 308; public static final int ENTERING_HOUSE_GROUP_ID = 71; public static final int FULLSCREEN_MAP_GROUP_ID = 165; + public static final int QUESTLIST_GROUP_ID = 399; static class WorldMap { @@ -292,6 +293,7 @@ public class WidgetID static final int TOGGLE_RUN_ORB = 22; // Has the "Toggle run" name static final int RUN_ORB_TEXT = 23; static final int SPEC_ORB = 28; + static final int WORLDMAP_ORB = 40; } static class LoginClickToPlayScreen @@ -747,4 +749,11 @@ public class WidgetID { static final int ROOT = 25; } + + static class QuestList + { + static final int FREE_CONTAINER = 9; + static final int MEMBERS_CONTAINER = 10; + static final int MINIQUEST_CONTAINER = 11; + } } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 556dc57bf5..7808e06cba 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -159,6 +159,7 @@ public enum WidgetInfo MINIMAP_RUN_ORB_TEXT(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.RUN_ORB_TEXT), MINIMAP_HEALTH_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.HEALTH_ORB), MINIMAP_SPEC_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.SPEC_ORB), + MINIMAP_WORLDMAP_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB), LOGIN_CLICK_TO_PLAY_SCREEN(WidgetID.LOGIN_CLICK_TO_PLAY_GROUP_ID, 0), LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY(WidgetID.LOGIN_CLICK_TO_PLAY_GROUP_ID, WidgetID.LoginClickToPlayScreen.MESSAGE_OF_THE_DAY), @@ -463,7 +464,11 @@ public enum WidgetInfo SKOTIZO_CONTAINER(WidgetID.SKOTIZO_GROUP_ID, WidgetID.Skotizo.CONTAINER), - FULLSCREEN_MAP_ROOT(WidgetID.FULLSCREEN_MAP_GROUP_ID, WidgetID.FullScreenMap.ROOT); + FULLSCREEN_MAP_ROOT(WidgetID.FULLSCREEN_MAP_GROUP_ID, WidgetID.FullScreenMap.ROOT), + + QUESTLIST_FREE_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.FREE_CONTAINER), + QUESTLIST_MEMBERS_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.MEMBERS_CONTAINER), + QUESTLIST_MINIQUEST_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.MINIQUEST_CONTAINER); private final int groupId; private final int childId; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java index 79bb99bc5a..acd8851c0b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java @@ -183,6 +183,9 @@ public class WidgetInfoTableModel extends AbstractTableModel out.add(new WidgetField<>("ScrollHeight", Widget::getScrollHeight, Widget::setScrollHeight, Integer.class)); out.add(new WidgetField<>("DragDeadZone", Widget::getDragDeadZone, Widget::setDragDeadZone, Integer.class)); out.add(new WidgetField<>("DragDeadTime", Widget::getDragDeadTime, Widget::setDragDeadTime, Integer.class)); + out.add(new WidgetField<>("NoClickThrough", Widget::getNoClickThrough, Widget::setNoClickThrough, Boolean.class)); + out.add(new WidgetField<>("NoScrollThrough", Widget::getNoScrollThrough, Widget::setNoScrollThrough, Boolean.class)); + out.add(new WidgetField<>("TargetVerb", Widget::getTargetVerb, Widget::setTargetVerb, String.class)); return out; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java new file mode 100644 index 0000000000..e6b21437e0 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -0,0 +1,289 @@ +/* + * Copyright (c) 2018 Abex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.wiki; + +import com.google.common.primitives.Ints; +import java.net.URLEncoder; +import java.util.Arrays; +import javax.inject.Inject; +import javax.inject.Provider; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; +import net.runelite.api.MenuAction; +import net.runelite.api.MenuEntry; +import net.runelite.api.NPC; +import net.runelite.api.NPCComposition; +import net.runelite.api.events.MenuEntryAdded; +import net.runelite.api.events.MenuOptionClicked; +import net.runelite.api.events.WidgetLoaded; +import net.runelite.api.widgets.JavaScriptCallback; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetConfig; +import net.runelite.api.widgets.WidgetID; +import net.runelite.api.widgets.WidgetInfo; +import net.runelite.api.widgets.WidgetPositionMode; +import net.runelite.api.widgets.WidgetType; +import net.runelite.client.callback.ClientThread; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.ItemManager; +import net.runelite.client.game.SpriteManager; +import net.runelite.client.game.chatbox.ChatboxPanelManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.util.LinkBrowser; +import net.runelite.client.util.Text; +import okhttp3.HttpUrl; + +@Slf4j +@PluginDescriptor( + name = "Wiki", + description = "Adds a Wiki button that takes you to the OSRS Wiki" +) +public class WikiPlugin extends Plugin +{ + private static final int[] QUESTLIST_WIDGET_IDS = new int[] + { + WidgetInfo.QUESTLIST_FREE_CONTAINER.getId(), + WidgetInfo.QUESTLIST_MEMBERS_CONTAINER.getId(), + WidgetInfo.QUESTLIST_MINIQUEST_CONTAINER.getId(), + }; + + static final String WIKI_BASE = "https://oldschool.runescape.wiki"; + static final HttpUrl WIKI_RSLOOKUP = HttpUrl.parse(WIKI_BASE + "/w/Special:Lookup"); + static final HttpUrl WIKI_API = HttpUrl.parse(WIKI_BASE + "/api.php"); + static final String UTM_SORUCE_KEY = "utm_source"; + static final String UTM_SORUCE_VALUE = "runelite"; + static final String UTM_PARAMS = UTM_SORUCE_KEY + "=" + UTM_SORUCE_VALUE; + + private static final String MENUOP_GUIDE = "Guide"; + private static final String MENUOP_QUICKGUIDE = "Quick Guide"; + + @Inject + private SpriteManager spriteManager; + + @Inject + private ClientThread clientThread; + + @Inject + private Client client; + + @Inject + private ChatboxPanelManager chatboxPanelManager; + + @Inject + private ItemManager itemManager; + + @Inject + private Provider wikiSearchChatboxTextInputProvider; + + private Widget icon; + + private boolean wikiSelected = false; + + @Override + public void startUp() + { + spriteManager.addSpriteOverrides(WikiSprite.values()); + clientThread.invokeLater(this::addWidgets); + } + + @Override + public void shutDown() + { + spriteManager.removeSpriteOverrides(WikiSprite.values()); + clientThread.invokeLater(() -> + { + Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); + if (minimapOrbs == null) + { + return; + } + Widget[] children = minimapOrbs.getChildren(); + if (children == null || children.length < 1) + { + return; + } + children[0] = null; + }); + } + + @Subscribe + private void onWidgetLoaded(WidgetLoaded l) + { + if (l.getGroupId() == WidgetID.MINIMAP_GROUP_ID) + { + addWidgets(); + } + } + + private void addWidgets() + { + Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); + if (minimapOrbs == null) + { + return; + } + + icon = minimapOrbs.createChild(0, WidgetType.GRAPHIC); + icon.setSpriteId(WikiSprite.WIKI_ICON.getSpriteId()); + icon.setOriginalX(0); + icon.setOriginalY(2); + icon.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); + icon.setYPositionMode(WidgetPositionMode.ABSOLUTE_BOTTOM); + icon.setOriginalWidth(42); + icon.setOriginalHeight(16); + icon.setTargetVerb("Lookup"); + icon.setName("Wiki"); + icon.setClickMask(WidgetConfig.USE_GROUND_ITEM | WidgetConfig.USE_ITEM | WidgetConfig.USE_NPC); + icon.setNoClickThrough(true); + icon.setOnTargetEnterListener((JavaScriptCallback) ev -> + { + wikiSelected = true; + icon.setSpriteId(WikiSprite.WIKI_SELECTED_ICON.getSpriteId()); + }); + icon.setAction(5, "Search"); // Start at option 5 so the target op is ontop + icon.setOnOpListener((JavaScriptCallback) ev -> + { + switch (ev.getOp()) + { + case 6: + openSearchInput(); + break; + } + }); + // This doesn't always run because we cancel the menuop + icon.setOnTargetLeaveListener((JavaScriptCallback) ev -> onDeselect()); + icon.revalidate(); + } + + private void onDeselect() + { + wikiSelected = false; + icon.setSpriteId(WikiSprite.WIKI_ICON.getSpriteId()); + } + + @Subscribe + private void onMenuOptionClicked(MenuOptionClicked ev) + { + if (wikiSelected) + { + onDeselect(); + client.setSpellSelected(false); + ev.consume(); + + String type; + int id; + String name; + switch (ev.getMenuAction()) + { + case CANCEL: + return; + case ITEM_USE_ON_WIDGET: + case SPELL_CAST_ON_GROUND_ITEM: + { + type = "item"; + id = itemManager.canonicalize(ev.getId()); + name = itemManager.getItemComposition(id).getName(); + break; + } + case SPELL_CAST_ON_NPC: + { + type = "npc"; + NPC npc = client.getCachedNPCs()[ev.getId()]; + NPCComposition nc = npc.getTransformedComposition(); + id = nc.getId(); + name = nc.getName(); + break; + } + default: + log.info("Unknown menu option: {} {} {}", ev, ev.getMenuAction(), ev.getMenuAction() == MenuAction.CANCEL); + return; + } + + HttpUrl url = WIKI_RSLOOKUP.newBuilder() + .addQueryParameter("type", type) + .addQueryParameter("id", "" + id) + .addQueryParameter("name", name) + .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE) + .build(); + + LinkBrowser.browse(url.toString()); + return; + } + + if (ev.getMenuAction() == MenuAction.RUNELITE) + { + String quickguide = ""; + switch (ev.getMenuOption()) + { + case MENUOP_QUICKGUIDE: + quickguide = "/Quick_guide"; + //fallthrough; + case MENUOP_GUIDE: + ev.consume(); + String quest = Text.removeTags(ev.getMenuTarget()); + LinkBrowser.browse(WIKI_BASE + "/w/" + URLEncoder.encode(quest.replace(' ', '_')) + quickguide + "?" + UTM_PARAMS); + break; + } + } + } + + private void openSearchInput() + { + wikiSearchChatboxTextInputProvider.get() + .build(); + } + + @Subscribe + public void onMenuEntryAdded(MenuEntryAdded event) + { + int widgetIndex = event.getActionParam0(); + int widgetID = event.getActionParam1(); + + if (!Ints.contains(QUESTLIST_WIDGET_IDS, widgetID) || !"Read Journal:".equals(event.getOption())) + { + return; + } + + MenuEntry[] menuEntries = client.getMenuEntries(); + menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 2); + + MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); + menuEntry.setTarget(event.getTarget()); + menuEntry.setOption(MENUOP_GUIDE); + menuEntry.setParam0(widgetIndex); + menuEntry.setParam1(widgetID); + menuEntry.setType(MenuAction.RUNELITE.getId()); + + menuEntry = menuEntries[menuEntries.length - 2] = new MenuEntry(); + menuEntry.setTarget(event.getTarget()); + menuEntry.setOption(MENUOP_QUICKGUIDE); + menuEntry.setParam0(widgetIndex); + menuEntry.setParam1(widgetID); + menuEntry.setType(MenuAction.RUNELITE.getId()); + + client.setMenuEntries(menuEntries); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java new file mode 100644 index 0000000000..51ea075d2f --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2018 Abex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.wiki; + +import com.google.common.collect.ImmutableList; +import com.google.common.reflect.TypeToken; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import com.google.inject.Inject; +import java.awt.event.KeyEvent; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.List; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import javax.inject.Named; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.widgets.JavaScriptCallback; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetPositionMode; +import net.runelite.api.widgets.WidgetSizeMode; +import net.runelite.api.widgets.WidgetTextAlignment; +import net.runelite.api.widgets.WidgetType; +import net.runelite.client.callback.ClientThread; +import net.runelite.client.game.chatbox.ChatboxPanelManager; +import net.runelite.client.game.chatbox.ChatboxTextInput; +import net.runelite.client.util.LinkBrowser; +import net.runelite.http.api.RuneLiteAPI; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.HttpUrl; +import okhttp3.Request; +import okhttp3.Response; + +@Slf4j +public class WikiSearchChatboxTextInput extends ChatboxTextInput +{ + private static final int LINE_HEIGHT = 20; + private static final int CHATBOX_HEIGHT = 120; + private static final int MAX_NUM_PREDICTIONS = (CHATBOX_HEIGHT / LINE_HEIGHT) - 2; // 1 title, 1 edit + + private static final int PREDICTION_DEBOUNCE_DELAY_MS = 200; + + private final ChatboxPanelManager chatboxPanelManager; + private final Gson gson = new Gson(); + + private Future runningRequest = null; + private List predictions = ImmutableList.of(); + + private int selectedPrediction = -1; + private String offPrediction = null; + + @Inject + public WikiSearchChatboxTextInput(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread, + ScheduledExecutorService scheduledExecutorService, @Named("developerMode") final boolean developerMode) + { + super(chatboxPanelManager, clientThread); + this.chatboxPanelManager = chatboxPanelManager; + + prompt("OSRS Wiki Search"); + onDone(string -> + { + if (string != null && string.length() > 0) + { + search(string); + } + }); + onChanged(searchString -> + { + selectedPrediction = -1; + Future rr = runningRequest; + if (rr != null) + { + rr.cancel(false); + } + if (searchString.length() <= 1) + { + runningRequest = null; + clientThread.invokeLater(() -> + { + predictions = ImmutableList.of(); + update(); + }); + return; + } + runningRequest = scheduledExecutorService.schedule(() -> + { + HttpUrl url = WikiPlugin.WIKI_API.newBuilder() + .addQueryParameter("action", "opensearch") + .addQueryParameter("search", searchString) + .addQueryParameter("redirects", "resolve") + .addQueryParameter("format", "json") + .addQueryParameter("warningsaserror", Boolean.toString(developerMode)) + .build(); + + Request req = new Request.Builder() + .url(url) + .build(); + + RuneLiteAPI.CLIENT.newCall(req).enqueue(new Callback() + { + @Override + public void onFailure(Call call, IOException e) + { + log.warn("error searching wiki", e); + } + + @Override + public void onResponse(Call call, Response response) throws IOException + { + String body = response.body().string(); + try + { + JsonArray jar = new JsonParser().parse(body).getAsJsonArray(); + List apredictions = gson.fromJson(jar.get(1), new TypeToken>() + { + }.getType()); + + if (apredictions.size() > MAX_NUM_PREDICTIONS) + { + apredictions = apredictions.subList(0, MAX_NUM_PREDICTIONS); + } + + final List bpredictions = apredictions; + + clientThread.invokeLater(() -> + { + predictions = bpredictions; + update(); + }); + } + catch (JsonParseException | IllegalStateException | IndexOutOfBoundsException e) + { + log.warn("error parsing wiki response {}", body, e); + } + finally + { + response.close(); + } + } + }); + + runningRequest = null; + }, PREDICTION_DEBOUNCE_DELAY_MS, TimeUnit.MILLISECONDS); + }); + } + + @Override + protected void update() + { + Widget container = chatboxPanelManager.getContainerWidget(); + container.deleteAllChildren(); + + Widget promptWidget = container.createChild(-1, WidgetType.TEXT); + promptWidget.setText(getPrompt()); + promptWidget.setTextColor(0x800000); + promptWidget.setFontId(getFontID()); + promptWidget.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); + promptWidget.setOriginalX(0); + promptWidget.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); + promptWidget.setOriginalY(5); + promptWidget.setOriginalHeight(LINE_HEIGHT); + promptWidget.setXTextAlignment(WidgetTextAlignment.CENTER); + promptWidget.setYTextAlignment(WidgetTextAlignment.CENTER); + promptWidget.setWidthMode(WidgetSizeMode.MINUS); + promptWidget.revalidate(); + + buildEdit(0, 5 + LINE_HEIGHT, container.getWidth(), LINE_HEIGHT); + + Widget separator = container.createChild(-1, WidgetType.LINE); + separator.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); + separator.setOriginalX(0); + separator.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); + separator.setOriginalY(4 + (LINE_HEIGHT * 2)); + separator.setOriginalHeight(0); + separator.setOriginalWidth(16); + separator.setWidthMode(WidgetSizeMode.MINUS); + separator.revalidate(); + + for (int i = 0; i < predictions.size(); i++) + { + String pred = predictions.get(i); + int y = 6 + (LINE_HEIGHT * (2 + i)); + + Widget bg = container.createChild(-1, WidgetType.RECTANGLE); + bg.setTextColor(0x4444DD); + bg.setFilled(true); + bg.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); + bg.setOriginalX(1); + bg.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); + bg.setOriginalY(y); + bg.setOriginalHeight(LINE_HEIGHT); + bg.setOriginalWidth(16); + bg.setWidthMode(WidgetSizeMode.MINUS); + bg.revalidate(); + bg.setName("" + pred); + bg.setAction(0, "Open"); + bg.setHasListener(true); + bg.setOnOpListener((JavaScriptCallback) ev -> search(pred)); + + Widget text = container.createChild(-1, WidgetType.TEXT); + text.setText(pred); + text.setFontId(getFontID()); + text.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); + text.setOriginalX(0); + text.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); + text.setOriginalY(y); + text.setOriginalHeight(LINE_HEIGHT); + text.setXTextAlignment(WidgetTextAlignment.CENTER); + text.setYTextAlignment(WidgetTextAlignment.CENTER); + text.setWidthMode(WidgetSizeMode.MINUS); + text.revalidate(); + + if (i == selectedPrediction) + { + text.setTextColor(0xFFFFFF); + } + else + { + bg.setOpacity(255); + text.setTextColor(0x000000); + bg.setOnMouseRepeatListener((JavaScriptCallback) ev -> text.setTextColor(0xFFFFFF)); + bg.setOnMouseLeaveListener((JavaScriptCallback) ev -> text.setTextColor(0x000000)); + } + } + } + + @Override + public void keyPressed(KeyEvent ev) + { + switch (ev.getKeyCode()) + { + case KeyEvent.VK_UP: + ev.consume(); + if (selectedPrediction > -1) + { + selectedPrediction--; + if (selectedPrediction == -1) + { + value(offPrediction); + } + else + { + value(predictions.get(selectedPrediction)); + } + } + break; + case KeyEvent.VK_DOWN: + ev.consume(); + + if (selectedPrediction == -1) + { + offPrediction = getValue(); + } + + selectedPrediction++; + if (selectedPrediction >= predictions.size()) + { + selectedPrediction = predictions.size() - 1; + } + + if (selectedPrediction != -1) + { + value(predictions.get(selectedPrediction)); + } + break; + default: + super.keyPressed(ev); + } + } + + private void search(String search) + { + LinkBrowser.browse(WikiPlugin.WIKI_BASE + "?search=" + URLEncoder.encode(search) + "&" + WikiPlugin.UTM_PARAMS); + chatboxPanelManager.close(); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSprite.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSprite.java new file mode 100644 index 0000000000..188d54837b --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSprite.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018 Abex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.wiki; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import net.runelite.api.SpriteID; +import net.runelite.client.game.SpriteOverride; + +@RequiredArgsConstructor +public enum WikiSprite implements SpriteOverride +{ + WIKI_ICON(-300, "wiki.png"), + WIKI_SELECTED_ICON(-301, "wiki_selected.png"), + FIXED_MODE_MINIMAP_CLICKMASK(SpriteID.MINIMAP_CLICK_MASK, "fixed_mode_minimap_clickmask.png"); + + @Getter + private final int spriteId; + + @Getter + private final String fileName; +} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/wiki/fixed_mode_minimap_clickmask.png b/runelite-client/src/main/resources/net/runelite/client/plugins/wiki/fixed_mode_minimap_clickmask.png new file mode 100644 index 0000000000000000000000000000000000000000..e4f5fcbe48dab813a165f99d60a28acb3c4cb4ec GIT binary patch literal 2027 zcmcIlTWB0r7@la9B#@f45`wj1cCruEc6QFpUS?1yMev3cMSPKB>Y2TzN*eRx!r3`< z<~!g2egFCApPA8-;qI>cx-bmuP73ifx>nJ6qvLM$f6uk0pU|b#6rQj#Y{!Z_+Fswc zV>gD~^^2CtI@#0_UN(w8Q86UwD;G_K#;^m2%BCofK?j#$PSYdAuOEIw;F=O4jt5g9 zWyWA$6Q(S9Y-%JUPmRf(LL54XA1L#Ppa>liFBc2C&6guYjh9DrcbOva8pIik5JPT2 zJewNDV}=Fspf5zqbb!HG&PRs;#{~A{44_#GuoUel0nLLD@8|Hwk3i8ZMdj1+!;M(z zE<)rT$K)xhR4VyOexG6GD4OFq3NRGIkO)EAle#08N!=c7GQ^=RTbk);hK{?8qGXIa z5dtZ#TPT_>THS7>2_=jwizY?;fNQA0U`U$D0FGw>@25$?@&MGKDO3fD=!n|` z8;Yh*ZU>r5@k!lwL|ul-c!WTre43{4Qjk?uT4l)~U;xQT0fm&pVMt0rh6zBRNDQmi zbfNumLmqdN=kBi;tzyWCqm>`tAMgWO1`?@+0zs070h#20#E@ZC3c`>Kf$XQ7Y)35( zy*FavR#sP)f*56m4YI6XCRs`3$dDQUq!gfK(k})9%LD>UkoFU}BJ-+Y6-87fT2ahF z%G7fNzM&>&6bvh6C@AL$y|JE*#YQbd)e7i=ogR+j$wVwfbDSx%o$5YwukP_gxlr?9GD< z7yI6S`uyCfFT0Q4Twh&$b>_y;18uva?>>_Cu62F>pg5P^=Y6}9hzcE@p66zJc1EKD z?yaoc8C(7B?2>S)@>VLd54*cP z-rDYtPPEXov$jxaM|A%n-V__X18v?6+n{Oku6*x->ip!AtFSU#J|gsfbbU|w1L03@ zzWuYs)9-zA=Gv8qs%QGAzV6$#ync0MW$D{zY1-?h>HW3Q-&cL?65;Xc{nf8__qmFj zLHG0yxCFMbUo)=G^eaSnp@YnkCGs3CGi62gG qB+eiI%DxT4gcN!948Ya@$=CqpZ^xa46!9fH5jwbZ(M#Btkgk&>#X1u*ym&-64S_9g}c79tem!A~?W! zAjb%ZhzR0=g5tylWx-)p@L&`L2R$(tFF7>xB1fP?y6U>-v9rvsTTJDfup=4E5gnr0FKKMYX?a|m3`gm_<` z2i^fyAb4vc0}xQ?R6G+TQW#{AO1HvO$rL7u%p_500GYxjGuSi`Kl&kHvngO9+tYE? z=v>$vhagg^(z38RcpB^RM8R4GC~ z5yyDAr-O7r>AT`Zw?}l5NfS7cdHog%Mu@< zF`gf`Kqw&dLAnqCK?)OK3g|EZ(wJDNLK>4V#(!a$rzE1_PiHDH_vbGO%!6#7eBf5u?k<3)wvS zBoX6>y~&0InkB&@2sB*L1UuN}Bg!1Rb_utpxDMDtoDGuCpPlZup~<7se%m+e8nt*y6Q(}P zBF7U~wxvF?k1-6{+r9geVO&6cz=ac%pfu%9otd-p4g&gy$J~>Oq1u4CRe8qu<1>?o ze)?%jY<$BU|1*`g?%Uei!XoS1o1%XCeJ~Ao^*K^>Xx_?$Ss*;=j z7bDNO$7Z4gPn}za^R6Guhy~p16ZON^KJ*-_Nu%weh|DTl6|(dhuz+(@Ou=;Qr*TR=!CWpY+(hpR(z$Byu1KUv+d4UV9vA zkGi~0mR(n^47{Kndp9B56Wl|8sUyuD9Xp-tqz7uAYqbWWSzMiiwUKhE=c_!v=%rvxZGS3Jm6_;M>1BQ@$q!dJsvmNqVU13W34*&g>E{#e{2Cg zqNhEPuQjvFaVL5dY{TUTD!U?Q&Yh_j>ycb=e8}7Xf^v0ODpxt_>emCCLlCCU;p6e| zy|#P#cLoJtiEQfUWtYr7s8(C<(k)CY+EUbaJ2v4Cu8R%l&b2 z)!N@fg0-UqlA;ezIviurSQ^=vt=(Y-yV>Cu_EJxn$Z@Uwj$8emleeGHUToW6R8ri0 z)i37Jw$9Sl0nuU~y&r!+diOi&&I%QMYWQ2X1lztBb?v4VEZ=(}d7<~5YD>z_6ue!$ z?c18fnyzV2E10UIV8ahjC#mft9@_lF=3z6-@W<)7(-mO}MwNne(>j1yzun~Ng2MFh^xsmZqs0_f_! zlOO2!?KE%gt=n<9cZ*(Nf1~OChKv(SZkPu^UFQ#^yh~Yhvan`dsLHp-=-dioPdX~~ zI}FdJ?f%=Hs0#(J9+e>uo6h)347jCeMZe)JtthMYDYn9;Ez;Z~`3+0G6*))hH`hgX zdZ?e75pQ$2&a2%gzno6*bWG6`$HNLXlnml-<>0QQF&Sk?MCOO+nvaq&$ujYTdtCPE9p?yH~ALf0np8x;= literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/wiki/wiki_selected.png b/runelite-client/src/main/resources/net/runelite/client/plugins/wiki/wiki_selected.png new file mode 100644 index 0000000000000000000000000000000000000000..80838fb5c4f5f4406f0570212fb7e9825664b7ee GIT binary patch literal 3025 zcmcIm3s@6Z8V#VxLoA?(unHkytCq=|yh;>EKq5pbusp;ElbHzwl1#`1608)#7b=1l z7b>(A5d|Mu1XNg-mx9=86(4AqsuZo7x+se%MHJi#uXVfXy8C^bFO!+M_uO;O`Tzgk zn{7eMms(jkS`Y{XE0Mo27{4#VFKaVX{5P8PXcvAnSNTU`1cK#E!(~Ls|7s3_V0uy( z8lj002l60PK?Y$|f{=9z6^ih!P}5rsR`)>l#T!8O$ezdx)uGl>mvA z`L9zWA?uchLhIroE=*donCPkF;RFgq0}^!#xf0{)_@q%@9{y}-rjUrE5KTOvMdi|&?nFA3#->o&6dD7d(s)!BkHIC5e@OUjYFNq( z7W$3Pg}?Dhu^NqvN1D#p z#m8j#q#G4aphiFqst!d_`9z|ECRm690dYaNObMe}Y@tEVI2;jz8iY^6bH)K^G=ROb7rOY!JZP5GoyHND!uER2M#8h(d{m;2Fk`6)lWHILBms zc#ssLO1MlZz~$1|02^Y$0GGkWtx6eeiB!U1Nm$YewiRj_zHUJI>#PPe;I~nIC*>-g&+yzPjVS? zv^IGlWLOe>5@e_a1SX9)%ia*?_cJs`tBpl)(sxwJ7z{(D8ZD?sykqc`{D&H(yiGa= zCcRrY6JgOk*dBOBIS2x9U?u|qsS*(2a6LF|CY#HZcpwwT{|~~)Lkh)$$`}OSTPdXf z-OBrw`df1F`^ER)=itp&D25GnthOk>FT2sc*EU}~iK9*Uj&69IJWBAF$-@Xy;!#rL zN6nE-3u+03Da|6Gcc_0`M{cUWByv`pYr2_@i;r7|wT;kc(=Ia?q1&zuGm?+7%{DKg z(AwO_+pW0u)}Jy?9JKNH&ZLuuT)N5Ax4>1m$hv+2W>zWw^D@^i~nsl}z!r0%oZpG?Us zGRkq_C400Upfs7z3+rq;*3#42Z*;g)9ouXz7A@3ZoFc!jOjQcWru=Sbnps!Amw zef3>8pPcOv?YVchJEy!tMBL=j^>-KX?ymX8seE}8=Z;%#?qc1uvi-%jNsqUZYDzzH zNO3$Va*VznH#ILf#r$E|A<*^bORE))#ZFLB`i!XC+8d$;r)p-HmIQkdiWaEjTHuU$ z_=@G7r-OxQl#&6~jc+#D8`tHpB)2p9%cPY1b1MG2IKcSEu)6ox0q4)Ra(C-SIG!1V z<+a9P4Nj-ILj_lb^79`mHpr?R=86vo1nsYB(DN4>cjWHzZhvliZJ}+*@_lAo>?|Uj zRCIPquIG*idK`7f-LA5OeR@x`&Z^qkS$}W1BhV(+NL|t3G!*wd&~jGV zGU`*$d23q-zs<;LaZJc<*gB$O<&4x;mCVggD7;{EKH{;1Ywm5gV}jXFUR;o=ho9#nx9x&(tK;XPwR*I=3q6HaUKSdCDb^c83e957z3cJm>k6KDr=vT{hpn@rSaz zKv_6>nmBUmU}C=8+3dp7J1)K>VV&B9!ZpbHgL#8c{;Qa&aGi6SV)^kXME9)q)&b<*;&D21yBDzHf(18@$Hs5ro#o9 z+y6%P=F=UjpTuJ=$wQ^*?mW%1hK~3Abo_@PVRj|dwr24s+ZEBzAM_5?1v?$s9{6bS zXL~wtnSW3gS}Waj-Zo~C__MeTYJ6c;&s`DlaiHVQS^EnDYb}eC_E761(lu zwEE6JZl<>$PLF%KcZxoF{Vu3?$K|e6+t1U0%F2561Fy)lTV`Af_}XiFTKcS<3v`gk=-Jp>yYA}UD2Um(w#Qn z++5zj8z)pIB{j_r!hT(g0B06!)@7Lq+&_0 fO4qLVCVkjy5t=M<8GgCO@TXhkyIgq8Cp!Hfq9Brt literal 0 HcmV?d00001 diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index 04ac90d398..23c2558a16 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -921,4 +921,8 @@ public interface RSClient extends RSGameEngine, Client @Import("endY") int getEndY(); + + @Import("spellSelected") + @Override + void setSpellSelected(boolean selected); } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java b/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java index 75315b0514..0dd5b24d4f 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java @@ -328,6 +328,10 @@ public interface RSWidget extends Widget @Override void setOnMouseOverListener(Object... args); + @Import("onMouseRepeatListener") + @Override + void setOnMouseRepeatListener(Object... args); + @Import("onMouseLeaveListener") @Override void setOnMouseLeaveListener(Object... args); @@ -336,6 +340,14 @@ public interface RSWidget extends Widget @Override void setOnTimerListener(Object... args); + @Import("onTargetEnterListener") + @Override + void setOnTargetEnterListener(Object... args); + + @Import("onTargetLeaveListener") + @Override + void setOnTargetLeaveListener(Object... args); + @Import("fontId") @Override int getFontId(); @@ -435,4 +447,28 @@ public interface RSWidget extends Widget @Import("filled") @Override void setFilled(boolean filled); + + @Import("targetVerb") + @Override + String getTargetVerb(); + + @Import("targetVerb") + @Override + void setTargetVerb(String targetVerb); + + @Import("noClickThrough") + @Override + boolean getNoClickThrough(); + + @Import("noClickThrough") + @Override + void setNoClickThrough(boolean noClickThrough); + + @Import("noScrollThrough") + @Override + boolean getNoScrollThrough(); + + @Import("noScrollThrough") + @Override + void setNoScrollThrough(boolean noScrollThrough); } From da67381ba771869325adaf5ad6069209c71239f0 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 9 Feb 2019 11:42:40 -0500 Subject: [PATCH 053/304] Add GE history tracker Add http service to log completed trades, and submit trades when completed. --- .../http/api/ge/GrandExchangeClient.java | 78 ++++++++++ .../http/api/ge/GrandExchangeTrade.java | 38 +++++ .../service/ge/GrandExchangeController.java | 111 ++++++++++++++ .../http/service/ge/GrandExchangeService.java | 113 +++++++++++++++ .../runelite/http/service/ge/TradeAction.java | 31 ++++ .../runelite/http/service/ge/TradeEntry.java | 40 ++++++ .../grandexchange/GrandExchangePlugin.java | 136 +++++++++++++++++- .../plugins/grandexchange/SavedOffer.java | 39 +++++ 8 files changed, 583 insertions(+), 3 deletions(-) create mode 100644 http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java create mode 100644 http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java create mode 100644 http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java create mode 100644 http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeService.java create mode 100644 http-service/src/main/java/net/runelite/http/service/ge/TradeAction.java create mode 100644 http-service/src/main/java/net/runelite/http/service/ge/TradeEntry.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/SavedOffer.java diff --git a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java new file mode 100644 index 0000000000..a1b97bc390 --- /dev/null +++ b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.api.ge; + +import com.google.gson.Gson; +import java.io.IOException; +import java.util.UUID; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import net.runelite.http.api.RuneLiteAPI; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.HttpUrl; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +@Slf4j +@AllArgsConstructor +public class GrandExchangeClient +{ + private static final MediaType JSON = MediaType.parse("application/json"); + private static final Gson GSON = RuneLiteAPI.GSON; + + private final UUID uuid; + + public void submit(GrandExchangeTrade grandExchangeTrade) + { + final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + .addPathSegment("ge") + .build(); + + Request request = new Request.Builder() + .header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString()) + .post(RequestBody.create(JSON, GSON.toJson(grandExchangeTrade))) + .url(url) + .build(); + + RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback() + { + @Override + public void onFailure(Call call, IOException e) + { + log.debug("unable to submit trade", e); + } + + @Override + public void onResponse(Call call, Response response) + { + log.debug("Submitted trade"); + response.close(); + } + }); + } +} diff --git a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java new file mode 100644 index 0000000000..b5d0012b16 --- /dev/null +++ b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.api.ge; + +import java.time.Instant; +import lombok.Data; + +@Data +public class GrandExchangeTrade +{ + private boolean buy; + private int itemId; + private int quantity; + private int price; + private Instant time; +} diff --git a/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java new file mode 100644 index 0000000000..94c759b130 --- /dev/null +++ b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.service.ge; + +import java.io.IOException; +import java.util.Collection; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import net.runelite.http.api.ge.GrandExchangeTrade; +import net.runelite.http.service.account.AuthFilter; +import net.runelite.http.service.account.beans.SessionEntry; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/ge") +public class GrandExchangeController +{ + private final GrandExchangeService grandExchangeService; + private final AuthFilter authFilter; + + @Autowired + public GrandExchangeController(GrandExchangeService grandExchangeService, AuthFilter authFilter) + { + this.grandExchangeService = grandExchangeService; + this.authFilter = authFilter; + } + + @PostMapping + public void submit(HttpServletRequest request, HttpServletResponse response, @RequestBody GrandExchangeTrade grandExchangeTrade) throws IOException + { + SessionEntry session = authFilter.handle(request, response); + + if (session == null) + { + return; + } + + grandExchangeService.add(session.getUser(), grandExchangeTrade); + } + + @GetMapping + public Collection get(HttpServletRequest request, HttpServletResponse response, + @RequestParam(required = false, defaultValue = "1024") int limit, + @RequestParam(required = false, defaultValue = "0") int offset) throws IOException + { + SessionEntry session = authFilter.handle(request, response); + + if (session == null) + { + return null; + } + + return grandExchangeService.get(session.getUser(), limit, offset).stream() + .map(GrandExchangeController::convert) + .collect(Collectors.toList()); + } + + private static GrandExchangeTrade convert(TradeEntry tradeEntry) + { + GrandExchangeTrade grandExchangeTrade = new GrandExchangeTrade(); + grandExchangeTrade.setBuy(tradeEntry.getAction() == TradeAction.BUY); + grandExchangeTrade.setItemId(tradeEntry.getItem()); + grandExchangeTrade.setQuantity(tradeEntry.getQuantity()); + grandExchangeTrade.setPrice(tradeEntry.getPrice()); + grandExchangeTrade.setTime(tradeEntry.getTime()); + return grandExchangeTrade; + } + + @DeleteMapping + public void delete(HttpServletRequest request, HttpServletResponse response) throws IOException + { + SessionEntry session = authFilter.handle(request, response); + + if (session == null) + { + return; + } + + grandExchangeService.delete(session.getUser()); + } +} diff --git a/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeService.java b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeService.java new file mode 100644 index 0000000000..6456beb85f --- /dev/null +++ b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeService.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.service.ge; + +import java.util.Collection; +import net.runelite.http.api.ge.GrandExchangeTrade; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; +import org.sql2o.Connection; +import org.sql2o.Sql2o; + +@Service +public class GrandExchangeService +{ + private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS `ge_trades` (\n" + + " `id` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `user` int(11) NOT NULL,\n" + + " `action` enum('BUY','SELL') NOT NULL,\n" + + " `item` int(11) NOT NULL,\n" + + " `quantity` int(11) NOT NULL,\n" + + " `price` int(11) NOT NULL,\n" + + " `time` timestamp NOT NULL DEFAULT current_timestamp(),\n" + + " PRIMARY KEY (`id`),\n" + + " KEY `user_time` (`user`, `time`),\n" + + " KEY `time` (`time`),\n" + + " CONSTRAINT `ge_trades_ibfk_1` FOREIGN KEY (`user`) REFERENCES `users` (`id`)\n" + + ") ENGINE=InnoDB;"; + + private final Sql2o sql2o; + + @Autowired + public GrandExchangeService(@Qualifier("Runelite SQL2O") Sql2o sql2o) + { + this.sql2o = sql2o; + + // Ensure necessary tables exist + try (Connection con = sql2o.open()) + { + con.createQuery(CREATE_TABLE).executeUpdate(); + } + } + + public void add(int userId, GrandExchangeTrade grandExchangeTrade) + { + try (Connection con = sql2o.open()) + { + con.createQuery("insert into ge_trades (user, action, item, quantity, price) values (:user," + + " :action, :item, :quantity, :price)") + .addParameter("user", userId) + .addParameter("action", grandExchangeTrade.isBuy() ? "BUY" : "SELL") + .addParameter("item", grandExchangeTrade.getItemId()) + .addParameter("quantity", grandExchangeTrade.getQuantity()) + .addParameter("price", grandExchangeTrade.getPrice()) + .executeUpdate(); + } + } + + public Collection get(int userId, int limit, int offset) + { + try (Connection con = sql2o.open()) + { + return con.createQuery("select id, user, action, item, quantity, price, time from ge_trades where user = :user limit :limit offset :offset") + .addParameter("user", userId) + .addParameter("limit", limit) + .addParameter("offset", offset) + .executeAndFetch(TradeEntry.class); + } + } + + public void delete(int userId) + { + try (Connection con = sql2o.open()) + { + con.createQuery("delete from ge_trades where user = :user") + .addParameter("user", userId) + .executeUpdate(); + } + } + + @Scheduled(fixedDelay = 60 * 60 * 1000) + public void expire() + { + try (Connection con = sql2o.open()) + { + con.createQuery("delete from ge_trades where time < current_timestamp - interval 1 month") + .executeUpdate(); + } + } +} diff --git a/http-service/src/main/java/net/runelite/http/service/ge/TradeAction.java b/http-service/src/main/java/net/runelite/http/service/ge/TradeAction.java new file mode 100644 index 0000000000..fcc96d615f --- /dev/null +++ b/http-service/src/main/java/net/runelite/http/service/ge/TradeAction.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.service.ge; + +enum TradeAction +{ + BUY, + SELL; +} diff --git a/http-service/src/main/java/net/runelite/http/service/ge/TradeEntry.java b/http-service/src/main/java/net/runelite/http/service/ge/TradeEntry.java new file mode 100644 index 0000000000..bca3869811 --- /dev/null +++ b/http-service/src/main/java/net/runelite/http/service/ge/TradeEntry.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.service.ge; + +import java.time.Instant; +import lombok.Data; + +@Data +class TradeEntry +{ + private int id; + private int user; + private TradeAction action; + private int item; + private int quantity; + private int price; + private Instant time; +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index c26e39ebb5..5a59ede074 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -1,5 +1,5 @@ /* - * + * Copyright (c) 2019, Adam * Copyright (c) 2017, Robbie * Copyright (c) 2018, SomeoneWithAnInternetConnection * All rights reserved. @@ -46,6 +46,7 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.GrandExchangeOffer; +import net.runelite.api.GrandExchangeOfferState; import net.runelite.api.ItemComposition; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; @@ -56,11 +57,15 @@ import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.GrandExchangeOfferChanged; import net.runelite.api.events.MenuEntryAdded; +import net.runelite.api.events.SessionClose; +import net.runelite.api.events.SessionOpen; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.Notifier; +import net.runelite.client.account.AccountSession; +import net.runelite.client.account.SessionManager; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; @@ -73,6 +78,8 @@ import net.runelite.client.ui.NavigationButton; import net.runelite.client.util.ImageUtil; import net.runelite.client.util.StackFormatter; import net.runelite.client.util.Text; +import net.runelite.http.api.ge.GrandExchangeClient; +import net.runelite.http.api.ge.GrandExchangeTrade; import net.runelite.http.api.osbuddy.OSBGrandExchangeClient; import net.runelite.http.api.osbuddy.OSBGrandExchangeResult; @@ -134,10 +141,38 @@ public class GrandExchangePlugin extends Plugin @Inject private ScheduledExecutorService executorService; + @Inject + private SessionManager sessionManager; + + @Inject + private ConfigManager configManager; + private Widget grandExchangeText; private Widget grandExchangeItem; private Map itemGELimits; + private GrandExchangeClient grandExchangeClient; + + private SavedOffer getOffer(int slot) + { + String offer = configManager.getConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot)); + if (offer == null) + { + return null; + } + return GSON.fromJson(offer, SavedOffer.class); + } + + private void setOffer(int slot, SavedOffer offer) + { + configManager.setConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot), GSON.toJson(offer)); + } + + private void deleteOffer(int slot) + { + configManager.unsetConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot)); + } + @Provides GrandExchangeConfig provideConfig(ConfigManager configManager) { @@ -167,6 +202,12 @@ public class GrandExchangePlugin extends Plugin mouseManager.registerMouseListener(inputListener); keyManager.registerKeyListener(inputListener); } + + AccountSession accountSession = sessionManager.getAccountSession(); + if (accountSession != null) + { + grandExchangeClient = new GrandExchangeClient(accountSession.getUuid()); + } } @Override @@ -178,6 +219,27 @@ public class GrandExchangePlugin extends Plugin grandExchangeText = null; grandExchangeItem = null; itemGELimits = null; + grandExchangeClient = null; + } + + @Subscribe + public void onSessionOpen(SessionOpen sessionOpen) + { + AccountSession accountSession = sessionManager.getAccountSession(); + if (accountSession.getUuid() != null) + { + grandExchangeClient = new GrandExchangeClient(accountSession.getUuid()); + } + else + { + grandExchangeClient = null; + } + } + + @Subscribe + public void onSessionClose(SessionClose sessionClose) + { + grandExchangeClient = null; } @Subscribe @@ -204,11 +266,79 @@ public class GrandExchangePlugin extends Plugin @Subscribe public void onGrandExchangeOfferChanged(GrandExchangeOfferChanged offerEvent) { - GrandExchangeOffer offer = offerEvent.getOffer(); + final int slot = offerEvent.getSlot(); + final GrandExchangeOffer offer = offerEvent.getOffer(); + ItemComposition offerItem = itemManager.getItemComposition(offer.getItemId()); boolean shouldStack = offerItem.isStackable() || offer.getTotalQuantity() > 1; BufferedImage itemImage = itemManager.getImage(offer.getItemId(), offer.getTotalQuantity(), shouldStack); - SwingUtilities.invokeLater(() -> panel.getOffersPanel().updateOffer(offerItem, itemImage, offerEvent.getOffer(), offerEvent.getSlot())); + SwingUtilities.invokeLater(() -> panel.getOffersPanel().updateOffer(offerItem, itemImage, offer, slot)); + + submitTrades(slot, offer); + + updateConfig(slot, offer); + } + + private void submitTrades(int slot, GrandExchangeOffer offer) + { + if (grandExchangeClient == null) + { + return; + } + + // Only interested in offers which are fully bought/sold + if (offer.getState() != GrandExchangeOfferState.BOUGHT && offer.getState() != GrandExchangeOfferState.SOLD) + { + return; + } + + SavedOffer savedOffer = getOffer(slot); + if (!shouldUpdate(savedOffer, offer)) + { + return; + } + + // getPrice() is the price of the offer, not necessarily what the item bought at + int priceEach = offer.getSpent() / offer.getTotalQuantity(); + + GrandExchangeTrade grandExchangeTrade = new GrandExchangeTrade(); + grandExchangeTrade.setBuy(offer.getState() == GrandExchangeOfferState.BOUGHT); + grandExchangeTrade.setItemId(offer.getItemId()); + grandExchangeTrade.setQuantity(offer.getTotalQuantity()); + grandExchangeTrade.setPrice(priceEach); + + log.debug("Submitting trade: {}", grandExchangeTrade); + grandExchangeClient.submit(grandExchangeTrade); + } + + private void updateConfig(int slot, GrandExchangeOffer offer) + { + if (offer.getState() == GrandExchangeOfferState.EMPTY) + { + deleteOffer(slot); + } + else + { + SavedOffer savedOffer = new SavedOffer(); + savedOffer.setItemId(offer.getItemId()); + savedOffer.setQuantitySold(offer.getQuantitySold()); + savedOffer.setTotalQuantity(offer.getTotalQuantity()); + savedOffer.setPrice(offer.getPrice()); + savedOffer.setSpent(offer.getSpent()); + savedOffer.setState(offer.getState()); + setOffer(slot, savedOffer); + } + } + + private boolean shouldUpdate(SavedOffer savedOffer, GrandExchangeOffer grandExchangeOffer) + { + if (savedOffer == null) + { + return false; + } + + // Only update offer if state has changed + return savedOffer.getState() != grandExchangeOffer.getState(); } @Subscribe diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/SavedOffer.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/SavedOffer.java new file mode 100644 index 0000000000..58a4055fed --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/SavedOffer.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.grandexchange; + +import lombok.Data; +import net.runelite.api.GrandExchangeOfferState; + +@Data +class SavedOffer +{ + private int itemId; + private int quantitySold; + private int totalQuantity; + private int price; + private int spent; + private GrandExchangeOfferState state; +} From d59e7846d757718dea1c0c7acffd02dc448c0bd6 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 12 Feb 2019 12:24:02 +0000 Subject: [PATCH 054/304] Export ItemCompositionCache Signed-off-by: Tomas Slusny --- runelite-api/src/main/java/net/runelite/api/Client.java | 5 +++++ .../src/main/java/net/runelite/rs/api/RSClient.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 652eb00806..a410eb96a6 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1574,4 +1574,9 @@ public interface Client extends GameEngine * Sets if a widget is in target mode */ void setSpellSelected(boolean selected); + + /** + * Returns client item composition cache + */ + NodeCache getItemCompositionCache(); } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index 23c2558a16..587eceb6e1 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -785,6 +785,10 @@ public interface RSClient extends RSGameEngine, Client @Override RSNodeCache getWidgetSpriteCache(); + @Import("items") + @Override + RSNodeCache getItemCompositionCache(); + @Import("oculusOrbState") @Override int getOculusOrbState(); From 09d324e12960a7aec297abea1b6c87f95f48ae3e Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 12 Feb 2019 12:24:15 +0000 Subject: [PATCH 055/304] Reset item composition cache on menu shift click change Signed-off-by: Tomas Slusny --- .../net/runelite/client/game/ItemManager.java | 9 +++++++ .../MenuEntrySwapperPlugin.java | 27 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java index ad06024a7d..c91de9262c 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java @@ -256,6 +256,15 @@ public class ItemManager itemCompositions.put(event.getItemComposition().getId(), event.getItemComposition()); } + /** + * Invalidates internal item manager item composition cache (but not client item composition cache) + * @see Client#getItemCompositionCache() + */ + public void invalidateItemCompositionCache() + { + itemCompositions.invalidateAll(); + } + /** * Look up an item's price * diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 8300333570..ca62eca65e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -45,8 +45,10 @@ import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.PostItemComposition; import net.runelite.api.events.WidgetMenuOptionClicked; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemVariationMapping; import net.runelite.client.input.KeyManager; import net.runelite.client.menus.MenuManager; @@ -101,6 +103,9 @@ public class MenuEntrySwapperPlugin extends Plugin @Inject private Client client; + @Inject + private ClientThread clientThread; + @Inject private MenuEntrySwapperConfig config; @@ -116,6 +121,9 @@ public class MenuEntrySwapperPlugin extends Plugin @Inject private MenuManager menuManager; + @Inject + private ItemManager itemManager; + @Getter private boolean configuringShiftClick = false; @@ -146,6 +154,11 @@ public class MenuEntrySwapperPlugin extends Plugin @Subscribe public void onConfigChanged(ConfigChanged event) { + if (!CONFIG_GROUP.equals(event.getGroup())) + { + return; + } + if (event.getKey().equals("shiftClickCustomization")) { if (config.shiftClickCustomization()) @@ -157,6 +170,16 @@ public class MenuEntrySwapperPlugin extends Plugin disableCustomization(); } } + else if (event.getKey().startsWith(ITEM_KEY_PREFIX)) + { + clientThread.invoke(this::resetItemCompositionCache); + } + } + + private void resetItemCompositionCache() + { + itemManager.invalidateItemCompositionCache(); + client.getItemCompositionCache().reset(); } private Integer getSwapConfig(int itemId) @@ -187,6 +210,7 @@ public class MenuEntrySwapperPlugin extends Plugin { keyManager.registerKeyListener(inputListener); refreshShiftClickCustomizationMenus(); + clientThread.invoke(this::resetItemCompositionCache); } private void disableCustomization() @@ -194,6 +218,7 @@ public class MenuEntrySwapperPlugin extends Plugin keyManager.unregisterKeyListener(inputListener); removeShiftClickCustomizationMenus(); configuringShiftClick = false; + clientThread.invoke(this::resetItemCompositionCache); } @Subscribe @@ -291,7 +316,6 @@ public class MenuEntrySwapperPlugin extends Plugin if (option.equals(RESET) && target.equals(MENU_TARGET)) { unsetSwapConfig(itemId); - itemComposition.resetShiftClickActionIndex(); return; } @@ -324,7 +348,6 @@ public class MenuEntrySwapperPlugin extends Plugin if (valid) { setSwapConfig(itemId, index); - itemComposition.setShiftClickActionIndex(index); } } From 9030a7eb6a20971db81b27e19f8ac1d76046c4fc Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 13 Feb 2019 16:24:09 +0100 Subject: [PATCH 056/304] Normalize CoX CM naming from boss long and chat message Signed-off-by: Tomas Slusny --- .../client/plugins/chatcommands/ChatCommandsPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 42a3a9baba..dbfd779673 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -299,7 +299,7 @@ public class ChatCommandsPlugin extends Plugin Widget boss = bossChildren[i]; Widget kill = killsChildren[i]; - String bossName = boss.getText(); + String bossName = boss.getText().replace(":", ""); int kc = Integer.parseInt(kill.getText().replace(",", "")); if (kc != getKc(bossName)) { From 0529d5d144f75ab36a642a354c53a20e7ef20478 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 13 Feb 2019 10:01:20 +0100 Subject: [PATCH 057/304] loottracker service: include time in loot record Signed-off-by: Tomas Slusny --- .../java/net/runelite/http/api/loottracker/LootRecord.java | 2 ++ .../http/service/loottracker/LootTrackerService.java | 4 ++-- .../client/plugins/loottracker/LootTrackerPlugin.java | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java index fb43a1605a..fc945220f1 100644 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java +++ b/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java @@ -24,6 +24,7 @@ */ package net.runelite.http.api.loottracker; +import java.time.Instant; import java.util.Collection; import lombok.AllArgsConstructor; import lombok.Data; @@ -37,4 +38,5 @@ public class LootRecord private String eventId; private LootRecordType type; private Collection drops; + private Instant time; } diff --git a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java index 86b7115a80..b999f4eabb 100644 --- a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java +++ b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java @@ -142,7 +142,7 @@ public class LootTrackerService { if (!gameItems.isEmpty()) { - LootRecord lootRecord = new LootRecord(current.getEventId(), current.getType(), gameItems); + LootRecord lootRecord = new LootRecord(current.getEventId(), current.getType(), gameItems, current.getTime()); lootRecords.add(lootRecord); gameItems = new ArrayList<>(); @@ -157,7 +157,7 @@ public class LootTrackerService if (!gameItems.isEmpty()) { - LootRecord lootRecord = new LootRecord(current.getEventId(), current.getType(), gameItems); + LootRecord lootRecord = new LootRecord(current.getEventId(), current.getType(), gameItems, current.getTime()); lootRecords.add(lootRecord); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index acb725db64..30d4a25ba5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -28,6 +28,7 @@ package net.runelite.client.plugins.loottracker; import com.google.inject.Provides; import java.awt.image.BufferedImage; import java.io.IOException; +import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -274,7 +275,7 @@ public class LootTrackerPlugin extends Plugin if (lootTrackerClient != null && config.saveLoot()) { - LootRecord lootRecord = new LootRecord(name, LootRecordType.NPC, toGameItems(items)); + LootRecord lootRecord = new LootRecord(name, LootRecordType.NPC, toGameItems(items), Instant.now()); lootTrackerClient.submit(lootRecord); } } @@ -291,7 +292,7 @@ public class LootTrackerPlugin extends Plugin if (lootTrackerClient != null && config.saveLoot()) { - LootRecord lootRecord = new LootRecord(name, LootRecordType.PLAYER, toGameItems(items)); + LootRecord lootRecord = new LootRecord(name, LootRecordType.PLAYER, toGameItems(items), Instant.now()); lootTrackerClient.submit(lootRecord); } } @@ -350,7 +351,7 @@ public class LootTrackerPlugin extends Plugin if (lootTrackerClient != null && config.saveLoot()) { - LootRecord lootRecord = new LootRecord(eventType, LootRecordType.EVENT, toGameItems(items)); + LootRecord lootRecord = new LootRecord(eventType, LootRecordType.EVENT, toGameItems(items), Instant.now()); lootTrackerClient.submit(lootRecord); } } From c012db502ee973a5a1ba3cf6e1b4681edd157a99 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 14 Feb 2019 11:54:12 +0000 Subject: [PATCH 058/304] [maven-release-plugin] prepare release runelite-parent-1.5.12 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index f4381ce9ae..67ec40ba7c 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 63450786f6..32add00114 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 947dd7b667..b2386f89b3 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 5ab155acba..0b2e8167be 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 081195944c..05163c3804 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 Web Service diff --git a/pom.xml b/pom.xml index 0c1f89dc1a..602a24ca63 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.12 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 551b441ed7..23e0b58191 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 5255e7bacb..8fff180967 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 903322a106..05b99540ce 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 6306dc3763..393b7840e1 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 2bbd0bb214..13fc541f53 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 5ce6ad3a0a..bc3531ffd3 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 10f3c0e190..131a8720a9 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12-SNAPSHOT + 1.5.12 net.runelite.rs From 1b50e24738ef22bf672a883faed334c1dd5571ed Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 14 Feb 2019 11:54:18 +0000 Subject: [PATCH 059/304] [maven-release-plugin] prepare for next development iteration --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 67ec40ba7c..21e66169bc 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 32add00114..0ea164ee8d 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index b2386f89b3..17a7524427 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 0b2e8167be..0829178ece 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 05163c3804..75e257d32d 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index 602a24ca63..44828e6d8e 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.12 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 23e0b58191..46d1cd9593 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 8fff180967..91084dfbe6 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 05b99540ce..34afe917d0 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 393b7840e1..3cb78ed8f2 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 13fc541f53..bd4ddb5801 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index bc3531ffd3..9b274b38f5 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 131a8720a9..03417c67e0 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.12 + 1.5.13-SNAPSHOT net.runelite.rs From 463e1d0da20d2386df5cb7d13d6f53ecfe417745 Mon Sep 17 00:00:00 2001 From: Will Thomas Date: Thu, 14 Feb 2019 18:56:21 +0000 Subject: [PATCH 060/304] screenshot plugin: Add Challenge Mode raid support Signed-off-by: Will Thomas --- .../plugins/screenshot/ScreenshotPlugin.java | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java index e4c6fd2ec9..ee78f3cc22 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java @@ -145,6 +145,8 @@ public class ScreenshotPlugin extends Plugin private Integer chambersOfXericNumber; + private Integer chambersOfXericChallengeNumber; + private Integer theatreOfBloodNumber; private boolean shouldTakeScreenshot; @@ -347,6 +349,16 @@ public class ScreenshotPlugin extends Plugin } } + if (chatMessage.startsWith("Your completed Chambers of Xeric Challenge Mode count is:")) + { + Matcher m = NUMBER_PATTERN.matcher(Text.removeTags(chatMessage)); + if (m.find()) + { + chambersOfXericChallengeNumber = Integer.valueOf(m.group()); + return; + } + } + if (chatMessage.startsWith("Your completed Theatre of Blood count is:")) { Matcher m = NUMBER_PATTERN.matcher(Text.removeTags(chatMessage)); @@ -453,14 +465,22 @@ public class ScreenshotPlugin extends Plugin } case CHAMBERS_OF_XERIC_REWARD_GROUP_ID: { - if (chambersOfXericNumber == null) + if (chambersOfXericNumber != null) + { + fileName = "Chambers of Xeric(" + chambersOfXericNumber + ")"; + chambersOfXericNumber = null; + break; + } + else if (chambersOfXericChallengeNumber != null) + { + fileName = "Chambers of Xeric Challenge Mode(" + chambersOfXericChallengeNumber + ")"; + chambersOfXericChallengeNumber = null; + break; + } + else { return; } - - fileName = "Chambers of Xeric(" + chambersOfXericNumber + ")"; - chambersOfXericNumber = null; - break; } case THEATRE_OF_BLOOD_REWARD_GROUP_ID: { @@ -720,6 +740,12 @@ public class ScreenshotPlugin extends Plugin return chambersOfXericNumber; } + @VisibleForTesting + int getChambersOfXericChallengeNumber() + { + return chambersOfXericChallengeNumber; + } + @VisibleForTesting int gettheatreOfBloodNumber() { From b7e0c689fcf7cfcb280ee9ebeee8b6eb8eaf91ec Mon Sep 17 00:00:00 2001 From: Minghan Li Date: Fri, 15 Feb 2019 07:01:44 -0500 Subject: [PATCH 061/304] Add new Kourend quests to world map plugin (#7864) --- .../runelite/client/plugins/worldmap/QuestStartLocation.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index 66dde6666b..c62eeaff15 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -30,6 +30,7 @@ import net.runelite.api.coords.WorldPoint; enum QuestStartLocation { + //Free Quests COOKS_ASSISTANT_RFD("Cook's Assistant", new WorldPoint(3211, 3216, 0)), THE_CORSAIR_CURSE("The Corsair Curse", new WorldPoint(3029, 3273, 0)), DEMON_SLAYER("Demon Slayer", new WorldPoint(3204, 3424, 0)), @@ -48,8 +49,11 @@ enum QuestStartLocation SHIELD_OF_ARRAV("Shield of Arrav", new WorldPoint(3208, 3495, 0)), VAMPIRE_SLAYER("Vampire Slayer", new WorldPoint(3096, 3266, 0)), WITCHS_POTION("Witch's Potion", new WorldPoint(2967, 3203, 0)), + + //Members' Quests ANIMAL_MAGNETISM("Animal Magnetism", new WorldPoint(3094, 3360, 0)), ANOTHER_SLICE_OF_HAM("Another Slice of H.A.M.", new WorldPoint(2799, 5428, 0)), + THE_ASCENT_OF_ARCEUUS("The Ascent of Arceuus", new WorldPoint(1700, 3742, 0)), BETWEEN_A_ROCK("Between a Rock...", new WorldPoint(2823, 10168, 0)), BIG_CHOMPY_BIRD_HUNTING("Big Chompy Bird Hunting", new WorldPoint(2629, 2981, 0)), BIOHAZARD("Biohazard", new WorldPoint(2591, 3335, 0)), @@ -84,6 +88,7 @@ enum QuestStartLocation FISHING_CONTEST_1("Fishing Contest", new WorldPoint(2875, 3483, 0)), FISHING_CONTEST_2("Fishing Contest", new WorldPoint(2820, 3487, 0)), FORGETTABLE_TALE("Forgettable Tale...", new WorldPoint(2826, 10215, 0)), + THE_FORSAKEN_TOWER("The Forsaken Tower", new WorldPoint(1484, 3747, 0)), THE_FREMENNIK_ISLES("The Fremennik Isles", new WorldPoint(2645, 3711, 0)), THE_FREMENNIK_TRIALS("The Fremennik Trials", new WorldPoint(2657, 3669, 0)), GARDEN_OF_TRANQUILLITY("Garden of Tranquillity", new WorldPoint(3227, 3477, 0)), From a0e61433e0f4377aa4f06019a0273cda830400ab Mon Sep 17 00:00:00 2001 From: Jaysc Date: Thu, 29 Nov 2018 22:57:52 +0000 Subject: [PATCH 062/304] Make color of hovered tile highlight configurable Signed-off-by: Tomas Slusny --- .../plugins/tileindicators/TileIndicatorsConfig.java | 11 +++++++++++ .../plugins/tileindicators/TileIndicatorsOverlay.java | 3 +-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java index 9d9cd96e69..9a5e0bad33 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java @@ -54,6 +54,17 @@ public interface TileIndicatorsConfig extends Config return true; } + @Alpha + @ConfigItem( + keyName = "highlightHoveredColor", + name = "Color of current hovered highlighting", + description = "Configures the highlight color of hovered tile" + ) + default Color highlightHoveredColor() + { + return new Color(0, 0, 0, 0); + } + @ConfigItem( keyName = "highlightHoveredTile", name = "Highlight hovered tile", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsOverlay.java index f92a76f6de..a9e983656d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsOverlay.java @@ -41,7 +41,6 @@ import net.runelite.client.ui.overlay.OverlayUtil; public class TileIndicatorsOverlay extends Overlay { - private static final Color EMPTY = new Color(0, 0, 0, 0); private final Client client; private final TileIndicatorsConfig config; @@ -75,7 +74,7 @@ public class TileIndicatorsOverlay extends Overlay // If we have tile "selected" render it if (client.getSelectedSceneTile() != null) { - renderTile(graphics, client.getSelectedSceneTile().getLocalLocation(), EMPTY); + renderTile(graphics, client.getSelectedSceneTile().getLocalLocation(), config.highlightHoveredColor()); } } From 8f1ef00c395d8bb764a4305d63f15ca8c75e2721 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Fri, 15 Feb 2019 21:04:22 +0100 Subject: [PATCH 063/304] Use default PanelComponent size in Cooking plugin So it is consistent with rest of plugins, mainly session ones. Signed-off-by: Tomas Slusny --- .../java/net/runelite/client/plugins/cooking/CookingOverlay.java | 1 - 1 file changed, 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingOverlay.java index af0a5a8b62..7e25f3ad31 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingOverlay.java @@ -78,7 +78,6 @@ class CookingOverlay extends Overlay return null; } - panelComponent.setPreferredSize(new Dimension(145, 0)); panelComponent.getChildren().clear(); if (isCooking() || Duration.between(session.getLastCookingAction(), Instant.now()).getSeconds() < COOK_TIMEOUT) From 6914d8806d93eb6abe39d121d773331ad5eb6afb Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Fri, 15 Feb 2019 21:37:26 +0100 Subject: [PATCH 064/304] Make party stats overlay consistent with other overlays - Remove invisible border - Add standard gap Signed-off-by: Tomas Slusny --- .../net/runelite/client/plugins/party/PartyStatsOverlay.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyStatsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyStatsOverlay.java index 2b9e1820f3..693b23cb89 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyStatsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyStatsOverlay.java @@ -27,6 +27,8 @@ package net.runelite.client.plugins.party; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; import java.util.Map; import java.util.UUID; import javax.inject.Inject; @@ -34,6 +36,7 @@ import net.runelite.api.MenuAction; import net.runelite.client.plugins.party.data.PartyData; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayMenuEntry; +import net.runelite.client.ui.overlay.components.ComponentConstants; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.ProgressBarComponent; import net.runelite.client.ui.overlay.components.TitleComponent; @@ -58,6 +61,8 @@ public class PartyStatsOverlay extends Overlay this.plugin = plugin; this.party = party; this.config = config; + body.setBorder(new Rectangle()); + body.setGap(new Point(0, ComponentConstants.STANDARD_BORDER / 2)); getMenuEntries().add(new OverlayMenuEntry(MenuAction.RUNELITE_OVERLAY, "Leave", "Party")); } From 5c546fd1d45cb50dddc02c753d4619f2a0913393 Mon Sep 17 00:00:00 2001 From: Robert <43491258+lyzrds@users.noreply.github.com> Date: Fri, 15 Feb 2019 16:17:58 -0600 Subject: [PATCH 065/304] Add support for third floor timer to Raids plugin (Challenge Mode) (#7871) --- .../client/plugins/raids/RaidsPlugin.java | 2 +- .../client/plugins/raids/RaidsTimer.java | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 72a386f5c7..d0c0d7c16c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -236,7 +236,7 @@ public class RaidsPlugin extends Plugin { if (timer != null) { - timer.timeFloor(); + timer.timeOlm(); timer.setStopped(true); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java index 8b40b09e10..8df3087054 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java @@ -41,6 +41,7 @@ public class RaidsTimer extends InfoBox private LocalTime time; private LocalTime firstFloorTime; private LocalTime secondFloorTime; + private LocalTime thirdFloorTime; private LocalTime olmTime; @Setter @@ -66,14 +67,20 @@ public class RaidsTimer extends InfoBox { secondFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); } - else if (olmTime == null) + else if (thirdFloorTime == null) { - olmTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); + thirdFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); } floorTime = Instant.now(); } + public void timeOlm() + { + Duration elapsed = Duration.between(floorTime, Instant.now()); + olmTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); + } + @Override public String getText() { @@ -126,6 +133,12 @@ public class RaidsTimer extends InfoBox builder.append(secondFloorTime.format(DateTimeFormatter.ofPattern("mm:ss"))); } + if (thirdFloorTime != null) + { + builder.append("
Third floor: "); + builder.append(thirdFloorTime.format(DateTimeFormatter.ofPattern("mm:ss"))); + } + if (olmTime != null) { builder.append("
Olm: "); From 56d583f70ab873980e4de92a5bbd0758c65636dc Mon Sep 17 00:00:00 2001 From: Usernamerino Date: Tue, 8 Jan 2019 23:26:39 +0100 Subject: [PATCH 066/304] Add chat command shorthand for challenge mode raids killcount --- .../plugins/chatcommands/ChatCommandsPlugin.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index dbfd779673..7295577e34 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -1089,6 +1089,7 @@ public class ChatCommandsPlugin extends Plugin case "barrows": return "Barrows Chests"; + // cox case "cox": case "xeric": case "chambers": @@ -1096,6 +1097,15 @@ public class ChatCommandsPlugin extends Plugin case "raids": return "Chambers of Xeric"; + // cox cm + case "cox cm": + case "xeric cm": + case "chambers cm": + case "olm cm": + case "raids cm": + return "Chambers of Xeric Challenge Mode"; + + // tob case "tob": case "theatre": case "verzik": From bc0ec093dc49b994a9eb0958af48c0d6fbbac85c Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 15 Feb 2019 21:04:42 -0500 Subject: [PATCH 067/304] xptracker: limit how often the same players are looked up Use player rank to set how often the same player is allowed to be looked up. Replace the ConcurrentLinkedDeque with a synchronized ArrayDeque which has a constant time size(). --- .../http/service/xp/XpTrackerService.java | 103 ++++++++++++++---- .../http/service/xp/beans/PlayerEntity.java | 2 + .../net/runelite/http/service/xp/schema.sql | 10 +- 3 files changed, 89 insertions(+), 26 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java index 391d37d1bf..5ef7e829e4 100644 --- a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java +++ b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java @@ -29,8 +29,8 @@ import com.google.common.hash.Funnels; import java.nio.charset.Charset; import java.time.Duration; import java.time.Instant; +import java.util.ArrayDeque; import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ExecutionException; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.hiscore.HiscoreEndpoint; @@ -50,8 +50,8 @@ import org.sql2o.Sql2o; @Slf4j public class XpTrackerService { - private static final int QUEUE_LIMIT = 100_000; - private static final Duration UPDATE_TIME = Duration.ofMinutes(5); + private static final int QUEUE_LIMIT = 32768; + private static final int BLOOMFILTER_EXPECTED_INSERTIONS = 100_000; @Autowired @Qualifier("Runelite XP Tracker SQL2O") @@ -60,7 +60,7 @@ public class XpTrackerService @Autowired private HiscoreService hiscoreService; - private final Queue usernameUpdateQueue = new ConcurrentLinkedDeque<>(); + private final Queue usernameUpdateQueue = new ArrayDeque<>(); private BloomFilter usernameFilter = createFilter(); public void update(String username) throws ExecutionException @@ -76,13 +76,37 @@ public class XpTrackerService return; } - if (usernameUpdateQueue.size() >= QUEUE_LIMIT) + try (Connection con = sql2o.open()) { - log.warn("Username update queue is full ({})", QUEUE_LIMIT); - return; + PlayerEntity playerEntity = findOrCreatePlayer(con, username); + Duration frequency = updateFrequency(playerEntity); + Instant now = Instant.now(); + Duration timeSinceLastUpdate = Duration.between(playerEntity.getLast_updated(), now); + if (timeSinceLastUpdate.toMillis() < frequency.toMillis()) + { + log.debug("User {} updated too recently", username); + usernameFilter.put(username); + return; + } + + synchronized (usernameUpdateQueue) + { + if (usernameUpdateQueue.size() >= QUEUE_LIMIT) + { + log.warn("Username update queue is full ({})", QUEUE_LIMIT); + return; + } + } + + con.createQuery("update player set last_updated = CURRENT_TIMESTAMP where id = :id") + .addParameter("id", playerEntity.getId()) + .executeUpdate(); } - usernameUpdateQueue.add(username); + synchronized (usernameUpdateQueue) + { + usernameUpdateQueue.add(username); + } usernameFilter.put(username); } @@ -104,13 +128,6 @@ public class XpTrackerService log.debug("Hiscore for {} already up to date", username); return; } - - Duration difference = Duration.between(currentXp.getTime(), now); - if (difference.compareTo(UPDATE_TIME) <= 0) - { - log.debug("Updated {} too recently", username); - return; - } } con.createQuery("insert into xp (player,attack_xp,defence_xp,strength_xp,hitpoints_xp,ranged_xp,prayer_xp,magic_xp,cooking_xp,woodcutting_xp," @@ -172,6 +189,11 @@ public class XpTrackerService .addParameter("construction_rank", hiscoreResult.getConstruction().getRank()) .addParameter("overall_rank", hiscoreResult.getOverall().getRank()) .executeUpdate(); + + con.createQuery("update player set rank = :rank where id = :id") + .addParameter("id", playerEntity.getId()) + .addParameter("rank", hiscoreResult.getOverall().getRank()) + .executeUpdate(); } } @@ -197,6 +219,7 @@ public class XpTrackerService playerEntity.setId(id); playerEntity.setName(username); playerEntity.setTracked_since(now); + playerEntity.setLast_updated(now); return playerEntity; } @@ -220,18 +243,21 @@ public class XpTrackerService @Scheduled(fixedDelay = 1000) public void update() throws ExecutionException { - String next = usernameUpdateQueue.poll(); + String next; + synchronized (usernameUpdateQueue) + { + next = usernameUpdateQueue.poll(); + } if (next == null) { return; } - HiscoreResult hiscoreResult = hiscoreService.lookupUsername(next, HiscoreEndpoint.NORMAL); - update(next, hiscoreResult); + update(next); } - @Scheduled(fixedDelay = 3 * 60 * 60 * 1000) // 3 hours + @Scheduled(fixedDelay = 6 * 60 * 60 * 1000) // 6 hours public void clearFilter() { usernameFilter = createFilter(); @@ -241,14 +267,47 @@ public class XpTrackerService { final BloomFilter filter = BloomFilter.create( Funnels.stringFunnel(Charset.defaultCharset()), - 100_000 + BLOOMFILTER_EXPECTED_INSERTIONS ); - for (String toUpdate : usernameUpdateQueue) + synchronized (usernameUpdateQueue) { - filter.put(toUpdate); + for (String toUpdate : usernameUpdateQueue) + { + filter.put(toUpdate); + } } return filter; } + + /** + * scale how often to check hiscore updates for players based on their rank + * @param playerEntity + * @return + */ + private static Duration updateFrequency(PlayerEntity playerEntity) + { + Integer rank = playerEntity.getRank(); + if (rank == null) + { + return Duration.ofDays(7); + } + else if (rank < 10_000) + { + return Duration.ofHours(6); + } + else if (rank < 50_000) + { + return Duration.ofDays(2); + } + else if (rank < 100_000) + { + return Duration.ofDays(5); + } + else + { + return Duration.ofDays(7); + } + } } diff --git a/http-service/src/main/java/net/runelite/http/service/xp/beans/PlayerEntity.java b/http-service/src/main/java/net/runelite/http/service/xp/beans/PlayerEntity.java index d07d1d4640..11bec532d7 100644 --- a/http-service/src/main/java/net/runelite/http/service/xp/beans/PlayerEntity.java +++ b/http-service/src/main/java/net/runelite/http/service/xp/beans/PlayerEntity.java @@ -33,4 +33,6 @@ public class PlayerEntity private Integer id; private String name; private Instant tracked_since; + private Instant last_updated; + private Integer rank; } diff --git a/http-service/src/main/resources/net/runelite/http/service/xp/schema.sql b/http-service/src/main/resources/net/runelite/http/service/xp/schema.sql index ba4c395d62..70f83a30fd 100644 --- a/http-service/src/main/resources/net/runelite/http/service/xp/schema.sql +++ b/http-service/src/main/resources/net/runelite/http/service/xp/schema.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.16 Distrib 10.2.9-MariaDB, for Linux (x86_64) +-- MySQL dump 10.16 Distrib 10.2.18-MariaDB, for Linux (x86_64) -- -- Host: localhost Database: xptracker -- ------------------------------------------------------ --- Server version 10.2.9-MariaDB +-- Server version 10.2.18-MariaDB /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -26,6 +26,8 @@ CREATE TABLE `player` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `tracked_since` timestamp NOT NULL DEFAULT current_timestamp(), + `last_updated` timestamp NOT NULL DEFAULT current_timestamp(), + `rank` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; @@ -116,7 +118,7 @@ CREATE TABLE `xp` ( `overall_rank` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `player_time` (`player`,`time`), - INDEX `idx_time` (`time`), + KEY `idx_time` (`time`), CONSTRAINT `fk_player` FOREIGN KEY (`player`) REFERENCES `player` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -130,4 +132,4 @@ CREATE TABLE `xp` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-01-20 18:37:09 +-- Dump completed on 2019-02-15 21:01:17 \ No newline at end of file From 60e17c2ac160ff4bb193f8d2064d31a8df82dd47 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sat, 16 Feb 2019 04:43:03 +0100 Subject: [PATCH 068/304] Log only exception message on feed lookup failures Seeing same exceptions over and over again is not very useful, mainly when their stacktraces are not useful too. Signed-off-by: Tomas Slusny --- .../java/net/runelite/http/service/feed/FeedController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/feed/FeedController.java b/http-service/src/main/java/net/runelite/http/service/feed/FeedController.java index 8b55d1b93a..fa641d3714 100644 --- a/http-service/src/main/java/net/runelite/http/service/feed/FeedController.java +++ b/http-service/src/main/java/net/runelite/http/service/feed/FeedController.java @@ -71,7 +71,7 @@ public class FeedController } catch (IOException e) { - log.warn(null, e); + log.warn(e.getMessage()); } try @@ -80,7 +80,7 @@ public class FeedController } catch (IOException e) { - log.warn(null, e); + log.warn(e.getMessage()); } try @@ -89,7 +89,7 @@ public class FeedController } catch (IOException e) { - log.warn(null, e); + log.warn(e.getMessage()); } feedResult = new FeedResult(items); From e8019d0517e577ffbacfea3ce1062dd75754e8de Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sat, 16 Feb 2019 03:56:33 +0100 Subject: [PATCH 069/304] Null-check cache when getting items in http service It is not very useful exception and cache entry is null-checked everywhere else. Replace the exception with simple warning in logs. Signed-off-by: Tomas Slusny --- .../java/net/runelite/http/service/cache/CacheService.java | 6 ++++++ .../java/net/runelite/http/service/item/ItemService.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/http-service/src/main/java/net/runelite/http/service/cache/CacheService.java b/http-service/src/main/java/net/runelite/http/service/cache/CacheService.java index 882e90c460..e0fca4ac21 100644 --- a/http-service/src/main/java/net/runelite/http/service/cache/CacheService.java +++ b/http-service/src/main/java/net/runelite/http/service/cache/CacheService.java @@ -41,6 +41,7 @@ import java.io.InputStream; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import lombok.extern.slf4j.Slf4j; import net.runelite.cache.ConfigType; @@ -233,6 +234,11 @@ public class CacheService public List getItems() throws IOException { CacheEntry cache = findMostRecent(); + if (cache == null) + { + return Collections.emptyList(); + } + IndexEntry indexEntry = findIndexForCache(cache, IndexType.CONFIGS.getNumber()); ArchiveEntry archiveEntry = findArchiveForIndex(indexEntry, ConfigType.ITEM.getId()); ArchiveFiles archiveFiles = getArchiveFiles(archiveEntry); diff --git a/http-service/src/main/java/net/runelite/http/service/item/ItemService.java b/http-service/src/main/java/net/runelite/http/service/item/ItemService.java index 2da7a50028..32569b0517 100644 --- a/http-service/src/main/java/net/runelite/http/service/item/ItemService.java +++ b/http-service/src/main/java/net/runelite/http/service/item/ItemService.java @@ -489,10 +489,16 @@ public class ItemService public void reloadItems() throws IOException { List items = cacheService.getItems(); + if (items.isEmpty()) + { + log.warn("Failed to load any items from cache, item price updating will be disabled"); + } + tradeableItems = items.stream() .filter(item -> item.isTradeable) .mapToInt(item -> item.id) .toArray(); + log.debug("Loaded {} tradeable items", tradeableItems.length); } From bd9dfb17308e84b11a140f3bad899a7cedbdc996 Mon Sep 17 00:00:00 2001 From: Nokkasiili <46995454+Nokkasiili@users.noreply.github.com> Date: Sat, 16 Feb 2019 22:05:43 +0200 Subject: [PATCH 070/304] Add X Marks the Spot quest to world map plugin (#7877) --- .../net/runelite/client/plugins/worldmap/QuestStartLocation.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index c62eeaff15..c1d9e9fb88 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -49,6 +49,7 @@ enum QuestStartLocation SHIELD_OF_ARRAV("Shield of Arrav", new WorldPoint(3208, 3495, 0)), VAMPIRE_SLAYER("Vampire Slayer", new WorldPoint(3096, 3266, 0)), WITCHS_POTION("Witch's Potion", new WorldPoint(2967, 3203, 0)), + X_MARKS_THE_SPOT("X Marks the Spot", new WorldPoint(3227, 3242, 0)), //Members' Quests ANIMAL_MAGNETISM("Animal Magnetism", new WorldPoint(3094, 3360, 0)), From 19a2f7f5653c366e247ef6df70e775f9cfafda74 Mon Sep 17 00:00:00 2001 From: Desetude Date: Thu, 14 Feb 2019 14:50:32 +0000 Subject: [PATCH 071/304] Use xdg-open for link browsing on Linux --- .../net/runelite/client/util/LinkBrowser.java | 55 +++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/util/LinkBrowser.java b/runelite-client/src/main/java/net/runelite/client/util/LinkBrowser.java index 173a383bbe..194b1974b2 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/LinkBrowser.java +++ b/runelite-client/src/main/java/net/runelite/client/util/LinkBrowser.java @@ -43,6 +43,8 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class LinkBrowser { + private static boolean shouldAttemptXdg = OSType.getOSType() == OSType.Linux; + /** * Tries to navigate to specified URL in browser. In case operation fails, displays message box with message * and copies link to clipboard to navigate to. @@ -56,9 +58,55 @@ public class LinkBrowser return false; } + if (attemptDesktopBrowse(url)) + { + log.debug("Opened browser through Desktop#browse to {}", url); + return true; + } + + if (shouldAttemptXdg && attemptXdgOpen(url)) + { + log.debug("Opened browser through xdg-open to {}", url); + return true; + } + + showMessageBox("Unable to open link. Press 'OK' and link will be copied to your clipboard.", url); + return false; + } + + private static boolean attemptXdgOpen(String url) + { + try + { + final Process exec = Runtime.getRuntime().exec(new String[]{"xdg-open", url}); + exec.waitFor(); + + final int ret = exec.exitValue(); + if (ret == 0) + { + return true; + } + + log.warn("xdg-open {} returned with error code {}", url, ret); + return false; + } + catch (IOException ex) + { + // xdg-open not found + shouldAttemptXdg = false; + return false; + } + catch (InterruptedException ex) + { + log.warn("Interrupted while waiting for xdg-open {} to execute", url); + return false; + } + } + + private static boolean attemptDesktopBrowse(String url) + { if (!Desktop.isDesktopSupported()) { - showMessageBox("Desktop is not supported. Press 'OK' and link will be copied to your clipboard.", url); return false; } @@ -66,20 +114,17 @@ public class LinkBrowser if (!desktop.isSupported(Desktop.Action.BROWSE)) { - showMessageBox("Desktop browser is not supported. Press 'OK' and link will be copied to your clipboard.", url); return false; } try { desktop.browse(new URI(url)); - log.debug("Opened browser to {}", url); return true; } catch (IOException | URISyntaxException ex) { - log.warn("Unable to open URL {}. Error: {}", url, ex); - showMessageBox("Unable to open a URL. Press 'OK' and link will be copied to your clipboard.", url); + log.warn("Failed to open Desktop#browser {}", url, ex); return false; } } From af9733f2e20d344905fd3c2fb9278263c0e6b932 Mon Sep 17 00:00:00 2001 From: Ron Young Date: Thu, 24 Jan 2019 21:52:56 -0600 Subject: [PATCH 072/304] ChatboxTextInput: rename this.cursor to this.cursorStart --- .../client/game/chatbox/ChatboxTextInput.java | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java index 848f461288..3300002c4d 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java @@ -40,14 +40,14 @@ import java.util.function.ToIntFunction; import javax.swing.SwingUtilities; import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import net.runelite.api.FontTypeFace; import net.runelite.api.FontID; -import net.runelite.api.widgets.WidgetType; +import net.runelite.api.FontTypeFace; import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetPositionMode; import net.runelite.api.widgets.WidgetSizeMode; import net.runelite.api.widgets.WidgetTextAlignment; +import net.runelite.api.widgets.WidgetType; import net.runelite.client.callback.ClientThread; import net.runelite.client.input.KeyListener; import net.runelite.client.input.MouseListener; @@ -72,7 +72,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse private StringBuffer value = new StringBuffer(); @Getter - private int cursor = 0; + private int cursorStart = 0; @Getter private int cursorEnd = 0; @@ -158,7 +158,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse end = v; } - this.cursor = start; + this.cursorStart = start; this.cursorEnd = end; if (built) @@ -234,8 +234,8 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse { Widget container = chatboxPanelManager.getContainerWidget(); - String lt = Text.escapeJagex(value.substring(0, this.cursor)); - String mt = Text.escapeJagex(value.substring(this.cursor, this.cursorEnd)); + String lt = Text.escapeJagex(value.substring(0, this.cursorStart)); + String mt = Text.escapeJagex(value.substring(this.cursorStart, this.cursorEnd)); String rt = Text.escapeJagex(value.substring(this.cursorEnd)); Widget leftText = container.createChild(-1, WidgetType.TEXT); @@ -399,12 +399,12 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse char c = e.getKeyChar(); if (charValidator.test(c)) { - if (cursor != cursorEnd) + if (cursorStart != cursorEnd) { - value.delete(cursor, cursorEnd); + value.delete(cursorStart, cursorEnd); } - value.insert(cursor, c); - cursorAt(cursor + 1); + value.insert(cursorStart, c); + cursorAt(cursorStart + 1); if (onChanged != null) { onChanged.accept(getValue()); @@ -422,13 +422,13 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse { case KeyEvent.VK_X: case KeyEvent.VK_C: - if (cursor != cursorEnd) + if (cursorStart != cursorEnd) { - String s = value.substring(cursor, cursorEnd); + String s = value.substring(cursorStart, cursorEnd); if (code == KeyEvent.VK_X) { - value.delete(cursor, cursorEnd); - cursorAt(cursor); + value.delete(cursorStart, cursorEnd); + cursorAt(cursorStart); } Toolkit.getDefaultToolkit() .getSystemClipboard() @@ -442,20 +442,20 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse .getSystemClipboard() .getData(DataFlavor.stringFlavor) .toString(); - if (cursor != cursorEnd) + if (cursorStart != cursorEnd) { - value.delete(cursor, cursorEnd); + value.delete(cursorStart, cursorEnd); } for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (charValidator.test(ch)) { - value.insert(cursor, ch); - cursor++; + value.insert(cursorStart, ch); + cursorStart++; } } - cursorAt(cursor); + cursorAt(cursorStart); if (onChanged != null) { onChanged.accept(getValue()); @@ -469,13 +469,13 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse } return; } - int newPos = cursor; + int newPos = cursorStart; if (ev.isShiftDown()) { if (selectionEnd == -1 || selectionStart == -1) { - selectionStart = cursor; - selectionEnd = cursor; + selectionStart = cursorStart; + selectionEnd = cursorStart; } newPos = selectionEnd; } @@ -487,20 +487,20 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse switch (code) { case KeyEvent.VK_DELETE: - if (cursor != cursorEnd) + if (cursorStart != cursorEnd) { - value.delete(cursor, cursorEnd); - cursorAt(cursor); + value.delete(cursorStart, cursorEnd); + cursorAt(cursorStart); if (onChanged != null) { onChanged.accept(getValue()); } return; } - if (cursor < value.length()) + if (cursorStart < value.length()) { - value.deleteCharAt(cursor); - cursorAt(cursor); + value.deleteCharAt(cursorStart); + cursorAt(cursorStart); if (onChanged != null) { onChanged.accept(getValue()); @@ -508,20 +508,20 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse } return; case KeyEvent.VK_BACK_SPACE: - if (cursor != cursorEnd) + if (cursorStart != cursorEnd) { - value.delete(cursor, cursorEnd); - cursorAt(cursor); + value.delete(cursorStart, cursorEnd); + cursorAt(cursorStart); if (onChanged != null) { onChanged.accept(getValue()); } return; } - if (cursor > 0) + if (cursorStart > 0) { - value.deleteCharAt(cursor - 1); - cursorAt(cursor - 1); + value.deleteCharAt(cursorStart - 1); + cursorAt(cursorStart - 1); if (onChanged != null) { onChanged.accept(getValue()); @@ -554,9 +554,9 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse return; case KeyEvent.VK_ESCAPE: ev.consume(); - if (cursor != cursorEnd) + if (cursorStart != cursorEnd) { - cursorAt(cursor); + cursorAt(cursorStart); return; } chatboxPanelManager.close(); @@ -603,7 +603,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse } if (isInBounds == null || !isInBounds.test(mouseEvent)) { - if (cursor != cursorEnd) + if (cursorStart != cursorEnd) { selectionStart = -1; selectionEnd = -1; From b7a4033712c10386539edbcfbbd273118c73501b Mon Sep 17 00:00:00 2001 From: Ron Young Date: Fri, 25 Jan 2019 00:18:49 -0600 Subject: [PATCH 073/304] ChatboxTextInput: support line wrapping --- .../client/game/chatbox/ChatboxTextInput.java | 302 +++++++++++++----- 1 file changed, 217 insertions(+), 85 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java index 3300002c4d..193e5667e9 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java @@ -24,7 +24,10 @@ */ package net.runelite.client.game.chatbox; +import com.google.common.base.Strings; +import com.google.common.primitives.Ints; import com.google.inject.Inject; +import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; @@ -33,11 +36,15 @@ import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.function.Consumer; import java.util.function.IntPredicate; import java.util.function.Predicate; import java.util.function.ToIntFunction; +import java.util.regex.Pattern; import javax.swing.SwingUtilities; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.FontID; @@ -57,6 +64,7 @@ import net.runelite.client.util.Text; public class ChatboxTextInput extends ChatboxInput implements KeyListener, MouseListener { private static final int CURSOR_FLASH_RATE_MILLIS = 1000; + private static final Pattern BREAK_MATCHER = Pattern.compile("[^a-zA-Z0-9']"); private final ChatboxPanelManager chatboxPanelManager; private final ClientThread clientThread; @@ -66,9 +74,20 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse return i -> i >= 32 && i < 127; } + @AllArgsConstructor + private static class Line + { + private final int start; + private final int end; + private final String text; + } + @Getter private String prompt; + @Getter + private int lines; + private StringBuffer value = new StringBuffer(); @Getter @@ -98,9 +117,9 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse @Getter private boolean built = false; - // This is a lambda so I can have atomic updates for it's captures - private ToIntFunction getCharOffset = null; + // These are lambdas for atomic updates private Predicate isInBounds = null; + private ToIntFunction getCharOffset = null; @Inject protected ChatboxTextInput(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread) @@ -109,6 +128,16 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse this.clientThread = clientThread; } + public ChatboxTextInput lines(int lines) + { + this.lines = lines; + if (built) + { + clientThread.invoke(this::update); + } + return this; + } + public ChatboxTextInput prompt(String prompt) { this.prompt = prompt; @@ -232,103 +261,209 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse protected void buildEdit(int x, int y, int w, int h) { + final List editLines = new ArrayList<>(); + Widget container = chatboxPanelManager.getContainerWidget(); - String lt = Text.escapeJagex(value.substring(0, this.cursorStart)); - String mt = Text.escapeJagex(value.substring(this.cursorStart, this.cursorEnd)); - String rt = Text.escapeJagex(value.substring(this.cursorEnd)); - - Widget leftText = container.createChild(-1, WidgetType.TEXT); - Widget cursor = container.createChild(-1, WidgetType.RECTANGLE); - Widget middleText = container.createChild(-1, WidgetType.TEXT); - Widget rightText = container.createChild(-1, WidgetType.TEXT); - - leftText.setFontId(fontID); - FontTypeFace font = leftText.getFont(); + final Widget cursor = container.createChild(-1, WidgetType.RECTANGLE); + long start = System.currentTimeMillis(); + cursor.setOnTimerListener((JavaScriptCallback) ev -> + { + boolean on = (System.currentTimeMillis() - start) % CURSOR_FLASH_RATE_MILLIS > (CURSOR_FLASH_RATE_MILLIS / 2); + cursor.setOpacity(on ? 255 : 0); + }); + cursor.setTextColor(0xFFFFFF); + cursor.setHasListener(true); + cursor.setFilled(true); + cursor.setFontId(fontID); + FontTypeFace font = cursor.getFont(); if (h <= 0) { h = font.getBaseline(); } - int ltw = font.getTextWidth(lt); - int mtw = font.getTextWidth(mt); - int rtw = font.getTextWidth(rt); + final int oy = y; + final int ox = x; + final int oh = h; - int fullWidth = ltw + mtw + rtw; - - int ox = x; - if (w > 0) + int breakIndex = -1; + final StringBuilder sb = new StringBuilder(); + for (int i = 0; i < value.length(); i++) { - x += (w - fullWidth) / 2; - } - - int ltx = x; - int mtx = ltx + ltw; - int rtx = mtx + mtw; - - leftText.setText(lt); - leftText.setOriginalX(ltx); - leftText.setOriginalY(y); - leftText.setOriginalWidth(ltw); - leftText.setOriginalHeight(h); - leftText.revalidate(); - - if (!mt.isEmpty()) - { - cursor.setTextColor(0x113399); - } - else - { - cursor.setTextColor(0xFFFFFF); - long start = System.currentTimeMillis(); - cursor.setOnTimerListener((JavaScriptCallback) ev -> + int count = i - sb.length(); + final String c = value.charAt(i) + ""; + sb.append(c); + if (BREAK_MATCHER.matcher(c).matches()) { - boolean on = (System.currentTimeMillis() - start) % CURSOR_FLASH_RATE_MILLIS > (CURSOR_FLASH_RATE_MILLIS / 2); - cursor.setOpacity(on ? 255 : 0); - }); - cursor.setHasListener(true); + breakIndex = sb.length(); + } + + if (i == value.length() - 1) + { + Line line = new Line(count, count + sb.length() - 1, sb.toString()); + editLines.add(line); + break; + } + + if (font.getTextWidth(sb.toString() + value.charAt(i + 1)) < w) + { + continue; + } + + if (editLines.size() < this.lines - 1 || this.lines == 0) + { + if (breakIndex > 1) + { + String str = sb.substring(0, breakIndex); + Line line = new Line(count, count + str.length() - 1, str); + editLines.add(line); + + sb.replace(0, breakIndex, ""); + breakIndex = -1; + continue; + } + + Line line = new Line(count, count + sb.length() - 1, sb.toString()); + editLines.add(line); + sb.replace(0, sb.length(), ""); + } } - cursor.setFilled(true); - cursor.setOriginalX(mtx - 1); - cursor.setOriginalY(y); - cursor.setOriginalWidth(2 + mtw); - cursor.setOriginalHeight(h); - cursor.revalidate(); - middleText.setText(mt); - middleText.setFontId(fontID); - middleText.setOriginalX(mtx); - middleText.setOriginalY(y); - middleText.setOriginalWidth(mtw); - middleText.setOriginalHeight(h); - middleText.setTextColor(0xFFFFFF); - middleText.revalidate(); + Rectangle bounds = new Rectangle(container.getCanvasLocation().getX() + container.getWidth(), y, 0, editLines.size() * oh); + for (int i = 0; i < editLines.size() || i == 0; i++) + { + final Line line = editLines.size() > 0 ? editLines.get(i) : new Line(0, 0, ""); + final String text = line.text; + final int len = text.length(); - rightText.setText(rt); - rightText.setFontId(fontID); - rightText.setOriginalX(rtx); - rightText.setOriginalY(y); - rightText.setOriginalWidth(rtw); - rightText.setOriginalHeight(h); - rightText.revalidate(); + String lt = Text.escapeJagex(text); + String mt = ""; + String rt = ""; + + final boolean isStartLine = cursorOnLine(cursorStart, line.start, line.end) + || (cursorOnLine(cursorStart, line.start, line.end + 1) && i == editLines.size() - 1); + + final boolean isEndLine = cursorOnLine(cursorEnd, line.start, line.end); + + if (isStartLine || isEndLine || (cursorEnd > line.end && cursorStart < line.start)) + { + final int cIdx = Ints.constrainToRange(cursorStart - line.start, 0, len); + final int ceIdx = Ints.constrainToRange(cursorEnd - line.start, 0, len); + + lt = Text.escapeJagex(text.substring(0, cIdx)); + mt = Text.escapeJagex(text.substring(cIdx, ceIdx)); + rt = Text.escapeJagex(text.substring(ceIdx)); + } + + final int ltw = font.getTextWidth(lt); + final int mtw = font.getTextWidth(mt); + final int rtw = font.getTextWidth(rt); + final int fullWidth = ltw + mtw + rtw; + + int ltx = ox; + if (w > 0) + { + ltx += (w - fullWidth) / 2; + } + + final int mtx = ltx + ltw; + final int rtx = mtx + mtw; + + if (ltx < bounds.x) + { + bounds.setLocation(ltx, bounds.y); + } + + if (fullWidth > bounds.width) + { + bounds.setSize(fullWidth, bounds.height); + } + + if (editLines.size() == 0 || isStartLine) + { + cursor.setOriginalX(mtx - 1); + cursor.setOriginalY(y); + cursor.setOriginalWidth(2); + cursor.setOriginalHeight(h); + cursor.revalidate(); + } + + if (!Strings.isNullOrEmpty(lt)) + { + final Widget leftText = container.createChild(-1, WidgetType.TEXT); + leftText.setFontId(fontID); + leftText.setText(lt); + leftText.setOriginalX(ltx); + leftText.setOriginalY(y); + leftText.setOriginalWidth(ltw); + leftText.setOriginalHeight(h); + leftText.revalidate(); + } + + if (!Strings.isNullOrEmpty(mt)) + { + final Widget background = container.createChild(-1, WidgetType.RECTANGLE); + background.setTextColor(0x113399); + background.setFilled(true); + background.setOriginalX(mtx - 1); + background.setOriginalY(y); + background.setOriginalWidth(2 + mtw); + background.setOriginalHeight(h); + background.revalidate(); + + final Widget middleText = container.createChild(-1, WidgetType.TEXT); + middleText.setText(mt); + middleText.setFontId(fontID); + middleText.setOriginalX(mtx); + middleText.setOriginalY(y); + middleText.setOriginalWidth(mtw); + middleText.setOriginalHeight(h); + middleText.setTextColor(0xFFFFFF); + middleText.revalidate(); + } + + if (!Strings.isNullOrEmpty(rt)) + { + final Widget rightText = container.createChild(-1, WidgetType.TEXT); + rightText.setText(rt); + rightText.setFontId(fontID); + rightText.setOriginalX(rtx); + rightText.setOriginalY(y); + rightText.setOriginalWidth(rtw); + rightText.setOriginalHeight(h); + rightText.revalidate(); + } + + y += h; + } net.runelite.api.Point ccl = container.getCanvasLocation(); - int canvasX = ltx + ccl.getX(); - Rectangle bounds = new Rectangle(ccl.getX() + ox, ccl.getY() + y, w > 0 ? w : fullWidth, h); - String tsValue = value.toString(); - isInBounds = ev -> bounds.contains(ev.getPoint()); + isInBounds = ev -> bounds.contains(new Point(ev.getX() - ccl.getX(), ev.getY() - ccl.getY())); getCharOffset = ev -> { - if (fullWidth <= 0) + if (bounds.width <= 0) { return 0; } - int cx = ev.getX() - canvasX; + int cx = ev.getX() - ccl.getX() - ox; + int cy = ev.getY() - ccl.getY() - oy; - int charIndex = (tsValue.length() * cx) / fullWidth; + int currentLine = Ints.constrainToRange(cy / oh, 0, editLines.size() - 1); + + final Line line = editLines.get(currentLine); + final String tsValue = line.text; + int charIndex = tsValue.length(); + int fullWidth = font.getTextWidth(tsValue); + + int tx = ox; + if (w > 0) + { + tx += (w - fullWidth) / 2; + } + cx -= tx; // `i` is used to track max execution time incase there is a font with ligature width data that causes this to fail for (int i = tsValue.length(); i >= 0 && charIndex >= 0 && charIndex <= tsValue.length(); i--) @@ -353,19 +488,16 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse break; } - if (charIndex < 0) - { - charIndex = 0; - } - if (charIndex > tsValue.length()) - { - charIndex = tsValue.length(); - } - - return charIndex; + charIndex = Ints.constrainToRange(charIndex, 0, tsValue.length()); + return line.start + charIndex; }; } + private boolean cursorOnLine(final int cursor, final int start, final int end) + { + return (cursor >= start) && (cursor <= end); + } + @Override protected void open() { From d7eb3fec36a218d2043e66ffea665412f087fc76 Mon Sep 17 00:00:00 2001 From: Ron Young Date: Fri, 25 Jan 2019 00:19:16 -0600 Subject: [PATCH 074/304] ChatboxTextInput: support moving between lines with up/down keys --- .../client/game/chatbox/ChatboxTextInput.java | 75 +++++++++++++++++-- 1 file changed, 68 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java index 193e5667e9..e59e47059d 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java @@ -119,7 +119,8 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse // These are lambdas for atomic updates private Predicate isInBounds = null; - private ToIntFunction getCharOffset = null; + private ToIntFunction getLineOffset = null; + private ToIntFunction getPointCharOffset = null; @Inject protected ChatboxTextInput(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread) @@ -441,15 +442,15 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse net.runelite.api.Point ccl = container.getCanvasLocation(); isInBounds = ev -> bounds.contains(new Point(ev.getX() - ccl.getX(), ev.getY() - ccl.getY())); - getCharOffset = ev -> + getPointCharOffset = p -> { if (bounds.width <= 0) { return 0; } - int cx = ev.getX() - ccl.getX() - ox; - int cy = ev.getY() - ccl.getY() - oy; + int cx = p.x - ccl.getX() - ox; + int cy = p.y - ccl.getY() - oy; int currentLine = Ints.constrainToRange(cy / oh, 0, editLines.size() - 1); @@ -491,6 +492,48 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse charIndex = Ints.constrainToRange(charIndex, 0, tsValue.length()); return line.start + charIndex; }; + + getLineOffset = code -> + { + if (editLines.size() < 2) + { + return cursorStart; + } + + int currentLine = -1; + for (int i = 0; i < editLines.size(); i++) + { + Line l = editLines.get(i); + if (cursorOnLine(cursorStart, l.start, l.end) + || (cursorOnLine(cursorStart, l.start, l.end + 1) && i == editLines.size() - 1)) + { + currentLine = i; + break; + } + } + + if (currentLine == -1 + || (code == KeyEvent.VK_UP && currentLine == 0) + || (code == KeyEvent.VK_DOWN && currentLine == editLines.size() - 1)) + { + return cursorStart; + } + + final Line line = editLines.get(currentLine); + final int direction = code == KeyEvent.VK_UP ? -1 : 1; + final Point dest = new Point(cursor.getCanvasLocation().getX(), cursor.getCanvasLocation().getY() + (direction * oh)); + final int charOffset = getPointCharOffset.applyAsInt(dest); + + // Place cursor on right line if whitespace keep it on the same line or skip a line + final Line nextLine = editLines.get(currentLine + direction); + if ((direction == -1 && charOffset >= line.start) + || (direction == 1 && (charOffset > nextLine.end && (currentLine + direction != editLines.size() - 1)))) + { + return nextLine.end; + } + + return charOffset; + }; } private boolean cursorOnLine(final int cursor, final int start, final int end) @@ -498,6 +541,16 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse return (cursor >= start) && (cursor <= end); } + private int getCharOffset(MouseEvent ev) + { + if (getPointCharOffset == null) + { + return 0; + } + + return getPointCharOffset.applyAsInt(ev.getPoint()); + } + @Override protected void open() { @@ -668,6 +721,14 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse ev.consume(); newPos++; break; + case KeyEvent.VK_UP: + ev.consume(); + newPos = getLineOffset.applyAsInt(code); + break; + case KeyEvent.VK_DOWN: + ev.consume(); + newPos = getLineOffset.applyAsInt(code); + break; case KeyEvent.VK_HOME: ev.consume(); newPos = 0; @@ -739,12 +800,12 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse { selectionStart = -1; selectionEnd = -1; - cursorAt(getCharOffset.applyAsInt(mouseEvent)); + cursorAt(getCharOffset(mouseEvent)); } return mouseEvent; } - int nco = getCharOffset.applyAsInt(mouseEvent); + int nco = getCharOffset(mouseEvent); if (mouseEvent.isShiftDown() && selectionEnd != -1) { @@ -786,7 +847,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse return mouseEvent; } - int nco = getCharOffset.applyAsInt(mouseEvent); + int nco = getCharOffset(mouseEvent); if (selectionStart != -1) { selectionEnd = nco; From 4effbba361c638ebf7dfd4ba7112c7ea7e9a8bf7 Mon Sep 17 00:00:00 2001 From: Ron Young Date: Wed, 13 Feb 2019 20:44:11 -0600 Subject: [PATCH 075/304] Limit wiki input lines to 1 --- .../runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java index 51ea075d2f..cc68aef20b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java @@ -82,6 +82,7 @@ public class WikiSearchChatboxTextInput extends ChatboxTextInput super(chatboxPanelManager, clientThread); this.chatboxPanelManager = chatboxPanelManager; + lines(1); prompt("OSRS Wiki Search"); onDone(string -> { From b855371d8b6859f7616f56391b159a32ad348ad6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 Feb 2019 19:02:50 -0500 Subject: [PATCH 076/304] xptracker: treat players with rank -1 as unranked --- .../java/net/runelite/http/service/xp/XpTrackerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java index 5ef7e829e4..9f4e639964 100644 --- a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java +++ b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java @@ -289,7 +289,7 @@ public class XpTrackerService private static Duration updateFrequency(PlayerEntity playerEntity) { Integer rank = playerEntity.getRank(); - if (rank == null) + if (rank == null || rank == -1) { return Duration.ofDays(7); } From fe2eba06a70737528daea372a26283ded5ae654e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 Feb 2019 21:14:17 -0500 Subject: [PATCH 077/304] http service: use gson instead of jackson for json serialization This fixes deserailization of the loot timestamps for the loot tracker, and maybe other things. Note this does not use the same Gson instance as http-api as Spring creates its own Gson, however they are both default Gson instances. --- ...gurer.java => SpringWebMvcConfigurer.java} | 21 +++++++++++++++---- .../src/test/resources/application.properties | 3 +-- 2 files changed, 18 insertions(+), 6 deletions(-) rename http-service/src/main/java/net/runelite/http/service/{SpringContentNegotiationConfigurer.java => SpringWebMvcConfigurer.java} (77%) diff --git a/http-service/src/main/java/net/runelite/http/service/SpringContentNegotiationConfigurer.java b/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java similarity index 77% rename from http-service/src/main/java/net/runelite/http/service/SpringContentNegotiationConfigurer.java rename to http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java index ed055d0bdf..4402ea6e89 100644 --- a/http-service/src/main/java/net/runelite/http/service/SpringContentNegotiationConfigurer.java +++ b/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java @@ -24,22 +24,35 @@ */ package net.runelite.http.service; +import java.util.List; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.GsonHttpMessageConverter; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -/** - * Configure .js as application/json to trick Cloudflare into caching json responses - */ @Configuration @EnableWebMvc -public class SpringContentNegotiationConfigurer extends WebMvcConfigurerAdapter +public class SpringWebMvcConfigurer extends WebMvcConfigurerAdapter { + /** + * Configure .js as application/json to trick Cloudflare into caching json responses + */ @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.mediaType("js", MediaType.APPLICATION_JSON); } + + /** + * Use GSON instead of Jackson for JSON serialization + * @param converters + */ + @Override + public void configureMessageConverters(List> converters) + { + converters.add(new GsonHttpMessageConverter()); + } } diff --git a/http-service/src/test/resources/application.properties b/http-service/src/test/resources/application.properties index cb3dcc0507..ded3472a5c 100644 --- a/http-service/src/test/resources/application.properties +++ b/http-service/src/test/resources/application.properties @@ -7,5 +7,4 @@ minio.bucket=runelite runelite.twitter.consumerkey=moo runelite.twitter.secretkey=cow runelite.twitter.listid=968949795153948673 -logging.level.net.runelite=DEBUG -spring.jackson.serialization.indent_output=true \ No newline at end of file +logging.level.net.runelite=DEBUG \ No newline at end of file From 7f3584e155a951488c2d0f04b123dae74c45b10b Mon Sep 17 00:00:00 2001 From: mabel5 Date: Thu, 7 Feb 2019 02:30:17 -0500 Subject: [PATCH 078/304] Added decoration objects to object markers Fixes #7711 --- .../ObjectIndicatorsOverlay.java | 16 ++++- .../ObjectIndicatorsPlugin.java | 66 +++++++++++++------ 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java index af9431038e..f111a6f94f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java @@ -29,6 +29,7 @@ import java.awt.Graphics2D; import java.awt.Polygon; import javax.inject.Inject; import net.runelite.api.Client; +import net.runelite.api.DecorativeObject; import net.runelite.api.GameObject; import net.runelite.api.TileObject; import net.runelite.client.ui.overlay.Overlay; @@ -65,22 +66,31 @@ class ObjectIndicatorsOverlay extends Overlay } final Polygon polygon; + Polygon polygon2 = null; if (object instanceof GameObject) { polygon = ((GameObject) object).getConvexHull(); } + else if (object instanceof DecorativeObject) + { + polygon = ((DecorativeObject) object).getConvexHull(); + polygon2 = ((DecorativeObject) object).getConvexHull2(); + } else { polygon = object.getCanvasTilePoly(); } - if (polygon == null) + if (polygon != null) { - continue; + OverlayUtil.renderPolygon(graphics, polygon, config.markerColor()); } - OverlayUtil.renderPolygon(graphics, polygon, config.markerColor()); + if (polygon2 != null) + { + OverlayUtil.renderPolygon(graphics, polygon2, config.markerColor()); + } } return null; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java index a352d728db..05fd84d0d8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java @@ -43,6 +43,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import static net.runelite.api.Constants.REGION_SIZE; +import net.runelite.api.DecorativeObject; import net.runelite.api.GameObject; import net.runelite.api.GameState; import net.runelite.api.MenuAction; @@ -58,6 +59,8 @@ import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; +import net.runelite.api.events.DecorativeObjectSpawned; +import net.runelite.api.events.DecorativeObjectDespawned; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.input.KeyListener; @@ -158,26 +161,15 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener @Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, event.getGameObject().getLocalLocation()); - final Set objectPoints = points.get(worldPoint.getRegionID()); + final GameObject eventObject = event.getGameObject(); + checkObjectPoints(eventObject); + } - if (objectPoints == null) - { - return; - } - - for (ObjectPoint objectPoint : objectPoints) - { - if ((worldPoint.getX() & (REGION_SIZE - 1)) == objectPoint.getRegionX() - && (worldPoint.getY() & (REGION_SIZE - 1)) == objectPoint.getRegionY()) - { - if (objectPoint.getName().equals(client.getObjectDefinition(event.getGameObject().getId()).getName())) - { - objects.add(event.getGameObject()); - break; - } - } - } + @Subscribe + public void onDecorativeObjectSpawned(DecorativeObjectSpawned event) + { + final DecorativeObject eventObject = event.getDecorativeObject(); + checkObjectPoints(eventObject); } @Subscribe @@ -186,6 +178,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener objects.remove(event.getGameObject()); } + @Subscribe + public void onDecorativeObjectDespawned(DecorativeObjectDespawned event) + { + objects.remove(event.getDecorativeObject()); + } + @Subscribe public void onGameStateChanged(GameStateChanged gameStateChanged) { @@ -263,6 +261,30 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener markObject(name, object); } + private void checkObjectPoints(TileObject object) + { + final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation()); + final Set objectPoints = points.get(worldPoint.getRegionID()); + + if (objectPoints == null) + { + return; + } + + for (ObjectPoint objectPoint : objectPoints) + { + if ((worldPoint.getX() & (REGION_SIZE - 1)) == objectPoint.getRegionX() + && (worldPoint.getY() & (REGION_SIZE - 1)) == objectPoint.getRegionY()) + { + if (objectPoint.getName().equals(client.getObjectDefinition(object.getId()).getName())) + { + objects.add(object); + break; + } + } + } + } + private TileObject findTileObject(Tile tile, int id) { if (tile == null) @@ -271,6 +293,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener } final GameObject[] tileGameObjects = tile.getGameObjects(); + final DecorativeObject tileDecorativeObject = tile.getDecorativeObject(); + + if (tileDecorativeObject != null && tileDecorativeObject.getId() == id) + { + return tileDecorativeObject; + } for (GameObject object : tileGameObjects) { From 38ab5694226cd5cd652e845b291a1d4b0d8c6b12 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sat, 16 Feb 2019 20:35:59 -0700 Subject: [PATCH 079/304] mixins: Include game crash string in log This lets the client print the cs2 vm stack to our logs --- .../main/java/net/runelite/mixins/ProcessClientErrorMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/ProcessClientErrorMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/ProcessClientErrorMixin.java index a4498ea814..eb3e971a3a 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/ProcessClientErrorMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/ProcessClientErrorMixin.java @@ -55,7 +55,7 @@ public abstract class ProcessClientErrorMixin implements RSClient throwableToScan = ((RSRunException) throwable).getParent(); } - client.getLogger().error("Game crash", throwableToScan); + client.getLogger().error("Game crash: {}", string, throwableToScan); StackTraceElement[] stackTrace = throwableToScan.getStackTrace(); From e5387a37e25e04850da45f49a10b01c639919a38 Mon Sep 17 00:00:00 2001 From: Yani Date: Sun, 17 Feb 2019 04:47:26 +0100 Subject: [PATCH 080/304] Update Rimmington yew tree location after Veos moved (#7889) --- .../net/runelite/client/plugins/worldmap/RareTreeLocation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java index ca30b23271..d32dee4c32 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java @@ -140,7 +140,7 @@ enum RareTreeLocation new WorldPoint(3018, 3316, 0), new WorldPoint(3041, 3320, 0), new WorldPoint(3052, 3272, 0), - new WorldPoint(2933, 3234, 0), + new WorldPoint(2931, 3231, 0), // Misthalin new WorldPoint(3085, 3481, 0), From a26197e91e5f194b65cb8451568792eec9339ec1 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 17 Feb 2019 21:57:50 +0100 Subject: [PATCH 081/304] Log infobox removal only if infobox was removed Debug log infobox removal from infobox manager only if infobox was really removed. Signed-off-by: Tomas Slusny --- .../runelite/client/ui/overlay/infobox/InfoBoxManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxManager.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxManager.java index 8cea4cc94e..4fd1c1ca11 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxManager.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxManager.java @@ -76,18 +76,18 @@ public class InfoBoxManager public void removeInfoBox(InfoBox infoBox) { - log.debug("Removing InfoBox {}", infoBox); if (infoBoxes.remove(infoBox)) { + log.debug("Removed InfoBox {}", infoBox); refreshInfoBoxes(); } } public void removeIf(Predicate filter) { - log.debug("Removing InfoBoxes for filter {}", filter); if (infoBoxes.removeIf(filter)) { + log.debug("Removed InfoBoxes for filter {}", filter); refreshInfoBoxes(); } } From 2a41d88c29beda2f681c58f404040c6b449a6c2f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 17 Feb 2019 10:05:39 -0500 Subject: [PATCH 082/304] http service: use spring datasource configuration --- http-service/pom.xml | 9 ++ .../service/SpringBootWebApplication.java | 88 +++++++++++++++---- .../src/main/resources/application.yaml | 7 ++ .../service/SpringBootWebApplicationTest.java | 48 ++-------- .../src/test/resources/application.properties | 10 --- .../src/test/resources/application.yaml | 35 ++++++++ http-service/src/test/resources/dev.yaml | 19 ++++ 7 files changed, 146 insertions(+), 70 deletions(-) create mode 100644 http-service/src/main/resources/application.yaml delete mode 100644 http-service/src/test/resources/application.properties create mode 100644 http-service/src/test/resources/application.yaml create mode 100644 http-service/src/test/resources/dev.yaml diff --git a/http-service/pom.xml b/http-service/pom.xml index 75e257d32d..32dc046a4c 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -55,6 +55,10 @@ spring-boot-devtools true + + org.springframework + spring-jdbc + org.mapstruct @@ -130,6 +134,11 @@ 3.7.0 test + + com.h2database + h2 + test + diff --git a/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java b/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java index 562d93445a..bfdac0a254 100644 --- a/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java +++ b/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java @@ -25,13 +25,11 @@ package net.runelite.http.service; import ch.qos.logback.classic.LoggerContext; +import com.google.common.base.Strings; import java.io.IOException; import java.time.Instant; import java.util.HashMap; import java.util.Map; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; @@ -44,11 +42,17 @@ import okhttp3.Cache; import okhttp3.OkHttpClient; import org.slf4j.ILoggerFactory; import org.slf4j.impl.StaticLoggerBinder; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; +import org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup; import org.springframework.scheduling.annotation.EnableScheduling; import org.sql2o.Sql2o; import org.sql2o.converters.Converter; @@ -56,6 +60,7 @@ import org.sql2o.quirks.NoQuirks; @SpringBootApplication @EnableScheduling +@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class}) @Slf4j public class SpringBootWebApplication extends SpringBootServletInitializer { @@ -96,35 +101,80 @@ public class SpringBootWebApplication extends SpringBootServletInitializer }; } - private Context getContext() throws NamingException + @ConfigurationProperties(prefix = "datasource.runelite") + @Bean("dataSourceRuneLite") + public DataSourceProperties dataSourceProperties() { - Context initCtx = new InitialContext(); - return (Context) initCtx.lookup("java:comp/env"); + return new DataSourceProperties(); + } + + @ConfigurationProperties(prefix = "datasource.runelite-cache") + @Bean("dataSourceRuneLiteCache") + public DataSourceProperties dataSourcePropertiesCache() + { + return new DataSourceProperties(); + } + + @ConfigurationProperties(prefix = "datasource.runelite-tracker") + @Bean("dataSourceRuneLiteTracker") + public DataSourceProperties dataSourcePropertiesTracker() + { + return new DataSourceProperties(); + } + + @Bean(value = "runelite", destroyMethod = "") + public DataSource runeliteDataSource(@Qualifier("dataSourceRuneLite") DataSourceProperties dataSourceProperties) + { + return getDataSource(dataSourceProperties); + } + + @Bean(value = "runelite-cache", destroyMethod = "") + public DataSource runeliteCache2DataSource(@Qualifier("dataSourceRuneLiteCache") DataSourceProperties dataSourceProperties) + { + return getDataSource(dataSourceProperties); + } + + @Bean(value = "runelite-tracker", destroyMethod = "") + public DataSource runeliteTrackerDataSource(@Qualifier("dataSourceRuneLiteTracker") DataSourceProperties dataSourceProperties) + { + return getDataSource(dataSourceProperties); } @Bean("Runelite SQL2O") - Sql2o sql2o() throws NamingException + public Sql2o sql2o(@Qualifier("runelite") DataSource dataSource) { - DataSource dataSource = (DataSource) getContext().lookup("jdbc/runelite"); - Map converters = new HashMap<>(); - converters.put(Instant.class, new InstantConverter()); - return new Sql2o(dataSource, new NoQuirks(converters)); + return createSql2oFromDataSource(dataSource); } @Bean("Runelite Cache SQL2O") - Sql2o cacheSql2o() throws NamingException + public Sql2o cacheSql2o(@Qualifier("runelite-cache") DataSource dataSource) { - DataSource dataSource = (DataSource) getContext().lookup("jdbc/runelite-cache2"); - Map converters = new HashMap<>(); - converters.put(Instant.class, new InstantConverter()); - return new Sql2o(dataSource, new NoQuirks(converters)); + return createSql2oFromDataSource(dataSource); } @Bean("Runelite XP Tracker SQL2O") - Sql2o trackerSql2o() throws NamingException + public Sql2o trackerSql2o(@Qualifier("runelite-tracker") DataSource dataSource) { - DataSource dataSource = (DataSource) getContext().lookup("jdbc/runelite-tracker"); - Map converters = new HashMap<>(); + return createSql2oFromDataSource(dataSource); + } + + private static DataSource getDataSource(DataSourceProperties dataSourceProperties) + { + if (!Strings.isNullOrEmpty(dataSourceProperties.getJndiName())) + { + // Use JNDI provided datasource, which is already configured with pooling + JndiDataSourceLookup dataSourceLookup = new JndiDataSourceLookup(); + return dataSourceLookup.getDataSource(dataSourceProperties.getJndiName()); + } + else + { + return dataSourceProperties.initializeDataSourceBuilder().build(); + } + } + + private static Sql2o createSql2oFromDataSource(final DataSource dataSource) + { + final Map converters = new HashMap<>(); converters.put(Instant.class, new InstantConverter()); return new Sql2o(dataSource, new NoQuirks(converters)); } diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml new file mode 100644 index 0000000000..7b6785a325 --- /dev/null +++ b/http-service/src/main/resources/application.yaml @@ -0,0 +1,7 @@ +datasource: + runelite: + jndiName: java:comp/env/jdbc/runelite + runelite-cache: + jndiName: java:comp/env/jdbc/runelite-cache2 + runelite-tracker: + jndiName: java:comp/env/jdbc/runelite-tracker \ No newline at end of file diff --git a/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java b/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java index 0503c075d8..d2d488e1e6 100644 --- a/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java +++ b/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Adam + * Copyright (c) 2019, Adam * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,57 +24,23 @@ */ package net.runelite.http.service; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import javax.naming.NamingException; -import net.runelite.http.service.util.InstantConverter; import org.junit.Ignore; import org.junit.Test; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.sql2o.Sql2o; -import org.sql2o.converters.Converter; -import org.sql2o.quirks.NoQuirks; -@SpringBootApplication -@EnableScheduling public class SpringBootWebApplicationTest { - @Bean("Runelite SQL2O") - Sql2o sql2o() - { - Map converters = new HashMap<>(); - converters.put(Instant.class, new InstantConverter()); - return new Sql2o("jdbc:mysql://192.168.1.2/runelite", "runelite", "runelite", new NoQuirks(converters)); - } - - @Bean("Runelite Cache SQL2O") - Sql2o cacheSql2o() throws NamingException - { - Map converters = new HashMap<>(); - converters.put(Instant.class, new InstantConverter()); - return new Sql2o("jdbc:mysql://192.168.1.2/cache", "runelite", "runelite", new NoQuirks(converters)); - } - - @Bean("Runelite XP Tracker SQL2O") - Sql2o xpSql2o() throws NamingException - { - Map converters = new HashMap<>(); - converters.put(Instant.class, new InstantConverter()); - return new Sql2o("jdbc:mysql://192.168.1.2/xptracker", "runelite", "runelite", new NoQuirks(converters)); - } - @Test @Ignore - public void test() throws InterruptedException + public void run() throws InterruptedException { - SpringApplication.run(SpringBootWebApplicationTest.class, new String[0]); + String[] args = new String[]{ + "--spring.config.location=classpath:/application.yaml,classpath:/dev.yaml" + }; + SpringApplication.run(SpringBootWebApplication.class, args); for (;;) { Thread.sleep(100L); } } -} +} \ No newline at end of file diff --git a/http-service/src/test/resources/application.properties b/http-service/src/test/resources/application.properties deleted file mode 100644 index ded3472a5c..0000000000 --- a/http-service/src/test/resources/application.properties +++ /dev/null @@ -1,10 +0,0 @@ -oauth.client-id=moo -oauth.client-secret=cow -minio.endpoint=http://10.96.22.171:9000 -minio.accesskey=AM54M27O4WZK65N6F8IP -minio.secretkey=/PZCxzmsJzwCHYlogcymuprniGCaaLUOET2n6yMP -minio.bucket=runelite -runelite.twitter.consumerkey=moo -runelite.twitter.secretkey=cow -runelite.twitter.listid=968949795153948673 -logging.level.net.runelite=DEBUG \ No newline at end of file diff --git a/http-service/src/test/resources/application.yaml b/http-service/src/test/resources/application.yaml new file mode 100644 index 0000000000..128e64d8ef --- /dev/null +++ b/http-service/src/test/resources/application.yaml @@ -0,0 +1,35 @@ +oauth: + client-id: moo + client-secret: cow + +minio: + endpoint: http://10.96.22.171:9000 + accesskey: AM54M27O4WZK65N6F8IP + secretkey: /PZCxzmsJzwCHYlogcymuprniGCaaLUOET2n6yMP + bucket: runelite + +runelite: + twitter: + consumerkey: moo + secretkey: cow + listid: 968949795153948673 + +logging: + level: + net: + runelite: + DEBUG + +datasource: + runelite: + driverClassName: org.h2.Driver + type: org.h2.jdbcx.JdbcDataSource + url: jdbc:h2:mem:runelite + runelite-cache: + driverClassName: org.h2.Driver + type: org.h2.jdbcx.JdbcDataSource + url: jdbc:h2:mem:cache + runelite-tracker: + driverClassName: org.h2.Driver + type: org.h2.jdbcx.JdbcDataSource + url: jdbc:h2:mem:xptracker diff --git a/http-service/src/test/resources/dev.yaml b/http-service/src/test/resources/dev.yaml new file mode 100644 index 0000000000..e4967ccee4 --- /dev/null +++ b/http-service/src/test/resources/dev.yaml @@ -0,0 +1,19 @@ +datasource: + runelite: + driverClassName: com.mysql.jdbc.Driver + type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource + url: jdbc:mysql://192.168.1.2/runelite + username: runelite + password: runelite + runelite-cache: + driverClassName: com.mysql.jdbc.Driver + type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource + url: jdbc:mysql://192.168.1.2/cache + username: runelite + password: runelite + runelite-tracker: + driverClassName: com.mysql.jdbc.Driver + type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource + url: jdbc:mysql://192.168.1.2/xptracker + username: runelite + password: runelite From c55491cc117a65c043213ee68163008424930972 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 17 Feb 2019 12:47:41 -0500 Subject: [PATCH 083/304] http service: add loottracker controller test --- .../LootTrackerControllerTest.java | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 http-service/src/test/java/net/runelite/http/service/loottracker/LootTrackerControllerTest.java diff --git a/http-service/src/test/java/net/runelite/http/service/loottracker/LootTrackerControllerTest.java b/http-service/src/test/java/net/runelite/http/service/loottracker/LootTrackerControllerTest.java new file mode 100644 index 0000000000..e708de0c29 --- /dev/null +++ b/http-service/src/test/java/net/runelite/http/service/loottracker/LootTrackerControllerTest.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.service.loottracker; + +import java.io.IOException; +import java.time.Instant; +import java.util.Collections; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import net.runelite.http.api.RuneLiteAPI; +import net.runelite.http.api.loottracker.GameItem; +import net.runelite.http.api.loottracker.LootRecord; +import net.runelite.http.api.loottracker.LootRecordType; +import net.runelite.http.service.account.AuthFilter; +import net.runelite.http.service.account.beans.SessionEntry; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringRunner.class) +@WebMvcTest(LootTrackerController.class) +@Slf4j +public class LootTrackerControllerTest +{ + @Autowired + private MockMvc mockMvc; + + @MockBean + private LootTrackerService lootTrackerService; + + @MockBean + private AuthFilter authFilter; + + @Before + public void before() throws IOException + { + when(authFilter.handle(any(HttpServletRequest.class), any(HttpServletResponse.class))) + .thenReturn(mock(SessionEntry.class)); + } + + @Test + public void storeLootRecord() throws Exception + { + LootRecord lootRecord = new LootRecord(); + lootRecord.setType(LootRecordType.NPC); + lootRecord.setTime(Instant.now()); + lootRecord.setDrops(Collections.singletonList(new GameItem(4151, 1))); + + String data = RuneLiteAPI.GSON.toJson(lootRecord); + mockMvc.perform(post("/loottracker").content(data).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()); + + verify(lootTrackerService).store(eq(lootRecord), anyInt()); + } +} \ No newline at end of file From 38cdbfcb6b9dc24556c6db3cd5a68f132ba32369 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 17 Feb 2019 17:51:14 -0500 Subject: [PATCH 084/304] http service: use http-api gson instance --- .../net/runelite/http/service/SpringWebMvcConfigurer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java b/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java index 4402ea6e89..f0fd4ed99c 100644 --- a/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java +++ b/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java @@ -25,6 +25,7 @@ package net.runelite.http.service; import java.util.List; +import net.runelite.http.api.RuneLiteAPI; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; @@ -53,6 +54,8 @@ public class SpringWebMvcConfigurer extends WebMvcConfigurerAdapter @Override public void configureMessageConverters(List> converters) { - converters.add(new GsonHttpMessageConverter()); + GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(); + gsonHttpMessageConverter.setGson(RuneLiteAPI.GSON); + converters.add(gsonHttpMessageConverter); } } From f0c5e0d1f70454c56b3d92052641e4f9b208b7e3 Mon Sep 17 00:00:00 2001 From: Dennis Date: Mon, 18 Feb 2019 13:41:05 +0100 Subject: [PATCH 085/304] gpu: remove unnecessary texture bind --- .../main/java/net/runelite/client/plugins/gpu/GpuPlugin.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index a7871f95da..93d8a522d9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -1151,8 +1151,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks gl.glTexSubImage2D(gl.GL_TEXTURE_2D, 0, 0, 0, width, height, gl.GL_BGRA, gl.GL_UNSIGNED_INT_8_8_8_8_REV, interfaceBuffer); } - gl.glBindTexture(gl.GL_TEXTURE_2D, interfaceTexture); - if (client.isStretchedEnabled()) { Dimension dim = client.getStretchedDimensions(); From 1fd617c35977e58a292ec65856cf80a4f47077d4 Mon Sep 17 00:00:00 2001 From: TheStonedTurtle <29030969+TheStonedTurtle@users.noreply.github.com> Date: Mon, 18 Feb 2019 07:13:40 -0800 Subject: [PATCH 086/304] Add PM Target Cycling to Chat History plugin --- .../main/java/net/runelite/api/ScriptID.java | 18 +++ .../java/net/runelite/api/VarClientStr.java | 1 + .../java/net/runelite/api/vars/InputType.java | 1 + .../chathistory/ChatHistoryPlugin.java | 143 ++++++++++++++---- 4 files changed, 137 insertions(+), 26 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index 778b271036..05c057a38d 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -45,6 +45,24 @@ public final class ScriptID */ public static final int CHATBOX_INPUT = 96; + /** + * Opens the Private Message chat interface + * + * Jagex refers to this script as {@code meslayer_mode6} + *

    + *
  • String Player to send private message to
  • + *
+ */ + public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107; + + /** + * Rebuilds the text input widget inside the chat interface + *
    + *
  • String Message Prefix. Only used inside the GE search interfaces + *
+ */ + public static final int CHAT_TEXT_INPUT_REBUILD = 222; + /** * Layouts the bank widgets * diff --git a/runelite-api/src/main/java/net/runelite/api/VarClientStr.java b/runelite-api/src/main/java/net/runelite/api/VarClientStr.java index b3bf1b09b6..72f4ee0303 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarClientStr.java +++ b/runelite-api/src/main/java/net/runelite/api/VarClientStr.java @@ -36,6 +36,7 @@ public enum VarClientStr { CHATBOX_TYPED_TEXT(1), INPUT_TEXT(22), + PRIVATE_MESSAGE_TARGET(23), RECENT_CLAN_CHAT(129); private final int index; diff --git a/runelite-api/src/main/java/net/runelite/api/vars/InputType.java b/runelite-api/src/main/java/net/runelite/api/vars/InputType.java index db1301b281..c94ccd79ef 100644 --- a/runelite-api/src/main/java/net/runelite/api/vars/InputType.java +++ b/runelite-api/src/main/java/net/runelite/api/vars/InputType.java @@ -38,6 +38,7 @@ public enum InputType RUNELITE_CHATBOX_PANEL(-3), RUNELITE(-2), NONE(0), + PRIVATE_MESSAGE(6), SEARCH(11); private final int type; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java index 6ac89bf605..77fcb70df0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java @@ -25,39 +25,53 @@ package net.runelite.client.plugins.chathistory; import com.google.common.collect.EvictingQueue; -import com.google.common.collect.Sets; +import java.awt.event.KeyEvent; +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Iterator; import java.util.Queue; -import java.util.Set; import javax.inject.Inject; import net.runelite.api.ChatMessageType; +import net.runelite.api.Client; +import net.runelite.api.ScriptID; +import net.runelite.api.VarClientInt; +import net.runelite.api.VarClientStr; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.MenuOptionClicked; +import net.runelite.api.vars.InputType; +import net.runelite.client.callback.ClientThread; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.input.KeyListener; +import net.runelite.client.input.KeyManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.util.Text; @PluginDescriptor( name = "Chat History", - description = "Retain your chat history when logging in/out or world hopping" + description = "Retain your chat history when logging in/out or world hopping", + tags = {"chat", "history", "retain", "cycle", "pm"} ) -public class ChatHistoryPlugin extends Plugin +public class ChatHistoryPlugin extends Plugin implements KeyListener { private static final String WELCOME_MESSAGE = "Welcome to Old School RuneScape."; private static final String CLEAR_HISTORY = "Clear history"; private static final String CLEAR_PRIVATE = "Private:"; - private static final Set ALLOWED_HISTORY = Sets.newHashSet( - ChatMessageType.PUBLIC, - ChatMessageType.PUBLIC_MOD, - ChatMessageType.CLANCHAT, - ChatMessageType.PRIVATE_MESSAGE_RECEIVED, - ChatMessageType.PRIVATE_MESSAGE_SENT, - ChatMessageType.PRIVATE_MESSAGE_RECEIVED_MOD, - ChatMessageType.GAME - ); + private static final int CYCLE_HOTKEY = KeyEvent.VK_TAB; private Queue messageQueue; + private Deque friends; + + @Inject + private Client client; + + @Inject + private ClientThread clientThread; + + @Inject + private KeyManager keyManager; @Inject private ChatMessageManager chatMessageManager; @@ -66,6 +80,8 @@ public class ChatHistoryPlugin extends Plugin protected void startUp() { messageQueue = EvictingQueue.create(100); + friends = new ArrayDeque<>(5); + keyManager.registerKeyListener(this); } @Override @@ -73,6 +89,9 @@ public class ChatHistoryPlugin extends Plugin { messageQueue.clear(); messageQueue = null; + friends.clear(); + friends = null; + keyManager.unregisterKeyListener(this); } @Subscribe @@ -92,21 +111,33 @@ public class ChatHistoryPlugin extends Plugin return; } - if (ALLOWED_HISTORY.contains(chatMessage.getType())) + switch (chatMessage.getType()) { - final QueuedMessage queuedMessage = QueuedMessage.builder() - .type(chatMessage.getType()) - .name(chatMessage.getName()) - .sender(chatMessage.getSender()) - .value(nbsp(chatMessage.getMessage())) - .runeLiteFormattedMessage(nbsp(chatMessage.getMessageNode().getRuneLiteFormatMessage())) - .timestamp(chatMessage.getTimestamp()) - .build(); + case PRIVATE_MESSAGE_SENT: + case PRIVATE_MESSAGE_RECEIVED: + case PRIVATE_MESSAGE_RECEIVED_MOD: + final String name = Text.removeTags(chatMessage.getName()); + // Remove to ensure uniqueness & its place in history + friends.remove(name); + friends.add(name); + // intentional fall-through + case PUBLIC: + case PUBLIC_MOD: + case CLANCHAT: + case GAME: + final QueuedMessage queuedMessage = QueuedMessage.builder() + .type(chatMessage.getType()) + .name(chatMessage.getName()) + .sender(chatMessage.getSender()) + .value(nbsp(chatMessage.getMessage())) + .runeLiteFormattedMessage(nbsp(chatMessage.getMessageNode().getRuneLiteFormatMessage())) + .timestamp(chatMessage.getTimestamp()) + .build(); - if (!messageQueue.contains(queuedMessage)) - { - messageQueue.offer(queuedMessage); - } + if (!messageQueue.contains(queuedMessage)) + { + messageQueue.offer(queuedMessage); + } } } @@ -143,4 +174,64 @@ public class ChatHistoryPlugin extends Plugin return null; } + + @Override + public void keyPressed(KeyEvent e) + { + if (e.getKeyCode() != CYCLE_HOTKEY) + { + return; + } + + if (client.getVar(VarClientInt.INPUT_TYPE) != InputType.PRIVATE_MESSAGE.getType()) + { + return; + } + + clientThread.invoke(() -> + { + final String target = findPreviousFriend(); + if (target == null) + { + return; + } + + final String currentMessage = client.getVar(VarClientStr.INPUT_TEXT); + + client.runScript(ScriptID.OPEN_PRIVATE_MESSAGE_INTERFACE, target); + + client.setVar(VarClientStr.INPUT_TEXT, currentMessage); + client.runScript(ScriptID.CHAT_TEXT_INPUT_REBUILD, ""); + }); + } + + @Override + public void keyTyped(KeyEvent e) + { + } + + @Override + public void keyReleased(KeyEvent e) + { + } + + private String findPreviousFriend() + { + final String currentTarget = client.getVar(VarClientStr.PRIVATE_MESSAGE_TARGET); + if (currentTarget == null || friends.isEmpty()) + { + return null; + } + + for (Iterator it = friends.descendingIterator(); it.hasNext(); ) + { + String friend = it.next(); + if (friend.equals(currentTarget)) + { + return it.hasNext() ? it.next() : friends.getLast(); + } + } + + return friends.getLast(); + } } From c3bbd4934817d741c4d9ce8f59c6dc95dd42b7e5 Mon Sep 17 00:00:00 2001 From: TheStonedTurtle <29030969+TheStonedTurtle@users.noreply.github.com> Date: Mon, 18 Feb 2019 07:14:21 -0800 Subject: [PATCH 087/304] Add Chat History config options --- .../chathistory/ChatHistoryConfig.java | 55 +++++++++++++++++++ .../chathistory/ChatHistoryPlugin.java | 18 +++++- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryConfig.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryConfig.java new file mode 100644 index 0000000000..e30629c742 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryConfig.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2018, TheStonedTurtle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.chathistory; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("chathistory") +public interface ChatHistoryConfig extends Config +{ + @ConfigItem( + keyName = "retainChatHistory", + name = "Retain Chat History", + description = "Retains chat history when logging in/out or world hopping", + position = 0 + ) + default boolean retainChatHistory() + { + return true; + } + + @ConfigItem( + keyName = "pmTargetCycling", + name = "PM Target Cycling", + description = "Pressing Tab while sending a PM will cycle the target username based on PM history", + position = 1 + ) + default boolean pmTargetCycling() + { + return true; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java index 77fcb70df0..43919214ea 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java @@ -25,6 +25,7 @@ package net.runelite.client.plugins.chathistory; import com.google.common.collect.EvictingQueue; +import com.google.inject.Provides; import java.awt.event.KeyEvent; import java.util.ArrayDeque; import java.util.Deque; @@ -42,6 +43,7 @@ import net.runelite.api.vars.InputType; import net.runelite.client.callback.ClientThread; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; +import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.input.KeyListener; import net.runelite.client.input.KeyManager; @@ -70,11 +72,20 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener @Inject private ClientThread clientThread; + @Inject + private ChatHistoryConfig config; + @Inject private KeyManager keyManager; @Inject private ChatMessageManager chatMessageManager; + + @Provides + ChatHistoryConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(ChatHistoryConfig.class); + } @Override protected void startUp() @@ -101,6 +112,11 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener // of information that chat history was reset if (chatMessage.getMessage().equals(WELCOME_MESSAGE)) { + if (!config.retainChatHistory()) + { + return; + } + QueuedMessage queuedMessage; while ((queuedMessage = messageQueue.poll()) != null) @@ -178,7 +194,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener @Override public void keyPressed(KeyEvent e) { - if (e.getKeyCode() != CYCLE_HOTKEY) + if (e.getKeyCode() != CYCLE_HOTKEY || !config.pmTargetCycling()) { return; } From aa5789b84357010d642a1e66bb605789ad93101f Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 18 Feb 2019 16:38:36 -0500 Subject: [PATCH 088/304] config service: split into service and controller --- .../http/service/config/ConfigController.java | 102 ++++++++++++++++++ .../http/service/config/ConfigService.java | 69 +++--------- 2 files changed, 117 insertions(+), 54 deletions(-) create mode 100644 http-service/src/main/java/net/runelite/http/service/config/ConfigController.java diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java new file mode 100644 index 0000000000..966d49cda2 --- /dev/null +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.service.config; + +import java.io.IOException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import net.runelite.http.api.config.Configuration; +import net.runelite.http.service.account.AuthFilter; +import net.runelite.http.service.account.beans.SessionEntry; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import static org.springframework.web.bind.annotation.RequestMethod.DELETE; +import static org.springframework.web.bind.annotation.RequestMethod.PUT; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/config") +public class ConfigController +{ + private final ConfigService configService; + private final AuthFilter authFilter; + + @Autowired + public ConfigController(ConfigService configService, AuthFilter authFilter) + { + this.configService = configService; + this.authFilter = authFilter; + } + + @RequestMapping + public Configuration get(HttpServletRequest request, HttpServletResponse response) throws IOException + { + SessionEntry session = authFilter.handle(request, response); + + if (session == null) + { + return null; + } + + return configService.get(session.getUser()); + } + + @RequestMapping(path = "/{key:.+}", method = PUT) + public void setKey( + HttpServletRequest request, + HttpServletResponse response, + @PathVariable String key, + @RequestBody(required = false) String value + ) throws IOException + { + SessionEntry session = authFilter.handle(request, response); + + if (session == null) + { + return; + } + + configService.setKey(session.getUser(), key, value); + } + + @RequestMapping(path = "/{key:.+}", method = DELETE) + public void unsetKey( + HttpServletRequest request, + HttpServletResponse response, + @PathVariable String key + ) throws IOException + { + SessionEntry session = authFilter.handle(request, response); + + if (session == null) + { + return; + } + + configService.unsetKey(session.getUser(), key); + } +} diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java index 102e2f9c7a..ed96f36cf4 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java @@ -24,28 +24,18 @@ */ package net.runelite.http.service.config; -import java.io.IOException; import java.util.List; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import javax.annotation.Nullable; import net.runelite.http.api.config.ConfigEntry; import net.runelite.http.api.config.Configuration; -import net.runelite.http.service.account.AuthFilter; -import net.runelite.http.service.account.beans.SessionEntry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import static org.springframework.web.bind.annotation.RequestMethod.DELETE; -import static org.springframework.web.bind.annotation.RequestMethod.PUT; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.stereotype.Service; import org.sql2o.Connection; import org.sql2o.Sql2o; import org.sql2o.Sql2oException; -@RestController -@RequestMapping("/config") +@Service public class ConfigService { private static final String CREATE_CONFIG = "CREATE TABLE IF NOT EXISTS `config` (\n" @@ -59,16 +49,13 @@ public class ConfigService + " ADD CONSTRAINT `user_fk` FOREIGN KEY (`user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;"; private final Sql2o sql2o; - private final AuthFilter auth; @Autowired public ConfigService( - @Qualifier("Runelite SQL2O") Sql2o sql2o, - AuthFilter auth + @Qualifier("Runelite SQL2O") Sql2o sql2o ) { this.sql2o = sql2o; - this.auth = auth; try (Connection con = sql2o.open()) { @@ -87,71 +74,45 @@ public class ConfigService } } - @RequestMapping - public Configuration get(HttpServletRequest request, HttpServletResponse response) throws IOException + public Configuration get(int userId) { - SessionEntry session = auth.handle(request, response); - - if (session == null) - { - return null; - } - List config; try (Connection con = sql2o.open()) { config = con.createQuery("select `key`, value from config where user = :user") - .addParameter("user", session.getUser()) + .addParameter("user", userId) .executeAndFetch(ConfigEntry.class); } return new Configuration(config); } - @RequestMapping(path = "/{key:.+}", method = PUT) public void setKey( - HttpServletRequest request, - HttpServletResponse response, - @PathVariable String key, - @RequestBody(required = false) String value - ) throws IOException + int userId, + String key, + @Nullable String value + ) { - SessionEntry session = auth.handle(request, response); - - if (session == null) - { - return; - } - try (Connection con = sql2o.open()) { con.createQuery("insert into config (user, `key`, value) values (:user, :key, :value) on duplicate key update `key` = :key, value = :value") - .addParameter("user", session.getUser()) + .addParameter("user", userId) .addParameter("key", key) .addParameter("value", value != null ? value : "") .executeUpdate(); } } - @RequestMapping(path = "/{key:.+}", method = DELETE) public void unsetKey( - HttpServletRequest request, - HttpServletResponse response, - @PathVariable String key - ) throws IOException + int userId, + String key + ) { - SessionEntry session = auth.handle(request, response); - - if (session == null) - { - return; - } - try (Connection con = sql2o.open()) { con.createQuery("delete from config where user = :user and `key` = :key") - .addParameter("user", session.getUser()) + .addParameter("user", userId) .addParameter("key", key) .executeUpdate(); } From f62e7e3f143ffe85d607af79c523969bb358b457 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 18 Feb 2019 16:39:01 -0500 Subject: [PATCH 089/304] config controller: add test --- .../service/config/ConfigControllerTest.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 http-service/src/test/java/net/runelite/http/service/config/ConfigControllerTest.java diff --git a/http-service/src/test/java/net/runelite/http/service/config/ConfigControllerTest.java b/http-service/src/test/java/net/runelite/http/service/config/ConfigControllerTest.java new file mode 100644 index 0000000000..5ba857ef0a --- /dev/null +++ b/http-service/src/test/java/net/runelite/http/service/config/ConfigControllerTest.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.service.config; + +import java.io.IOException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import net.runelite.http.service.account.AuthFilter; +import net.runelite.http.service.account.beans.SessionEntry; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringRunner.class) +@WebMvcTest(ConfigController.class) +@Slf4j +public class ConfigControllerTest +{ + @Autowired + private MockMvc mockMvc; + + @MockBean + private ConfigService configService; + + @MockBean + private AuthFilter authFilter; + + @Before + public void before() throws IOException + { + when(authFilter.handle(any(HttpServletRequest.class), any(HttpServletResponse.class))) + .thenReturn(mock(SessionEntry.class)); + } + + @Test + public void testSetKey() throws Exception + { + mockMvc.perform(put("/config/key") + .content("value") + .contentType(MediaType.TEXT_PLAIN)) + .andExpect(status().isOk()); + + verify(configService).setKey(anyInt(), eq("key"), eq("value")); + } +} \ No newline at end of file From 6186314dbc81abe94f0fdd24049b2e2c110154bd Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 18 Feb 2019 16:39:34 -0500 Subject: [PATCH 090/304] http service: fix overwriting all default message converters The previous change to try and force GSON for serialization broke default message converters such as text/plain. Change to use extendMessageConverters and remove the Jackson converter instead. --- .../net/runelite/http/service/SpringWebMvcConfigurer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java b/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java index f0fd4ed99c..704e4f9cb2 100644 --- a/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java +++ b/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java @@ -30,6 +30,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.GsonHttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @@ -52,8 +53,11 @@ public class SpringWebMvcConfigurer extends WebMvcConfigurerAdapter * @param converters */ @Override - public void configureMessageConverters(List> converters) + public void extendMessageConverters(List> converters) { + // Could not figure out a better way to force GSON + converters.removeIf(MappingJackson2HttpMessageConverter.class::isInstance); + GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(); gsonHttpMessageConverter.setGson(RuneLiteAPI.GSON); converters.add(gsonHttpMessageConverter); From 2c76947527d93af090a18070c04dd1991339c308 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 18 Feb 2019 23:25:48 +0100 Subject: [PATCH 091/304] Support new Hydra slayer helmet in clue scroll plugin Signed-off-by: Tomas Slusny --- .../runelite/client/plugins/cluescrolls/clues/EmoteClue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java index 30a33d7e50..d3123ce2da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java @@ -133,8 +133,8 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu new EmoteClue("Panic by the pilot on White Wolf Mountain. Beware of double agents! Equip mithril platelegs, a ring of life and a rune axe.", GNOME_GLIDER_ON_WHITE_WOLF_MOUNTAIN, new WorldPoint(2847, 3499, 0), PANIC, item(MITHRIL_PLATELEGS), item(RING_OF_LIFE), item(RUNE_AXE)), new EmoteClue("Panic by the big egg where no one dare goes and the ground is burnt. Beware of double agents! Equip a dragon med helm, a TokTz-Ket-Xil, a brine sabre, rune platebody and an uncharged amulet of glory.", SOUTHEAST_CORNER_OF_LAVA_DRAGON_ISLE, new WorldPoint(3227, 3831, 0), PANIC, item(DRAGON_MED_HELM), item(TOKTZKETXIL), item(BRINE_SABRE), item(RUNE_PLATEBODY), item(AMULET_OF_GLORY)), new EmoteClue("Panic at the area flowers meet snow. Equip Blue D'hide vambs, a dragon spear and a rune plateskirt.", HALFWAY_DOWN_TROLLWEISS_MOUNTAIN, new WorldPoint(2776, 3781, 0), PANIC, item(BLUE_DHIDE_VAMB), item(DRAGON_SPEAR), item(RUNE_PLATESKIRT), item(SLED_4084)), - new EmoteClue("Do a push up at the bank of the Warrior's guild. Beware of double agents! Equip a dragon battleaxe, a dragon defender and a slayer helm of any kind.", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), PUSH_UP, item(DRAGON_BATTLEAXE), item(DRAGON_DEFENDER), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I))), - new EmoteClue("Blow a raspberry at the bank of the Warrior's guild. Beware of double agents! Equip a dragon battleaxe, a dragon defender and a slayer helm of any kind.", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), RASPBERRY, item(DRAGON_BATTLEAXE), item(DRAGON_DEFENDER), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I))), + new EmoteClue("Do a push up at the bank of the Warrior's guild. Beware of double agents! Equip a dragon battleaxe, a dragon defender and a slayer helm of any kind.", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), PUSH_UP, item(DRAGON_BATTLEAXE), item(DRAGON_DEFENDER), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I), item(HYDRA_SLAYER_HELMET), item(HYDRA_SLAYER_HELMET_I))), + new EmoteClue("Blow a raspberry at the bank of the Warrior's guild. Beware of double agents! Equip a dragon battleaxe, a dragon defender and a slayer helm of any kind.", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), RASPBERRY, item(DRAGON_BATTLEAXE), item(DRAGON_DEFENDER), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I), item(HYDRA_SLAYER_HELMET), item(HYDRA_SLAYER_HELMET_I))), new EmoteClue("Blow a raspberry at the monkey cage in Ardougne Zoo. Equip a studded leather body, bronze platelegs and a normal staff with no orb.", NEAR_THE_PARROTS_IN_ARDOUGNE_ZOO, new WorldPoint(2607, 3282, 0), RASPBERRY, item(STUDDED_BODY), item(BRONZE_PLATELEGS), item(STAFF)), new EmoteClue("Blow raspberries outside the entrance to Keep Le Faye. Equip a coif, an iron platebody and leather gloves.", OUTSIDE_KEEP_LE_FAYE, new WorldPoint(2757, 3401, 0), RASPBERRY, item(COIF), item(IRON_PLATEBODY), item(LEATHER_GLOVES)), new EmoteClue("Blow a raspberry in the Fishing Guild bank. Beware of double agents! Equip an elemental shield, blue dragonhide chaps and a rune warhammer.", FISHING_GUILD_BANK, new WorldPoint(2588, 3419, 0), RASPBERRY, item(ELEMENTAL_SHIELD), item(BLUE_DHIDE_CHAPS), item(RUNE_WARHAMMER)), From e77b3ec76d83295e7feae2d75776f19751540fe8 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 18 Feb 2019 23:52:50 +0100 Subject: [PATCH 092/304] Add version information to Discord tooltip Signed-off-by: Tomas Slusny --- .../runelite/client/plugins/discord/DiscordState.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java index 625aed1f08..d4aef9572d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java @@ -34,6 +34,7 @@ import java.util.Optional; import java.util.UUID; import javax.inject.Inject; import lombok.Data; +import net.runelite.client.RuneLiteProperties; import net.runelite.client.discord.DiscordPresence; import net.runelite.client.discord.DiscordService; import net.runelite.client.ws.PartyService; @@ -57,14 +58,16 @@ class DiscordState private final DiscordService discordService; private final DiscordConfig config; private PartyService party; + private final RuneLiteProperties properties; private DiscordPresence lastPresence; @Inject - private DiscordState(final DiscordService discordService, final DiscordConfig config, final PartyService party) + private DiscordState(final DiscordService discordService, final DiscordConfig config, final PartyService party, final RuneLiteProperties properties) { this.discordService = discordService; this.config = config; this.party = party; + this.properties = properties; } /** @@ -90,6 +93,7 @@ class DiscordState final DiscordPresence.DiscordPresenceBuilder presenceBuilder = DiscordPresence.builder() .state(lastPresence.getState()) .details(lastPresence.getDetails()) + .largeImageText(lastPresence.getLargeImageText()) .startTimestamp(lastPresence.getStartTimestamp()) .smallImageKey(lastPresence.getSmallImageKey()) .partyMax(lastPresence.getPartyMax()) @@ -168,9 +172,13 @@ class DiscordState } } + // Replace snapshot with + to make tooltip shorter (so it will span only 1 line) + final String versionShortHand = properties.getVersion().replace("-SNAPSHOT", "+"); + final DiscordPresence.DiscordPresenceBuilder presenceBuilder = DiscordPresence.builder() .state(MoreObjects.firstNonNull(state, "")) .details(MoreObjects.firstNonNull(details, "")) + .largeImageText(properties.getTitle() + " v" + versionShortHand) .startTimestamp(event.getStart()) .smallImageKey(MoreObjects.firstNonNull(imageKey, "default")) .partyMax(PARTY_MAX) From ef1818b6dfbb926996a1a62bf5181c3b800a55d9 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 19 Feb 2019 00:44:09 +0100 Subject: [PATCH 093/304] Check for area update on Discord plugin startup Signed-off-by: Tomas Slusny --- .../java/net/runelite/client/plugins/discord/DiscordPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java index 06e0369535..9598b7eff5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java @@ -130,6 +130,7 @@ public class DiscordPlugin extends Plugin clientToolbar.addNavigation(discordButton); checkForGameStateUpdate(); + checkForAreaUpdate(); if (discordService.getCurrentUser() != null) { From 1089eba6bcfb8d55aac41ef7a506510cb2623bfc Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 17 Feb 2019 11:15:25 -0700 Subject: [PATCH 094/304] mixins: rename gameDraw to renderWidgetLayer --- .../src/main/java/net/runelite/mixins/RSClientMixin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index b67eea80ab..122811ee37 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1265,9 +1265,9 @@ public abstract class RSClientMixin implements RSClient callbacks.clientMainLoop(); } - @MethodHook("gameDraw") + @MethodHook("renderWidgetLayer") @Inject - public static void gameDraw(Widget[] widgets, int parentId, int var2, int var3, int var4, int var5, int x, int y, int var8) + public static void renderWidgetLayer(Widget[] widgets, int parentId, int var2, int var3, int var4, int var5, int x, int y, int var8) { for (Widget rlWidget : widgets) { From 2c822800c875c1774cc27fa700e7de2e9dac4726 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 17 Feb 2019 19:35:57 -0700 Subject: [PATCH 095/304] runelite-api: Add missing widget types --- .../src/main/java/net/runelite/api/widgets/WidgetType.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetType.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetType.java index da76a7580f..9d140c3cd0 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetType.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetType.java @@ -27,9 +27,12 @@ package net.runelite.api.widgets; public final class WidgetType { public static final int LAYER = 0; + public static final int INVENTORY = 2; public static final int RECTANGLE = 3; public static final int TEXT = 4; public static final int GRAPHIC = 5; public static final int MODEL = 6; + public static final int TEXT_INVENTORY = 7; + public static final int IF1_TOOLTIP = 8; public static final int LINE = 9; } From ed461e14e53c0cc17a52463fb96881546f85ee1d Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 19 Feb 2019 08:54:33 +0100 Subject: [PATCH 096/304] Do not use default smallImageKey for Rich Presence Having big image with RuneLite logo and then small image with RuneLite logo in it's corner do not looks very good, so update the small icon only when it is showing something interesting. Signed-off-by: Tomas Slusny --- .../java/net/runelite/client/discord/DiscordService.java | 9 ++++++--- .../runelite/client/plugins/discord/DiscordState.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java b/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java index 0c2739b8a2..0988273ecc 100644 --- a/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java +++ b/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java @@ -150,9 +150,12 @@ public class DiscordService implements AutoCloseable ? "default" : discordPresence.getLargeImageKey(); discordRichPresence.largeImageText = discordPresence.getLargeImageText(); - discordRichPresence.smallImageKey = Strings.isNullOrEmpty(discordPresence.getSmallImageKey()) - ? "default" - : discordPresence.getSmallImageKey(); + + if (!Strings.isNullOrEmpty(discordPresence.getSmallImageKey())) + { + discordRichPresence.smallImageKey = discordPresence.getSmallImageKey(); + } + discordRichPresence.smallImageText = discordPresence.getSmallImageText(); discordRichPresence.partyId = discordPresence.getPartyId(); discordRichPresence.partySize = discordPresence.getPartySize(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java index d4aef9572d..0b57424f85 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java @@ -180,7 +180,7 @@ class DiscordState .details(MoreObjects.firstNonNull(details, "")) .largeImageText(properties.getTitle() + " v" + versionShortHand) .startTimestamp(event.getStart()) - .smallImageKey(MoreObjects.firstNonNull(imageKey, "default")) + .smallImageKey(imageKey) .partyMax(PARTY_MAX) .partySize(party.getMembers().size()); From be3903357427c367fb6cd1a64169152477cc99c8 Mon Sep 17 00:00:00 2001 From: Will Thomas Date: Thu, 14 Feb 2019 22:49:11 +0000 Subject: [PATCH 097/304] wiki plugin: Add skill guide lookup Signed-off-by: Will Thomas --- .../net/runelite/api/widgets/WidgetID.java | 1 + .../client/plugins/wiki/WikiPlugin.java | 61 +++++++++++++------ 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index e919c0f992..be7e595dd7 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -126,6 +126,7 @@ public class WidgetID public static final int ENTERING_HOUSE_GROUP_ID = 71; public static final int FULLSCREEN_MAP_GROUP_ID = 165; public static final int QUESTLIST_GROUP_ID = 399; + public static final int SKILLS_GROUP_ID = 320; static class WorldMap { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index e6b21437e0..44146c4cb5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -27,6 +27,8 @@ package net.runelite.client.plugins.wiki; import com.google.common.primitives.Ints; import java.net.URLEncoder; import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.inject.Inject; import javax.inject.Provider; import lombok.extern.slf4j.Slf4j; @@ -79,6 +81,9 @@ public class WikiPlugin extends Plugin private static final String MENUOP_GUIDE = "Guide"; private static final String MENUOP_QUICKGUIDE = "Quick Guide"; + private static final String MENUOP_WIKI_SKILL = "Wiki"; + + private static final Pattern SKILL_REGEX = Pattern.compile("([A-Za-z]+) guide"); @Inject private SpriteManager spriteManager; @@ -246,6 +251,13 @@ public class WikiPlugin extends Plugin String quest = Text.removeTags(ev.getMenuTarget()); LinkBrowser.browse(WIKI_BASE + "/w/" + URLEncoder.encode(quest.replace(' ', '_')) + quickguide + "?" + UTM_PARAMS); break; + case MENUOP_WIKI_SKILL: + Matcher skillRegex = WikiPlugin.SKILL_REGEX.matcher(Text.removeTags(ev.getMenuTarget())); + + if (skillRegex.find()) + { + LinkBrowser.browse(WIKI_BASE + "/w/" + URLEncoder.encode(skillRegex.group(1)) + "?" + UTM_PARAMS); + } } } } @@ -261,29 +273,42 @@ public class WikiPlugin extends Plugin { int widgetIndex = event.getActionParam0(); int widgetID = event.getActionParam1(); + MenuEntry[] menuEntries = client.getMenuEntries(); - if (!Ints.contains(QUESTLIST_WIDGET_IDS, widgetID) || !"Read Journal:".equals(event.getOption())) + if (Ints.contains(QUESTLIST_WIDGET_IDS, widgetID) && "Read Journal:".equals(event.getOption())) { - return; + menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 2); + + MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); + menuEntry.setTarget(event.getTarget()); + menuEntry.setOption(MENUOP_GUIDE); + menuEntry.setParam0(widgetIndex); + menuEntry.setParam1(widgetID); + menuEntry.setType(MenuAction.RUNELITE.getId()); + + menuEntry = menuEntries[menuEntries.length - 2] = new MenuEntry(); + menuEntry.setTarget(event.getTarget()); + menuEntry.setOption(MENUOP_QUICKGUIDE); + menuEntry.setParam0(widgetIndex); + menuEntry.setParam1(widgetID); + menuEntry.setType(MenuAction.RUNELITE.getId()); + + client.setMenuEntries(menuEntries); } - MenuEntry[] menuEntries = client.getMenuEntries(); - menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 2); + if ((WidgetInfo.TO_GROUP(widgetID) == WidgetID.SKILLS_GROUP_ID) && event.getOption().startsWith("View")) + { + menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); - MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); - menuEntry.setTarget(event.getTarget()); - menuEntry.setOption(MENUOP_GUIDE); - menuEntry.setParam0(widgetIndex); - menuEntry.setParam1(widgetID); - menuEntry.setType(MenuAction.RUNELITE.getId()); + MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); + menuEntry.setTarget(event.getOption().replace("View ", "")); + menuEntry.setOption(MENUOP_WIKI_SKILL); + menuEntry.setParam0(widgetIndex); + menuEntry.setParam1(widgetID); + menuEntry.setIdentifier(event.getIdentifier()); + menuEntry.setType(MenuAction.RUNELITE.getId()); - menuEntry = menuEntries[menuEntries.length - 2] = new MenuEntry(); - menuEntry.setTarget(event.getTarget()); - menuEntry.setOption(MENUOP_QUICKGUIDE); - menuEntry.setParam0(widgetIndex); - menuEntry.setParam1(widgetID); - menuEntry.setType(MenuAction.RUNELITE.getId()); - - client.setMenuEntries(menuEntries); + client.setMenuEntries(menuEntries); + } } } From 06d4adc5e432513177011e30a1c6c353e49e12b9 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 19 Feb 2019 09:44:59 -0500 Subject: [PATCH 098/304] client: change Counter infobox to store count as an integer --- .../client/plugins/cannon/CannonCounter.java | 6 ++--- .../kingdomofmiscellania/KingdomCounter.java | 2 +- .../mta/graveyard/GraveyardCounter.java | 11 ++------ .../nightmarezone/AbsorptionCounter.java | 10 +++----- .../client/plugins/prayer/PrayerCounter.java | 17 +++++++++---- .../client/plugins/slayer/SlayerPlugin.java | 2 +- .../client/plugins/slayer/TaskCounter.java | 2 +- .../specialcounter/SpecialCounter.java | 14 +++-------- .../client/ui/overlay/infobox/Counter.java | 25 ++++++++----------- .../ui/overlay/infobox/InfoBoxOverlay.java | 14 +++++++++-- 10 files changed, 50 insertions(+), 53 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java index 2db9d6f3e0..631410d8c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java @@ -26,15 +26,15 @@ package net.runelite.client.plugins.cannon; import java.awt.Color; import java.awt.image.BufferedImage; -import net.runelite.client.ui.overlay.infobox.Counter; +import net.runelite.client.ui.overlay.infobox.InfoBox; -public class CannonCounter extends Counter +public class CannonCounter extends InfoBox { private final CannonPlugin plugin; public CannonCounter(BufferedImage img, CannonPlugin plugin) { - super(img, plugin, String.valueOf(plugin.getCballsLeft())); + super(img, plugin); this.plugin = plugin; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java index 7dc6aabf35..24f8029184 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java @@ -34,7 +34,7 @@ public class KingdomCounter extends Counter public KingdomCounter(BufferedImage image, KingdomPlugin plugin) { - super(image, plugin, String.valueOf(plugin.getFavor())); + super(image, plugin, plugin.getFavor()); this.plugin = plugin; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java index 83e74cc6d6..907712ab28 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java @@ -31,22 +31,15 @@ import net.runelite.client.ui.overlay.infobox.Counter; public class GraveyardCounter extends Counter { - private int count; - public GraveyardCounter(BufferedImage image, Plugin plugin) { - super(image, plugin, "0"); - } - - public void setCount(int count) - { - this.count = count; - this.setText(String.valueOf(count)); + super(image, plugin, 0); } @Override public Color getTextColor() { + int count = getCount(); if (count >= GraveyardRoom.MIN_SCORE) { return Color.GREEN; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java index 05d1498312..4c6b496a29 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java @@ -33,8 +33,6 @@ import net.runelite.client.ui.overlay.infobox.Counter; public class AbsorptionCounter extends Counter { - private int absorption; - @Getter @Setter private int threshold; @@ -49,20 +47,19 @@ public class AbsorptionCounter extends Counter public AbsorptionCounter(BufferedImage image, Plugin plugin, int absorption, int threshold) { - super(image, plugin, ""); + super(image, plugin, absorption); this.threshold = threshold; - setAbsorption(absorption); } public void setAbsorption(int absorption) { - this.absorption = absorption; - setText(String.valueOf(absorption)); + setCount(absorption); } @Override public Color getTextColor() { + int absorption = getCount(); if (absorption >= threshold) { return aboveThresholdColor; @@ -76,6 +73,7 @@ public class AbsorptionCounter extends Counter @Override public String getTooltip() { + int absorption = getCount(); return "Absorption: " + absorption; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerCounter.java index 546c9f98a8..c510dab82e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerCounter.java @@ -24,25 +24,32 @@ */ package net.runelite.client.plugins.prayer; +import java.awt.Color; import lombok.Getter; import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Counter; +import net.runelite.client.ui.overlay.infobox.InfoBox; -class PrayerCounter extends Counter +class PrayerCounter extends InfoBox { @Getter private final PrayerType prayerType; PrayerCounter(Plugin plugin, PrayerType prayerType) { - super(null, plugin, ""); + super(null, plugin); this.prayerType = prayerType; } @Override - public String toString() + public String getText() { - return "Counter{" + "prayer=" + prayerType.getName() + '}'; + return null; + } + + @Override + public Color getTextColor() + { + return null; } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index ff8d6e39bb..875f1f009d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -580,7 +580,7 @@ public class SlayerPlugin extends Plugin // add and update counter, set timer addCounter(); - counter.setText(String.valueOf(amount)); + counter.setCount(amount); infoTimer = Instant.now(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java index f4ac0045b9..f73a5aae5b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java @@ -33,6 +33,6 @@ public class TaskCounter extends Counter { public TaskCounter(BufferedImage img, Plugin plugin, int amount) { - super(img, plugin, String.valueOf(amount)); + super(img, plugin, amount); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java index 083ef5bba6..3c7b0f2135 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java @@ -29,30 +29,24 @@ import net.runelite.client.ui.overlay.infobox.Counter; class SpecialCounter extends Counter { - private int hitValue; private SpecialWeapon weapon; SpecialCounter(BufferedImage image, SpecialCounterPlugin plugin, int hitValue, SpecialWeapon weapon) { - super(image, plugin, null); + super(image, plugin, hitValue); this.weapon = weapon; - this.hitValue = hitValue; } void addHits(double hit) { - this.hitValue += hit; - } - - @Override - public String getText() - { - return Integer.toString(hitValue); + int count = getCount(); + setCount(count + (int) hit); } @Override public String getTooltip() { + int hitValue = getCount(); if (!weapon.isDamage()) { if (hitValue == 1) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Counter.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Counter.java index 599a178838..49614e9b61 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Counter.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Counter.java @@ -26,33 +26,28 @@ package net.runelite.client.ui.overlay.infobox; import java.awt.Color; import java.awt.image.BufferedImage; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; import net.runelite.client.plugins.Plugin; +@ToString public class Counter extends InfoBox { - private String text; + @Getter + @Setter + private int count; - public Counter(BufferedImage image, Plugin plugin, String text) + public Counter(BufferedImage image, Plugin plugin, int count) { super(image, plugin); - this.text = text; - } - - @Override - public String toString() - { - return "Counter{" + "text=" + text + '}'; + this.count = count; } @Override public String getText() { - return text; - } - - public void setText(String text) - { - this.text = text; + return Integer.toString(count); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java index fecd9f1090..e6a8d6f749 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java @@ -26,6 +26,7 @@ package net.runelite.client.ui.overlay.infobox; import com.google.common.base.Strings; +import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; @@ -94,10 +95,19 @@ public class InfoBoxOverlay extends Overlay continue; } + final String text = box.getText(); + final Color color = box.getTextColor(); + final InfoBoxComponent infoBoxComponent = new InfoBoxComponent(); - infoBoxComponent.setColor(box.getTextColor()); + if (!Strings.isNullOrEmpty(text)) + { + infoBoxComponent.setText(text); + } + if (color != null) + { + infoBoxComponent.setColor(color); + } infoBoxComponent.setImage(box.getScaledImage()); - infoBoxComponent.setText(box.getText()); infoBoxComponent.setTooltip(box.getTooltip()); panelComponent.getChildren().add(infoBoxComponent); } From 65e986455277b55db8b3b65c97ac886a3dcf578b Mon Sep 17 00:00:00 2001 From: Max Weber Date: Fri, 15 Feb 2019 08:20:43 -0700 Subject: [PATCH 099/304] WikiPlugin: Strip tags from names given to RSLookup --- .../main/java/net/runelite/client/plugins/wiki/WikiPlugin.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index 44146c4cb5..2459f3a87a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -227,6 +227,8 @@ public class WikiPlugin extends Plugin return; } + name = Text.removeTags(name); + HttpUrl url = WIKI_RSLOOKUP.newBuilder() .addQueryParameter("type", type) .addQueryParameter("id", "" + id) From 06468e0e0ecbf2e76bec6f95ffb126939889c627 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Fri, 15 Feb 2019 10:25:27 -0700 Subject: [PATCH 100/304] WikiPlugin: Allow lookup of Objects --- .../client/plugins/wiki/WikiPlugin.java | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index 2459f3a87a..2e4e37381e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -37,6 +37,8 @@ import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; import net.runelite.api.NPC; import net.runelite.api.NPCComposition; +import net.runelite.api.ObjectComposition; +import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.WidgetLoaded; @@ -161,7 +163,7 @@ public class WikiPlugin extends Plugin icon.setOriginalHeight(16); icon.setTargetVerb("Lookup"); icon.setName("Wiki"); - icon.setClickMask(WidgetConfig.USE_GROUND_ITEM | WidgetConfig.USE_ITEM | WidgetConfig.USE_NPC); + icon.setClickMask(WidgetConfig.USE_GROUND_ITEM | WidgetConfig.USE_ITEM | WidgetConfig.USE_NPC | WidgetConfig.USE_OBJECT); icon.setNoClickThrough(true); icon.setOnTargetEnterListener((JavaScriptCallback) ev -> { @@ -201,6 +203,8 @@ public class WikiPlugin extends Plugin String type; int id; String name; + WorldPoint location; + switch (ev.getMenuAction()) { case CANCEL: @@ -211,6 +215,7 @@ public class WikiPlugin extends Plugin type = "item"; id = itemManager.canonicalize(ev.getId()); name = itemManager.getItemComposition(id).getName(); + location = null; break; } case SPELL_CAST_ON_NPC: @@ -220,6 +225,20 @@ public class WikiPlugin extends Plugin NPCComposition nc = npc.getTransformedComposition(); id = nc.getId(); name = nc.getName(); + location = npc.getWorldLocation(); + break; + } + case SPELL_CAST_ON_GAME_OBJECT: + { + type = "object"; + ObjectComposition lc = client.getObjectDefinition(ev.getId()); + if (lc.getImpostorIds() != null) + { + lc = lc.getImpostor(); + } + id = lc.getId(); + name = lc.getName(); + location = WorldPoint.fromScene(client, ev.getActionParam(), ev.getWidgetId(), client.getPlane()); break; } default: @@ -228,13 +247,20 @@ public class WikiPlugin extends Plugin } name = Text.removeTags(name); - - HttpUrl url = WIKI_RSLOOKUP.newBuilder() - .addQueryParameter("type", type) + HttpUrl.Builder urlBuilder = WIKI_RSLOOKUP.newBuilder(); + urlBuilder.addQueryParameter("type", type) .addQueryParameter("id", "" + id) .addQueryParameter("name", name) - .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE) - .build(); + .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE); + + if (location != null) + { + urlBuilder.addQueryParameter("x", "" + location.getX()) + .addQueryParameter("y", "" + location.getY()) + .addQueryParameter("plane", "" + location.getPlane()); + } + + HttpUrl url = urlBuilder.build(); LinkBrowser.browse(url.toString()); return; From bfb3849b38b4aa00921736e93846390f25881ac5 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 18 Feb 2019 21:29:40 -0700 Subject: [PATCH 101/304] WikiPlugin: Eschew URLEncoder in favor of HttpUrl --- .../client/plugins/wiki/WikiPlugin.java | 32 ++++++++++++------- .../wiki/WikiSearchChatboxTextInput.java | 7 ++-- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index 2e4e37381e..21c58db79a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -25,7 +25,6 @@ package net.runelite.client.plugins.wiki; import com.google.common.primitives.Ints; -import java.net.URLEncoder; import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -74,12 +73,10 @@ public class WikiPlugin extends Plugin WidgetInfo.QUESTLIST_MINIQUEST_CONTAINER.getId(), }; - static final String WIKI_BASE = "https://oldschool.runescape.wiki"; - static final HttpUrl WIKI_RSLOOKUP = HttpUrl.parse(WIKI_BASE + "/w/Special:Lookup"); - static final HttpUrl WIKI_API = HttpUrl.parse(WIKI_BASE + "/api.php"); + static final HttpUrl WIKI_BASE = HttpUrl.parse("https://oldschool.runescape.wiki"); + static final HttpUrl WIKI_API = WIKI_BASE.newBuilder().addPathSegments("api.php").build(); static final String UTM_SORUCE_KEY = "utm_source"; static final String UTM_SORUCE_VALUE = "runelite"; - static final String UTM_PARAMS = UTM_SORUCE_KEY + "=" + UTM_SORUCE_VALUE; private static final String MENUOP_GUIDE = "Guide"; private static final String MENUOP_QUICKGUIDE = "Quick Guide"; @@ -247,8 +244,9 @@ public class WikiPlugin extends Plugin } name = Text.removeTags(name); - HttpUrl.Builder urlBuilder = WIKI_RSLOOKUP.newBuilder(); - urlBuilder.addQueryParameter("type", type) + HttpUrl.Builder urlBuilder = WIKI_BASE.newBuilder(); + urlBuilder.addPathSegments("w/Special:Lookup") + .addQueryParameter("type", type) .addQueryParameter("id", "" + id) .addQueryParameter("name", name) .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE); @@ -268,23 +266,35 @@ public class WikiPlugin extends Plugin if (ev.getMenuAction() == MenuAction.RUNELITE) { - String quickguide = ""; + boolean quickguide = false; switch (ev.getMenuOption()) { case MENUOP_QUICKGUIDE: - quickguide = "/Quick_guide"; + quickguide = true; //fallthrough; case MENUOP_GUIDE: ev.consume(); String quest = Text.removeTags(ev.getMenuTarget()); - LinkBrowser.browse(WIKI_BASE + "/w/" + URLEncoder.encode(quest.replace(' ', '_')) + quickguide + "?" + UTM_PARAMS); + HttpUrl.Builder ub = WIKI_BASE.newBuilder() + .addPathSegment("w") + .addPathSegment(quest) + .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE); + if (quickguide) + { + ub.addPathSegment("Quick_guide"); + } + LinkBrowser.browse(ub.build().toString()); break; case MENUOP_WIKI_SKILL: Matcher skillRegex = WikiPlugin.SKILL_REGEX.matcher(Text.removeTags(ev.getMenuTarget())); if (skillRegex.find()) { - LinkBrowser.browse(WIKI_BASE + "/w/" + URLEncoder.encode(skillRegex.group(1)) + "?" + UTM_PARAMS); + LinkBrowser.browse(WIKI_BASE.newBuilder() + .addPathSegment("w") + .addPathSegment(skillRegex.group(1)) + .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE) + .build().toString()); } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java index cc68aef20b..ef3b91f9a0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java @@ -33,7 +33,6 @@ import com.google.gson.JsonParser; import com.google.inject.Inject; import java.awt.event.KeyEvent; import java.io.IOException; -import java.net.URLEncoder; import java.util.List; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; @@ -297,7 +296,11 @@ public class WikiSearchChatboxTextInput extends ChatboxTextInput private void search(String search) { - LinkBrowser.browse(WikiPlugin.WIKI_BASE + "?search=" + URLEncoder.encode(search) + "&" + WikiPlugin.UTM_PARAMS); + LinkBrowser.browse(WikiPlugin.WIKI_BASE.newBuilder() + .addQueryParameter("search", search) + .addQueryParameter(WikiPlugin.UTM_SORUCE_KEY, WikiPlugin.UTM_SORUCE_VALUE) + .build() + .toString()); chatboxPanelManager.close(); } } From ac8f728d47a4653fc363db95572970b28ce03529 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 17 Feb 2019 20:31:29 +0100 Subject: [PATCH 102/304] Remove dodgy charges variable from item charges plugin Just use config class directly, this variable makes no sense. Signed-off-by: Tomas Slusny --- .../plugins/itemcharges/ItemChargeOverlay.java | 2 +- .../plugins/itemcharges/ItemChargePlugin.java | 17 +++++------------ .../itemcharges/ItemChargePluginTest.java | 16 +++++++++++----- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java index 7730d46ffd..c8a07716bf 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java @@ -83,7 +83,7 @@ class ItemChargeOverlay extends Overlay continue; } - charges = itemChargePlugin.getDodgyCharges(); + charges = config.dodgyNecklace(); } else { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java index c545e9a5bb..f232b64bfd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java @@ -28,8 +28,6 @@ import com.google.inject.Provides; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; import net.runelite.api.ChatMessageType; import net.runelite.api.events.ChatMessage; import net.runelite.client.Notifier; @@ -68,9 +66,6 @@ public class ItemChargePlugin extends Plugin @Inject private ItemChargeConfig config; - @Getter(AccessLevel.PACKAGE) - private int dodgyCharges; - @Provides ItemChargeConfig getConfig(ConfigManager configManager) { @@ -81,7 +76,6 @@ public class ItemChargePlugin extends Plugin protected void startUp() { overlayManager.add(overlay); - dodgyCharges = config.dodgyNecklace(); } @Override @@ -110,22 +104,21 @@ public class ItemChargePlugin extends Plugin notifier.notify("Your dodgy necklace has crumbled to dust."); } - setDodgyCharges(MAX_DODGY_CHARGES); + updateDodgyNecklaceCharges(MAX_DODGY_CHARGES); } else if (dodgyCheckMatcher.find()) { - setDodgyCharges(Integer.parseInt(dodgyCheckMatcher.group(1))); + updateDodgyNecklaceCharges(Integer.parseInt(dodgyCheckMatcher.group(1))); } else if (dodgyProtectMatcher.find()) { - setDodgyCharges(Integer.parseInt(dodgyProtectMatcher.group(1))); + updateDodgyNecklaceCharges(Integer.parseInt(dodgyProtectMatcher.group(1))); } } } - private void setDodgyCharges(int dodgyCharges) + private void updateDodgyNecklaceCharges(final int value) { - this.dodgyCharges = dodgyCharges; - config.dodgyNecklace(dodgyCharges); + config.dodgyNecklace(value); } } \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java index b8fc81a16a..ea6438031a 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java @@ -33,11 +33,13 @@ import net.runelite.api.Client; import net.runelite.api.events.ChatMessage; import net.runelite.client.Notifier; import net.runelite.client.ui.overlay.OverlayManager; -import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import static org.mockito.Matchers.eq; import org.mockito.Mock; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.verify; import org.mockito.runners.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) @@ -78,18 +80,22 @@ public class ItemChargePluginTest { ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", CHECK, "", 0); itemChargePlugin.onChatMessage(chatMessage); - assertEquals(10, itemChargePlugin.getDodgyCharges()); + verify(config).dodgyNecklace(eq(10)); + reset(config); chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", PROTECT, "", 0); itemChargePlugin.onChatMessage(chatMessage); - assertEquals(9, itemChargePlugin.getDodgyCharges()); + verify(config).dodgyNecklace(eq(9)); + reset(config); chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", PROTECT_1, "", 0); itemChargePlugin.onChatMessage(chatMessage); - assertEquals(1, itemChargePlugin.getDodgyCharges()); + verify(config).dodgyNecklace(eq(1)); + reset(config); chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", BREAK, "", 0); itemChargePlugin.onChatMessage(chatMessage); - assertEquals(10, itemChargePlugin.getDodgyCharges()); + verify(config).dodgyNecklace(eq(10)); + reset(config); } } \ No newline at end of file From 1a3815865189853b9b2dcc1dcf2ed522e7da14ec Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Tue, 18 Dec 2018 11:24:10 +0000 Subject: [PATCH 103/304] Add infoboxes to item charges plugin Closes #1318 Co-authored-by: Tomas Slusny Signed-off-by: Tomas Slusny --- .../plugins/itemcharges/ItemChargeConfig.java | 11 ++ .../itemcharges/ItemChargeInfobox.java | 60 ++++++ .../itemcharges/ItemChargeOverlay.java | 17 +- .../plugins/itemcharges/ItemChargePlugin.java | 173 ++++++++++++++++++ .../plugins/itemcharges/ItemChargeType.java | 3 +- .../plugins/itemcharges/ItemWithSlot.java | 47 +++++ .../itemcharges/ItemChargePluginTest.java | 10 + 7 files changed, 304 insertions(+), 17 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeInfobox.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithSlot.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java index 40488c5137..28c503b20a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java @@ -203,4 +203,15 @@ public interface ItemChargeConfig extends Config { return false; } + + @ConfigItem( + keyName = "showInfoboxes", + name = "Show Infoboxes", + description = "Configures whether to show an infobox equipped charge items", + position = 15 + ) + default boolean showInfoboxes() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeInfobox.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeInfobox.java new file mode 100644 index 0000000000..7ee70d44b5 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeInfobox.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018, Hydrox6 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.itemcharges; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import lombok.Getter; +import net.runelite.api.EquipmentInventorySlot; +import net.runelite.client.ui.overlay.infobox.Counter; + +@Getter +class ItemChargeInfobox extends Counter +{ + private final ItemChargePlugin plugin; + private final ItemWithSlot item; + private final EquipmentInventorySlot slot; + + ItemChargeInfobox( + ItemChargePlugin plugin, + BufferedImage image, + String name, + int charges, + ItemWithSlot item, + EquipmentInventorySlot slot) + { + super(image, plugin, charges); + setTooltip(name); + this.plugin = plugin; + this.item = item; + this.slot = slot; + } + + @Override + public Color getTextColor() + { + return getPlugin().getColor(getCount()); + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java index c8a07716bf..27bb35b21d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java @@ -24,7 +24,6 @@ */ package net.runelite.client.plugins.itemcharges; -import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; @@ -112,7 +111,7 @@ class ItemChargeOverlay extends Overlay final TextComponent textComponent = new TextComponent(); textComponent.setPosition(new Point(bounds.x, bounds.y + 16)); textComponent.setText(charges < 0 ? "?" : String.valueOf(charges)); - textComponent.setColor(getColor(charges)); + textComponent.setColor(itemChargePlugin.getColor(charges)); textComponent.render(graphics); } return null; @@ -137,20 +136,6 @@ class ItemChargeOverlay extends Overlay return jewellery; } - private Color getColor(int charges) - { - Color color = Color.WHITE; - if (charges <= config.veryLowWarning()) - { - color = config.veryLowWarningColor(); - } - else if (charges <= config.lowWarning()) - { - color = config.lowWarningolor(); - } - return color; - } - private boolean displayOverlay() { return config.showTeleportCharges() || config.showDodgyCount() || config.showFungicideCharges() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java index f232b64bfd..e295efd9e5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2017, Seth + * Copyright (c) 2018, Hydrox6 * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,17 +26,29 @@ package net.runelite.client.plugins.itemcharges; import com.google.inject.Provides; +import java.awt.Color; +import java.awt.image.BufferedImage; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.inject.Inject; import net.runelite.api.ChatMessageType; +import net.runelite.api.Client; +import net.runelite.api.EquipmentInventorySlot; +import net.runelite.api.InventoryID; +import net.runelite.api.Item; +import net.runelite.api.ItemContainer; +import net.runelite.api.ItemID; import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.ItemContainerChanged; import net.runelite.client.Notifier; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.ui.overlay.infobox.InfoBoxManager; @PluginDescriptor( name = "Item Charges", @@ -54,12 +67,21 @@ public class ItemChargePlugin extends Plugin private static final int MAX_DODGY_CHARGES = 10; + @Inject + private Client client; + @Inject private OverlayManager overlayManager; @Inject private ItemChargeOverlay overlay; + @Inject + private ItemManager itemManager; + + @Inject + private InfoBoxManager infoBoxManager; + @Inject private Notifier notifier; @@ -82,6 +104,37 @@ public class ItemChargePlugin extends Plugin protected void shutDown() throws Exception { overlayManager.remove(overlay); + infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance); + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (!event.getGroup().equals("itemCharge")) + { + return; + } + + if (!config.showInfoboxes()) + { + infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance); + return; + } + + if (!config.showTeleportCharges()) + { + removeInfobox(ItemWithSlot.TELEPORT); + } + + if (!config.showAbyssalBraceletCharges()) + { + removeInfobox(ItemWithSlot.ABYSSAL_BRACELET); + } + + if (!config.showDodgyCount()) + { + removeInfobox(ItemWithSlot.DODGY_NECKLACE); + } } @Subscribe @@ -117,8 +170,128 @@ public class ItemChargePlugin extends Plugin } } + @Subscribe + public void onItemContainerChanged(ItemContainerChanged event) + { + if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT) || !config.showInfoboxes()) + { + return; + } + + final Item[] items = event.getItemContainer().getItems(); + + if (config.showTeleportCharges()) + { + updateJewelleryInfobox(ItemWithSlot.TELEPORT, items); + } + + if (config.showDodgyCount()) + { + updateJewelleryInfobox(ItemWithSlot.DODGY_NECKLACE, items); + } + + if (config.showAbyssalBraceletCharges()) + { + updateJewelleryInfobox(ItemWithSlot.ABYSSAL_BRACELET, items); + } + } + private void updateDodgyNecklaceCharges(final int value) { config.dodgyNecklace(value); + + if (config.showInfoboxes() && config.showDodgyCount()) + { + final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); + + if (itemContainer == null) + { + return; + } + + updateJewelleryInfobox(ItemWithSlot.DODGY_NECKLACE, itemContainer.getItems()); + } + } + + private void updateJewelleryInfobox(ItemWithSlot item, Item[] items) + { + for (final EquipmentInventorySlot equipmentInventorySlot : item.getSlots()) + { + updateJewelleryInfobox(item, items, equipmentInventorySlot); + } + } + + private void updateJewelleryInfobox(ItemWithSlot type, Item[] items, EquipmentInventorySlot slot) + { + removeInfobox(type, slot); + + if (slot.getSlotIdx() >= items.length) + { + return; + } + + final int id = items[slot.getSlotIdx()].getId(); + if (id < 0) + { + return; + } + + final ItemWithCharge itemWithCharge = ItemWithCharge.findItem(id); + int charges = -1; + + if (itemWithCharge == null) + { + if (id == ItemID.DODGY_NECKLACE && type == ItemWithSlot.DODGY_NECKLACE) + { + charges = config.dodgyNecklace(); + } + } + else if (itemWithCharge.getType() == type.getType()) + { + charges = itemWithCharge.getCharges(); + } + + if (charges <= 0) + { + return; + } + + final String name = itemManager.getItemComposition(id).getName(); + final BufferedImage image = itemManager.getImage(id); + final ItemChargeInfobox infobox = new ItemChargeInfobox(this, image, name, charges, type, slot); + infoBoxManager.addInfoBox(infobox); + } + + private void removeInfobox(final ItemWithSlot item) + { + infoBoxManager.removeIf(t -> t instanceof ItemChargeInfobox && ((ItemChargeInfobox) t).getItem() == item); + } + + private void removeInfobox(final ItemWithSlot item, final EquipmentInventorySlot slot) + { + infoBoxManager.removeIf(t -> + { + if (!(t instanceof ItemChargeInfobox)) + { + return false; + } + + final ItemChargeInfobox i = (ItemChargeInfobox)t; + return i.getItem() == item && i.getSlot() == slot; + }); + } + + Color getColor(int charges) + { + Color color = Color.WHITE; + if (charges <= config.veryLowWarning()) + { + color = config.veryLowWarningColor(); + } + else if (charges <= config.lowWarning()) + { + color = config.lowWarningolor(); + } + return color; } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java index 2f25c12164..cbe5d20ff3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java @@ -32,5 +32,6 @@ enum ItemChargeType IMPBOX, TELEPORT, WATERCAN, - WATERSKIN + WATERSKIN, + DODGY_NECKLACE } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithSlot.java new file mode 100644 index 0000000000..3fbd2bac66 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithSlot.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019, Tomas Slusny + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.itemcharges; + +import com.google.common.collect.Sets; +import java.util.Set; +import lombok.Getter; +import net.runelite.api.EquipmentInventorySlot; + +@Getter +enum ItemWithSlot +{ + ABYSSAL_BRACELET(ItemChargeType.ABYSSAL_BRACELET, EquipmentInventorySlot.GLOVES), + DODGY_NECKLACE(ItemChargeType.DODGY_NECKLACE, EquipmentInventorySlot.AMULET), + TELEPORT(ItemChargeType.TELEPORT, EquipmentInventorySlot.WEAPON, EquipmentInventorySlot.AMULET, EquipmentInventorySlot.GLOVES, EquipmentInventorySlot.RING); + + private final ItemChargeType type; + private final Set slots; + + ItemWithSlot(final ItemChargeType type, final EquipmentInventorySlot... slots) + { + this.type = type; + this.slots = Sets.newHashSet(slots); + } +} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java index ea6438031a..165c7d50a7 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java @@ -28,10 +28,12 @@ import com.google.inject.Guice; import com.google.inject.Inject; import com.google.inject.testing.fieldbinder.Bind; import com.google.inject.testing.fieldbinder.BoundFieldModule; +import java.util.concurrent.ScheduledExecutorService; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.events.ChatMessage; import net.runelite.client.Notifier; +import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.ui.overlay.OverlayManager; import org.junit.Before; import org.junit.Test; @@ -54,6 +56,14 @@ public class ItemChargePluginTest @Bind private Client client; + @Mock + @Bind + private ScheduledExecutorService scheduledExecutorService; + + @Mock + @Bind + private RuneLiteConfig runeLiteConfig; + @Mock @Bind private OverlayManager overlayManager; From 4c1a5307ecd9719b2584995227faab7f1db18146 Mon Sep 17 00:00:00 2001 From: Harry Semple Date: Tue, 19 Feb 2019 20:53:57 -0500 Subject: [PATCH 104/304] agility plugin: color shortcuts you don't have the level to use differently This creates a new agility shortcut enum in the client, extracted from the world map plugin, to keep track of shortcut location and level requirement. The old shortcuts in the agility plugin were merged into this too. Co-authored-by: Adam --- .../runelite/client/game/AgilityShortcut.java | 242 ++++++++++++++++++ .../plugins/agility/AgilityOverlay.java | 11 +- .../client/plugins/agility/AgilityPlugin.java | 54 +++- .../client/plugins/agility/Obstacle.java | 41 +++ .../client/plugins/agility/Obstacles.java | 170 +++--------- .../worldmap/AgilityShortcutLocation.java | 142 ---------- .../worldmap/AgilityShortcutPoint.java | 5 +- .../plugins/worldmap/WorldMapPlugin.java | 6 +- 8 files changed, 379 insertions(+), 292 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacle.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutLocation.java diff --git a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java new file mode 100644 index 0000000000..c376bd34f1 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2018, SomeoneWithAnInternetConnection + * Copyright (c) 2019, MrGroggle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.game; + +import lombok.Getter; +import static net.runelite.api.NullObjectID.*; +import static net.runelite.api.ObjectID.*; +import net.runelite.api.coords.WorldPoint; + +@Getter +public enum AgilityShortcut +{ + GENERIC_SHORTCUT(1, "Shortcut", null, + // Trollheim + ROCKS_3790, ROCKS_3791, + // Fremennik Slayer Cave + STEPS_29993, + // Fossil Island + LADDER_30938, LADDER_30939, LADDER_30940, LADDER_30941, RUBBER_CAP_MUSHROOM, + // Brimhaven dungeon + CREVICE_30198, + // Lumbridge + STILE_12982, + // Gu'Tanoth Bridge + GAP, GAP_2831, + // Lumbridge Swamp Caves + STEPPING_STONE_5948, STEPPING_STONE_5949, ROCKS_6673, + // Morytania Pirate Ship + ROCK_16115, + // Lumber Yard + BROKEN_FENCE_2618, + // McGrubor's Wood + LOOSE_RAILING, + // Underwater Area Fossil Island + TUNNEL_30959, HOLE_30966, OBSTACLE, OBSTACLE_30767, OBSTACLE_30964, OBSTACLE_30962, + // Tree Gnome Village + LOOSE_RAILING_2186, + // Burgh de Rott + LOW_FENCE, + // Taverley + STILE, + // Asgarnian Ice Dungeon + STEPS, + // Fossil Island Wyvern Cave + STAIRS_31485), + BRIMHAVEN_DUNGEON_MEDIUM_PIPE_RETURN(1, "Pipe Squeeze", null, new WorldPoint(2698, 9491, 0), PIPE_21727), + BRIMHAVEN_DUNGEON_PIPE_RETURN(1, "Pipe Squeeze", null, new WorldPoint(2655, 9573, 0), PIPE_21728), + BRIMHAVEN_DUNGEON_STEPPING_STONES_RETURN(1, "Pipe Squeeze", null, STEPPING_STONE_21739), + BRIMHAVEN_DUNGEON_LOG_BALANCE_RETURN(1, "Log Balance", null, LOG_BALANCE_20884), + AGILITY_PYRAMID_ROCKS_WEST(1, "Rocks", null, CLIMBING_ROCKS_11948), + CAIRN_ISLE_CLIMBING_ROCKS(1, "Rocks", null, CLIMBING_ROCKS), + KARAMJA_GLIDER_LOG(1, "Log Balance", new WorldPoint(2906, 3050, 0), A_WOODEN_LOG ), + FALADOR_CRUMBLING_WALL(5, "Crumbling Wall", new WorldPoint(2936, 3357, 0), CRUMBLING_WALL_24222 ), + RIVER_LUM_GRAPPLE_WEST(8, "Grapple Broken Raft", new WorldPoint(3245, 3179, 0), BROKEN_RAFT), + RIVER_LUM_GRAPPLE_EAST(8, "Grapple Broken Raft", new WorldPoint(3258, 3179, 0), BROKEN_RAFT), + CORSAIR_COVE_ROCKS(10, "Rocks", new WorldPoint(2545, 2871, 0), ROCKS_31757), + KARAMJA_MOSS_GIANT_SWING(10, "Rope", null, ROPESWING_23568, ROPESWING_23569), + FALADOR_GRAPPLE_WALL(11, "Grapple Wall", new WorldPoint(3031, 3391, 0), WALL_17049, WALL_17050), + BRIMHAVEN_DUNGEON_STEPPING_STONES(12, "Stepping Stones", null, STEPPING_STONE_21738), + VARROCK_SOUTH_FENCE(13, "Fence", new WorldPoint(3239, 3334, 0), FENCE_16518), + GOBLIN_VILLAGE_WALL(14, "Wall", new WorldPoint(2925, 3523, 0), TIGHTGAP), + CORSAIR_COVE_DUNGEON_PILLAR(15, "Pillar Jump", new WorldPoint(1980, 8996, 0), PILLAR_31809), + EDGEVILLE_DUNGEON_MONKEYBARS(15, "Monkey Bars", null, MONKEYBARS_23566), + TROLLHEIM_ROCKS(15, "Rocks", null, new WorldPoint(2838, 3614, 0), ROCKS_3748), // No fixed world map location, but rocks near death plateau have a requirement of 15 + YANILLE_UNDERWALL_TUNNEL(16, "Underwall Tunnel", new WorldPoint(2574, 3109, 0), HOLE_16520, WALL_17047), + YANILLE_WATCHTOWER_TRELLIS(18, "Trellis", null, TRELLIS_20056), + COAL_TRUCKS_LOG_BALANCE(20, "Log Balance", new WorldPoint(2598, 3475, 0), LOG_BALANCE_23274), + GRAND_EXCHANGE_UNDERWALL_TUNNEL(21, "Underwall Tunnel", new WorldPoint(3139, 3515, 0), UNDERWALL_TUNNEL_16529, UNDERWALL_TUNNEL_16530), + BRIMHAVEN_DUNGEON_PIPE(22, "Pipe Squeeze", new WorldPoint(2654, 9569, 0), PIPE_21728), + OBSERVATORY_SCALE_CLIFF(23, "Grapple Rocks", new WorldPoint(2447, 3155, 0), NULL_31849), + EAGLES_PEAK_ROCK_CLIMB(25, "Rock Climb", new WorldPoint(2320, 3499, 0), ROCKS_19849), + FALADOR_UNDERWALL_TUNNEL(26, "Underwall Tunnel", new WorldPoint(2947, 3313, 0), UNDERWALL_TUNNEL, UNDERWALL_TUNNEL_16528), + MOUNT_KARUULM_LOWER(29, "Rocks", new WorldPoint(1324, 3782, 0), ROCKS_34397), + CORSAIR_COVE_RESOURCE_ROCKS(30, "Rocks", new WorldPoint(2486, 2898, 0), ROCKS_31758, ROCKS_31759), + SOUTHEAST_KARAJMA_STEPPING_STONES(30, "Stepping Stones", new WorldPoint(2924, 2946, 0), STEPPING_STONES, STEPPING_STONES_23646, STEPPING_STONES_23647), + BRIMHAVEN_DUNGEON_LOG_BALANCE(30, "Log Balance", null, LOG_BALANCE_20882), + AGILITY_PYRAMID_ROCKS_EAST(30, "Rocks", null, CLIMBING_ROCKS_11949), + DRAYNOR_MANOR_STEPPING_STONES(31, "Stepping Stones", new WorldPoint(3150, 3362, 0), STEPPING_STONE_16533), + CATHERBY_CLIFFSIDE_GRAPPLE(32, "Grapple Rock", new WorldPoint(2868, 3429, 0), ROCKS_17042), + CAIRN_ISLE_ROCKS(32, "Rocks", null, ROCKS_2231), + ARDOUGNE_LOG_BALANCE(33, "Log Balance", new WorldPoint(2602, 3336, 0), LOG_BALANCE_16546, LOG_BALANCE_16547, LOG_BALANCE_16548), + BRIMHAVEN_DUNGEON_MEDIUM_PIPE(34, "Pipe Squeeze", null, new WorldPoint(2698, 9501, 0), PIPE_21727), + CATHERBY_OBELISK_GRAPPLE(36, "Grapple Rock", new WorldPoint(2841, 3434, 0), CROSSBOW_TREE_17062), + GNOME_STRONGHOLD_ROCKS(37, "Rocks", new WorldPoint(2485, 3515, 0), ROCKS_16534, ROCKS_16535), + AL_KHARID_MINING_PITCLIFF_SCRAMBLE(38, "Rocks", new WorldPoint(3305, 3315, 0), ROCKS_16549, ROCKS_16550), + YANILLE_WALL_GRAPPLE(39, "Grapple Wall", new WorldPoint(2552, 3072, 0), CASTLE_WALL), + NEITIZNOT_BRIDGE_REPAIR(40, "Bridge Repair - Quest", new WorldPoint(2315, 3828, 0), ROPE_BRIDGE_21306, ROPE_BRIDGE_21307), + KOUREND_LAKE_JUMP_EAST(40, "Stepping Stones", new WorldPoint(1612, 3570, 0), STEPPING_STONE_29729, STEPPING_STONE_29730), + KOUREND_LAKE_JUMP_WEST(40, "Stepping Stones", new WorldPoint(1604, 3572, 0), STEPPING_STONE_29729, STEPPING_STONE_29730), + YANILLE_DUNGEON_BALANCE(40, "Balancing Ledge", null, BALANCING_LEDGE_23548), + TROLLHEIM_EASY_CLIFF_SCRAMBLE(41, "Rocks", new WorldPoint(2869, 3670, 0), ROCKS_16521), + DWARVEN_MINE_NARROW_CREVICE(42, "Narrow Crevice", new WorldPoint(3034, 9806, 0), CREVICE_16543), + DRAYNOR_UNDERWALL_TUNNEL(42, "Underwall Tunnel", new WorldPoint(3068, 3261, 0), UNDERWALL_TUNNEL_19032, UNDERWALL_TUNNEL_19036), + TROLLHEIM_MEDIUM_CLIFF_SCRAMBLE_NORTH(43, "Rocks", new WorldPoint(2886, 3684, 0), ROCKS_3803, ROCKS_3804, ROCKS_16522), + TROLLHEIM_MEDIUM_CLIFF_SCRAMBLE_SOUTH(43, "Rocks", new WorldPoint(2876, 3666, 0), ROCKS_3803, ROCKS_3804, ROCKS_16522), + TROLLHEIM_ADVANCED_CLIFF_SCRAMBLE(44, "Rocks", new WorldPoint(2907, 3686, 0), ROCKS_16523, ROCKS_3748), + KOUREND_RIVER_STEPPING_STONES(45, "Stepping Stones", new WorldPoint(1721, 3509, 0), STEPPING_STONE_29728), + TIRANNWN_LOG_BALANCE(45, "Log Balance", null, LOG_BALANCE_3933, LOG_BALANCE_3931, LOG_BALANCE_3930, LOG_BALANCE_3929, LOG_BALANCE_3932), + COSMIC_ALTAR_MEDIUM_WALKWAY(46, "Narrow Walkway", new WorldPoint(2399, 4403, 0), JUTTING_WALL_17002), + DEEP_WILDERNESS_DUNGEON_CREVICE_NORTH(46, "Narrow Crevice", new WorldPoint(3047, 10335, 0), CREVICE_19043), + DEEP_WILDERNESS_DUNGEON_CREVICE_SOUTH(46, "Narrow Crevice", new WorldPoint(3045, 10327, 0), CREVICE_19043), + TROLLHEIM_HARD_CLIFF_SCRAMBLE(47, "Rocks", new WorldPoint(2902, 3680, 0), ROCKS_16524), + FREMENNIK_LOG_BALANCE(48, "Log Balance", new WorldPoint(2721, 3591, 0), LOG_BALANCE_16540, LOG_BALANCE_16541, LOG_BALANCE_16542), + YANILLE_DUNGEON_PIPE_SQUEEZE(49, "Pipe Squeeze", null, OBSTACLE_PIPE_23140), + ARCEUUS_ESSENCE_MINE_BOULDER(49, "Boulder", new WorldPoint(1774, 3888, 0), BOULDER_27990), + MORYTANIA_STEPPING_STONE(50, "Stepping Stone", new WorldPoint(3418, 3326, 0), STEPPING_STONE_13504), + VARROCK_SEWERS_PIPE_SQUEEZE(51, "Pipe Squeeze", new WorldPoint(3152, 9905, 0), OBSTACLE_PIPE_16511), + ARCEUUS_ESSENCE_MINE_EAST_SCRAMBLE(52, "Rock Climb", new WorldPoint(1770, 3851, 0), ROCKS_27987, ROCKS_27988), + KARAMJA_VOLCANO_GRAPPLE_NORTH(53, "Grapple Rock", new WorldPoint(2873, 3143, 0), STRONG_TREE_17074), + KARAMJA_VOLCANO_GRAPPLE_SOUTH(53, "Grapple Rock", new WorldPoint(2874, 3128, 0), STRONG_TREE_17074), + MOTHERLODE_MINE_WALL_EAST(54, "Wall", new WorldPoint(3124, 9703, 0), DARK_TUNNEL_10047), + MOTHERLODE_MINE_WALL_WEST(54, "Wall", new WorldPoint(3118, 9702, 0), DARK_TUNNEL_10047), + MISCELLANIA_DOCK_STEPPING_STONE(55, "Stepping Stone", new WorldPoint(2572, 3862, 0), STEPPING_STONE_11768), + ISAFDAR_FOREST_OBSTACLES(56, "Trap", null, DENSE_FOREST_3938, DENSE_FOREST_3939, DENSE_FOREST_3998, DENSE_FOREST_3999, DENSE_FOREST, LEAVES, LEAVES_3924, LEAVES_3925, STICKS, TRIPWIRE), + RELEKKA_EAST_FENCE(57, "Fence", new WorldPoint(2688, 3697, 0), BROKEN_FENCE), + YANILLE_DUNGEON_MONKEY_BARS(57, "Monkey Bars", null, MONKEYBARS_23567), + PHASMATYS_ECTOPOOL_SHORTCUT(58, "Weathered Wall", null , WEATHERED_WALL, WEATHERED_WALL_16526), + ELVEN_OVERPASS_CLIFF_SCRAMBLE(59, "Rocks", new WorldPoint(2345, 3300, 0), ROCKS_16514, ROCKS_16515), + WILDERNESS_GWD_CLIMB_EAST(60, "Rocks", new WorldPoint(2943, 3770, 0), ROCKY_HANDHOLDS_26400, ROCKY_HANDHOLDS_26401, ROCKY_HANDHOLDS_26402, ROCKY_HANDHOLDS_26404, ROCKY_HANDHOLDS_26405, ROCKY_HANDHOLDS_26406), + WILDERNESS_GWD_CLIMB_WEST(60, "Rocks", new WorldPoint(2928, 3760, 0), ROCKY_HANDHOLDS_26400, ROCKY_HANDHOLDS_26401, ROCKY_HANDHOLDS_26402, ROCKY_HANDHOLDS_26404, ROCKY_HANDHOLDS_26405, ROCKY_HANDHOLDS_26406), + MOS_LEHARMLESS_STEPPING_STONE(60, "Stepping Stone", new WorldPoint(3710, 2970, 0), STEPPING_STONE_19042), + WINTERTODT_GAP(60, "Gap", new WorldPoint(1629, 4023, 0), GAP_29326), + UNGAEL_ICE(60, "Ice Chunks", null, NULL_25337, NULL_29868, NULL_29869, NULL_29870, ICE_CHUNKS_31822, NULL_31823, ICE_CHUNKS_31990), + SLAYER_TOWER_MEDIUM_CHAIN_FIRST(61, "Spiked Chain (Floor 1)", new WorldPoint(3421, 3550, 0), SPIKEY_CHAIN), + SLAYER_TOWER_MEDIUM_CHAIN_SECOND(61, "Spiked Chain (Floor 2)", new WorldPoint(3420, 3551, 0), SPIKEY_CHAIN_16538), + SLAYER_DUNGEON_CREVICE(62, "Narrow Crevice", new WorldPoint(2729, 10008, 0), CREVICE_16539), + MOUNT_KARUULM_UPPER(62, "Rocks", new WorldPoint(1322, 3791, 0), ROCKS_34396), + TAVERLEY_DUNGEON_RAILING(63, "Loose Railing", new WorldPoint(2935, 9811, 0), LOOSE_RAILING_28849), + TROLLHEIM_WILDERNESS_ROCKS_EAST(64, "Rocks", new WorldPoint(2945, 3678, 0), ROCKS_16545), + TROLLHEIM_WILDERNESS_ROCKS_WEST(64, "Rocks", new WorldPoint(2917, 3672, 0), ROCKS_16545), + FOSSIL_ISLAND_VOLCANO(64, "Rope", new WorldPoint(3780, 3822, 0), ROPE_ANCHOR, ROPE_ANCHOR_30917), + MORYTANIA_TEMPLE(65, "Loose Railing", new WorldPoint(3422, 3476, 0), ROCKS_16998, ROCKS_16999, ORNATE_RAILING, ORNATE_RAILING_17000), + REVENANT_CAVES_GREEN_DRAGONS(65, "Jump", new WorldPoint(3220, 10086, 0), PILLAR_31561), + COSMIC_ALTAR_ADVANCED_WALKWAY(66, "Narrow Walkway", new WorldPoint(2408, 4401, 0), JUTTING_WALL_17002), + LUMBRIDGE_DESERT_STEPPING_STONE(66, "Stepping Stone", new WorldPoint(3210, 3135, 0), STEPPING_STONE_16513), + HEROES_GUILD_TUNNEL_EAST(67, "Crevice", new WorldPoint(2898, 9901, 0), CREVICE_9739, CREVICE_9740), + HEROES_GUILD_TUNNEL_WEST(67, "Crevice", new WorldPoint(2913, 9895, 0), CREVICE_9739, CREVICE_9740), + YANILLE_DUNGEON_RUBBLE_CLIMB(67, "Pile of Rubble", null, PILE_OF_RUBBLE_23563, PILE_OF_RUBBLE_23564), + ELVEN_OVERPASS_MEDIUM_CLIFF(68, "Rocks", new WorldPoint(2337, 3288, 0), ROCKS_16514, ROCKS_16515), + WEISS_OBSTACLES(68, "Shortcut", null, LITTLE_BOULDER, ROCKSLIDE_33184, ROCKSLIDE_33185, NULL_33327, NULL_33328, LEDGE_33190, ROCKSLIDE_33191, FALLEN_TREE_33192), + ARCEUUS_ESSENSE_NORTH(69, "Rock Climb", new WorldPoint(1759, 3873, 0), ROCKS_27984, ROCKS_27985), + TAVERLEY_DUNGEON_PIPE_BLUE_DRAGON(70, "Pipe Squeeze", new WorldPoint(2886, 9798, 0), OBSTACLE_PIPE_16509), + TAVERLEY_DUNGEON_ROCKS_NORTH(70, "Rocks", new WorldPoint(2887, 9823, 0), ROCKS, ROCKS_14106), + TAVERLEY_DUNGEON_ROCKS_SOUTH(70, "Rocks", new WorldPoint(2887, 9631, 0), ROCKS, ROCKS_14106), + FOSSIL_ISLAND_HARDWOOD_NORTH(70, "Hole" , new WorldPoint(3713, 3827, 0), HOLE_31481, HOLE_31482), + FOSSIL_ISLAND_HARDWOOD_SOUTH(70, "Hole" , new WorldPoint(3715, 3817, 0), HOLE_31481, HOLE_31482), + AL_KHARID_WINDOW(70, "Window", new WorldPoint(3293, 3158, 0), BROKEN_WALL_33344, BIG_WINDOW), + GWD_SARADOMIN_ROPE_NORTH(70, "Rope Descent", new WorldPoint(2912, 5300, 0), NULL_26371), + GWD_SARADOMIN_ROPE_SOUTH(70, "Rope Descent", new WorldPoint(2951, 5267, 0), NULL_26375), + SLAYER_TOWER_ADVANCED_CHAIN_FIRST(71, "Spiked Chain (Floor 2)", new WorldPoint(3447, 3578, 0), SPIKEY_CHAIN ), + SLAYER_TOWER_ADVANCED_CHAIN_SECOND(71, "Spiked Chain (Floor 3)", new WorldPoint(3446, 3576, 0), SPIKEY_CHAIN_16538), + STRONGHOLD_SLAYER_CAVE_TUNNEL(72, "Tunnel", new WorldPoint(2431, 9806, 0), TUNNEL_30174, TUNNEL_30175), + TROLL_STRONGHOLD_WALL_CLIMB(73, "Rocks", new WorldPoint(2841, 3694, 0), ROCKS_16464), + ARCEUUS_ESSENSE_MINE_WEST(73, "Rock Climb", new WorldPoint(1742, 3853, 0), ROCKS_27984, ROCKS_27985 ), + LAVA_DRAGON_ISLE_JUMP(74, "Stepping Stone", new WorldPoint(3200, 3807, 0), STEPPING_STONE_14918), + REVENANT_CAVES_DEMONS_JUMP(75, "Jump", new WorldPoint(3199, 10135, 0), PILLAR_31561), + REVENANT_CAVES_ANKOU_EAST(75, "Jump", new WorldPoint(3201, 10195, 0), PILLAR_31561), + REVENANT_CAVES_ANKOU_NORTH(75, "Jump", new WorldPoint(3180, 10209, 0), PILLAR_31561), + ZUL_ANDRA_ISLAND_CROSSING(76, "Stepping Stone", new WorldPoint(2156, 3073, 0), STEPPING_STONE_10663), + SHILO_VILLAGE_STEPPING_STONES( 77, "Stepping Stones", new WorldPoint(2863, 2974, 0), STEPPING_STONE_16466), + KHARAZI_JUNGLE_VINE_CLIMB(79, "Vine", new WorldPoint(2897, 2939, 0), NULL_26884, NULL_26886), + TAVERLEY_DUNGEON_SPIKED_BLADES(80, "Strange Floor", new WorldPoint(2877, 9813, 0), STRANGE_FLOOR), + SLAYER_DUNGEON_CHASM_JUMP(81, "Spiked Blades", new WorldPoint(2770, 10003, 0), STRANGE_FLOOR_16544), + LAVA_MAZE_NORTH_JUMP(82, "Stepping Stone", new WorldPoint(3092, 3880, 0), STEPPING_STONE_14917), + BRIMHAVEN_DUNGEON_EAST_STEPPING_STONES_NORTH(83, "Stepping Stones", new WorldPoint(2685, 9547, 0), STEPPING_STONE_19040), + BRIMHAVEN_DUNGEON_EAST_STEPPING_STONES_SOUTH(83, "Stepping Stones", new WorldPoint(2693, 9529, 0), STEPPING_STONE_19040), + ELVEN_ADVANCED_CLIFF_SCRAMBLE(85, "Rocks", new WorldPoint(2337, 3253, 0), ROCKS_16514, ROCKS_16514), + KALPHITE_WALL(86, "Crevice", new WorldPoint(3214, 9508, 0), CREVICE_16465), + BRIMHAVEN_DUNGEON_VINE_EAST(87, "Vine", new WorldPoint(2672, 9582, 0), VINE_26880, VINE_26882), + BRIMHAVEN_DUNGEON_VINE_WEST(87, "Vine", new WorldPoint(2606, 9584, 0), VINE_26880, VINE_26882), + REVENANT_CAVES_CHAMBER_JUMP(89, "Jump", new WorldPoint(3240, 10144, 0), PILLAR_31561); + + /** + * The agility level required to pass the shortcut + */ + @Getter + private final int level; + /** + * Brief description of the shortcut (e.g. 'Rocks', 'Stepping Stones', 'Jump') + */ + @Getter + private final String description; + /** + * The location of the Shortcut icon on the world map (null if there is no icon) + */ + @Getter + private final WorldPoint worldMapLocation; + /** + * An optional location in case the location of the shortcut icon is either + * null or isn't close enough to the obstacle + */ + @Getter + private final WorldPoint worldLocation; + /** + * Array of obstacles, null objects, decorations etc. that this shortcut uses. + * Typically an ObjectID/NullObjectID + */ + @Getter + private final int[] obstacleIds; + + AgilityShortcut(int level, String description, WorldPoint mapLocation, WorldPoint worldLocation, int... obstacleIds) + { + this.level = level; + this.description = description; + this.worldMapLocation = mapLocation; + this.worldLocation = worldLocation; + this.obstacleIds = obstacleIds; + } + + AgilityShortcut(int level, String description, WorldPoint location, int... obstacleIds) + { + this(level, description, location, location, obstacleIds); + } + + public String getTooltip() + { + return description + " - Level " + level; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java index bc6e953f6d..e9c205f64f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java @@ -36,6 +36,7 @@ import net.runelite.api.Client; import net.runelite.api.Point; import net.runelite.api.Tile; import net.runelite.api.coords.LocalPoint; +import net.runelite.client.game.AgilityShortcut; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; @@ -44,6 +45,7 @@ import net.runelite.client.ui.overlay.OverlayUtil; class AgilityOverlay extends Overlay { private static final int MAX_DISTANCE = 2350; + private static final Color SHORTCUT_HIGH_LEVEL_COLOR = Color.ORANGE; private final Client client; private final AgilityPlugin plugin; @@ -66,14 +68,15 @@ class AgilityOverlay extends Overlay LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation(); Point mousePosition = client.getMouseCanvasPosition(); final List marksOfGrace = plugin.getMarksOfGrace(); - plugin.getObstacles().forEach((object, tile) -> + plugin.getObstacles().forEach((object, obstacle) -> { - if (Obstacles.SHORTCUT_OBSTACLE_IDS.contains(object.getId()) && !config.highlightShortcuts() || + if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(object.getId()) && !config.highlightShortcuts() || Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId()) && !config.showTrapOverlay()) { return; } + Tile tile = obstacle.getTile(); if (tile.getPlane() == client.getPlane() && object.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) { @@ -87,11 +90,11 @@ class AgilityOverlay extends Overlay } return; } - Area objectClickbox = object.getClickbox(); if (objectClickbox != null) { - Color configColor = config.getOverlayColor(); + AgilityShortcut agilityShortcut = obstacle.getShortcut(); + Color configColor = agilityShortcut == null || agilityShortcut.getLevel() <= plugin.getAgilityLevel() ? config.getOverlayColor() : SHORTCUT_HIGH_LEVEL_COLOR; if (config.highlightMarks() && !marksOfGrace.isEmpty()) { configColor = config.getMarkColor(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java index cd60c6b940..c895a07980 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java @@ -38,10 +38,12 @@ import net.runelite.api.Item; import net.runelite.api.ItemID; import static net.runelite.api.ItemID.AGILITY_ARENA_TICKET; import net.runelite.api.Player; +import net.runelite.api.Skill; import static net.runelite.api.Skill.AGILITY; import net.runelite.api.Tile; import net.runelite.api.TileObject; import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.BoostedLevelChanged; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.DecorativeObjectChanged; import net.runelite.api.events.DecorativeObjectDespawned; @@ -63,6 +65,7 @@ import net.runelite.api.events.WallObjectSpawned; import net.runelite.client.Notifier; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.AgilityShortcut; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -80,7 +83,7 @@ public class AgilityPlugin extends Plugin private static final int AGILITY_ARENA_REGION_ID = 11157; @Getter - private final Map obstacles = new HashMap<>(); + private final Map obstacles = new HashMap<>(); @Getter private final List marksOfGrace = new ArrayList<>(); @@ -115,6 +118,9 @@ public class AgilityPlugin extends Plugin private int lastAgilityXp; private WorldPoint lastArenaTicketPosition; + @Getter + private int agilityLevel; + @Provides AgilityConfig getConfig(ConfigManager configManager) { @@ -126,6 +132,7 @@ public class AgilityPlugin extends Plugin { overlayManager.add(agilityOverlay); overlayManager.add(lapCounterOverlay); + agilityLevel = client.getBoostedSkillLevel(Skill.AGILITY); } @Override @@ -136,6 +143,7 @@ public class AgilityPlugin extends Plugin marksOfGrace.clear(); obstacles.clear(); session = null; + agilityLevel = 0; } @Subscribe @@ -208,6 +216,17 @@ public class AgilityPlugin extends Plugin } } + + @Subscribe + public void onBoostedLevelChanged(BoostedLevelChanged boostedLevelChanged) + { + Skill skill = boostedLevelChanged.getSkill(); + if (skill == AGILITY) + { + agilityLevel = client.getBoostedSkillLevel(skill); + } + } + @Subscribe public void onItemSpawned(ItemSpawned itemSpawned) { @@ -366,11 +385,40 @@ public class AgilityPlugin extends Plugin } if (Obstacles.COURSE_OBSTACLE_IDS.contains(newObject.getId()) || - Obstacles.SHORTCUT_OBSTACLE_IDS.contains(newObject.getId()) || (Obstacles.TRAP_OBSTACLE_IDS.contains(newObject.getId()) && Obstacles.TRAP_OBSTACLE_REGIONS.contains(newObject.getWorldLocation().getRegionID()))) { - obstacles.put(newObject, tile); + obstacles.put(newObject, new Obstacle(tile, null)); + } + + if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(newObject.getId())) + { + AgilityShortcut closestShortcut = null; + int distance = -1; + + // Find the closest shortcut to this object + for (AgilityShortcut shortcut : Obstacles.SHORTCUT_OBSTACLE_IDS.get(newObject.getId())) + { + if (shortcut.getWorldLocation() == null) + { + closestShortcut = shortcut; + break; + } + else + { + int newDistance = shortcut.getWorldLocation().distanceTo2D(newObject.getWorldLocation()); + if (closestShortcut == null || newDistance < distance) + { + closestShortcut = shortcut; + distance = newDistance; + } + } + } + + if (closestShortcut != null) + { + obstacles.put(newObject, new Obstacle(tile, closestShortcut)); + } } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacle.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacle.java new file mode 100644 index 0000000000..6038de468b --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacle.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019, MrGroggle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.agility; + +import javax.annotation.Nullable; +import lombok.AllArgsConstructor; +import lombok.Value; +import net.runelite.api.Tile; +import net.runelite.client.game.AgilityShortcut; + +@Value +@AllArgsConstructor +class Obstacle +{ + private final Tile tile; + @Nullable + private final AgilityShortcut shortcut; +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java index 43a96bd151..4506891e99 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java @@ -25,11 +25,27 @@ package net.runelite.client.plugins.agility; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Multimap; import java.util.List; import java.util.Set; -import static net.runelite.api.NullObjectID.*; +import static net.runelite.api.NullObjectID.NULL_10872; +import static net.runelite.api.NullObjectID.NULL_10873; +import static net.runelite.api.NullObjectID.NULL_12945; +import static net.runelite.api.NullObjectID.NULL_18083; +import static net.runelite.api.NullObjectID.NULL_18116; +import static net.runelite.api.NullObjectID.NULL_18122; +import static net.runelite.api.NullObjectID.NULL_18124; +import static net.runelite.api.NullObjectID.NULL_18129; +import static net.runelite.api.NullObjectID.NULL_18130; +import static net.runelite.api.NullObjectID.NULL_18132; +import static net.runelite.api.NullObjectID.NULL_18133; +import static net.runelite.api.NullObjectID.NULL_18135; +import static net.runelite.api.NullObjectID.NULL_18136; +import static net.runelite.api.NullObjectID.NULL_3550; import static net.runelite.api.ObjectID.*; +import net.runelite.client.game.AgilityShortcut; class Obstacles { @@ -91,144 +107,7 @@ class Obstacles ZIP_LINE_11645, ZIP_LINE_11646 ); - static final Set SHORTCUT_OBSTACLE_IDS = ImmutableSet.of( - // Grand Exchange - UNDERWALL_TUNNEL_16529, UNDERWALL_TUNNEL_16530, - // South Varrock - STEPPING_STONE_16533, FENCE_16518, ROCKS_16549, ROCKS_16550, - // Falador - WALL_17049, WALL_17050, CRUMBLING_WALL_24222, UNDERWALL_TUNNEL, UNDERWALL_TUNNEL_16528, CREVICE_16543, - // Draynor - UNDERWALL_TUNNEL_19032, UNDERWALL_TUNNEL_19036, - // South Lumbridge - BROKEN_RAFT, STEPPING_STONE_16513, - // Trollheim - ROCKS_3790, ROCKS_3791, ROCKS_3803, ROCKS_3804, ROCKS_16523, ROCKS_16524, ROCKS_3748, ROCKS_16545, ROCKS_16521, - ROCKS_16522, ROCKS_16464, - // North Camelot - LOG_BALANCE_16540, LOG_BALANCE_16541, LOG_BALANCE_16542, - // Rellekka - BROKEN_FENCE, - // Ardougne - LOG_BALANCE_16546, LOG_BALANCE_16547, LOG_BALANCE_16548, - // Yanille - CASTLE_WALL, HOLE_16520, WALL_17047, - // Observatory - NULL_31849, - // Gnome Stronghold - ROCKS_16534, ROCKS_16535, - // Karamja Volcano - STRONG_TREE_17074, - // Shilo Village - STEPPING_STONE_16466, - // Vine east of Shilo Village - NULL_26884, NULL_26886, - // Stepping stones east of Shilo Village - STEPPING_STONES, STEPPING_STONES_23646, STEPPING_STONES_23647, - // Middle of Karamja - A_WOODEN_LOG, - // Slayer Tower - SPIKEY_CHAIN, SPIKEY_CHAIN_16538, - // Fremennik Slayer Cave - STRANGE_FLOOR_16544, CREVICE_16539, STEPS_29993, - // Wilderness - STEPPING_STONE_14918, STEPPING_STONE_14917, ROCKY_HANDHOLDS_26404, ROCKY_HANDHOLDS_26405, ROCKY_HANDHOLDS_26406, - // Godwars - ROCKY_HANDHOLDS_26400, ROCKY_HANDHOLDS_26401, ROCKY_HANDHOLDS_26402, - // Seers' Village Coal Mine - LOG_BALANCE_23274, - // Arceuus Essence Mine - ROCKS_27984, ROCKS_27985, BOULDER_27990, ROCKS_27987, ROCKS_27988, - // Wintertodt - GAP_29326, - // Gnome Stronghold Slayer Underground - TUNNEL_30174, TUNNEL_30175, - // Taverley Underground - OBSTACLE_PIPE_16509, STRANGE_FLOOR, ROCKS, ROCKS_14106, LOOSE_RAILING_28849, - // Heroes Guild - CREVICE_9739, CREVICE_9740, - // Fossil Island - HOLE_31481, HOLE_31482, LADDER_30938, LADDER_30939, LADDER_30940, LADDER_30941, ROPE_ANCHOR, ROPE_ANCHOR_30917, - RUBBER_CAP_MUSHROOM, - ROCKS_31757, ROCKS_31758, ROCKS_31759, PILLAR_31809, - // West Brimhaven - ROPESWING_23568, ROPESWING_23569, - // Brimhaven Dungeon - VINE_26880, VINE_26882, PIPE_21728, STEPPING_STONE_19040, PIPE_21727, LOG_BALANCE_20882, LOG_BALANCE_20884, - STEPPING_STONE_21738, STEPPING_STONE_21739, TIGHTGAP, - // Lumbridge - STILE_12982, - // Edgeville Dungeon - MONKEYBARS_23566, OBSTACLE_PIPE_16511, - // Miscellania - STEPPING_STONE_11768, - // Kalphite - CREVICE_16465, - // Eagles' Peak - ROCKS_19849, - // Catherby - CROSSBOW_TREE_17062, ROCKS_17042, - // McGrubor's Woods - LOOSE_RAILING, - // Cairn Isle - ROCKS_2231, - // South Kourend - STEPPING_STONE_29728, STEPPING_STONE_29729, STEPPING_STONE_29730, - // Cosmic Temple - JUTTING_WALL_17002, - // Arandar - ROCKS_16514, ROCKS_16515, LOG_BALANCE_3933, - // South River Salve - STEPPING_STONE_13504, - DARK_TUNNEL_10047, - // Ectofuntus - WEATHERED_WALL, WEATHERED_WALL_16526, - // Mos Le'Harmless - STEPPING_STONE_19042, - // North River Salve - ROCKS_16998, ROCKS_16999, ORNATE_RAILING, ORNATE_RAILING_17000, - // West Zul-Andra - STEPPING_STONE_10663, - // Yanille Agility Dungeon - BALANCING_LEDGE_23548, OBSTACLE_PIPE_23140, MONKEYBARS_23567, PILE_OF_RUBBLE_23563, PILE_OF_RUBBLE_23564, - // High Level Wilderness Dungeon - CREVICE_19043, - // Revenant Caves - PILLAR_31561, - // Elf Camp Isafdar Tirranwn - LOG_BALANCE_3931, LOG_BALANCE_3930, LOG_BALANCE_3929, LOG_BALANCE_3932, DENSE_FOREST_3938, DENSE_FOREST_3939, - DENSE_FOREST_3998, DENSE_FOREST_3999, DENSE_FOREST, LEAVES, LEAVES_3924, LEAVES_3925, STICKS, TRIPWIRE, - // Gu'Tanoth bridge - GAP, GAP_2831, - // Lumbridge Swamp Caves - STEPPING_STONE_5948, STEPPING_STONE_5949, ROCKS_6673, - // Morytania Pirate Ship - ROCK_16115, - // Agility Pyramid Entrance - CLIMBING_ROCKS_11948, CLIMBING_ROCKS_11949, - // Lumber Yard - BROKEN_FENCE_2618, - // Ungael and Vorkath crater - NULL_25337, NULL_29868, NULL_29869, NULL_29870, ICE_CHUNKS_31822, NULL_31823, ICE_CHUNKS_31990, - // Underwater Area Fossil Island - TUNNEL_30959, HOLE_30966, OBSTACLE, OBSTACLE_30767, OBSTACLE_30964, OBSTACLE_30962, - // Tree Gnome Village - LOOSE_RAILING_2186, - // Weiss - LITTLE_BOULDER, ROCKSLIDE_33184, ROCKSLIDE_33185, NULL_33327, NULL_33328, LEDGE_33190, ROCKSLIDE_33191, FALLEN_TREE_33192, - // Al-Kharid - BROKEN_WALL_33344, BIG_WINDOW, - // Burgh de Rott - LOW_FENCE, - // Taverley - STILE, - // Asgarnian Ice Dungeon - STEPS, - // Fossil Island Wyvern Cave - STAIRS_31485, - // Mount Karuulm - ROCKS_34397, ROCKS_34396 - ); + static final Multimap SHORTCUT_OBSTACLE_IDS; static final Set TRAP_OBSTACLE_IDS = ImmutableSet.of( // Agility pyramid @@ -236,4 +115,17 @@ class Obstacles ); static final List TRAP_OBSTACLE_REGIONS = ImmutableList.of(12105, 13356); + + static + { + final ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); + for (final AgilityShortcut item : AgilityShortcut.values()) + { + for (int obstacle : item.getObstacleIds()) + { + builder.put(obstacle, item); + } + } + SHORTCUT_OBSTACLE_IDS = builder.build(); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutLocation.java deleted file mode 100644 index c0b95cfa32..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutLocation.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.worldmap; - -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@Getter -enum AgilityShortcutLocation -{ - KARAMJA_GLIDER_LOG("Log Balance", 1, new WorldPoint(2906, 3050, 0)), - FALADOR_CRUMBLING_WALL("Crumbling Wall", 5, new WorldPoint(2936, 3357, 0)), - RIVER_LUM_GRAPPLE_WEST("Grapple Broken Raft", 8, new WorldPoint(3245, 3179, 0)), - RIVER_LUM_GRAPPLE_EAST("Grapple Broken Raft", 8, new WorldPoint(3258, 3179, 0)), - CORSAIR_COVE_ROCKS("Rocks", 10, new WorldPoint(2545, 2871, 0)), - FALADOR_GRAPPLE_WALL("Grapple Wall", 11, new WorldPoint(3031, 3391, 0)), - VARROCK_SOUTH_FENCE("Fence", 13, new WorldPoint(3239, 3334, 0)), - GOBLIN_VILLAGE_WALL("Wall", 14, new WorldPoint(2925, 3523, 0)), - CORSAIR_COVE_DUNGEON_PILLAR("Pillar Jump", 15, new WorldPoint(1980, 8996, 0)), - YANILLE_UNDERWALL_TUNNEL("Underwall Tunnel", 16, new WorldPoint(2574, 3109, 0)), - COAL_TRUCKS_LOG_BALANCE("Log Balance", 20, new WorldPoint(2598, 3475, 0)), - GRAND_EXCHANGE_UNDERWALL_TUNNEL("Underwall Tunnel", 21, new WorldPoint(3139, 3515, 0)), - BRIMHAVEN_DUNGEON_PIPE("Pipe Squeeze", 22, new WorldPoint(2654, 9569, 0)), - OBSERVATORY_SCALE_CLIFF("Grapple Rocks", 23, new WorldPoint(2447, 3155, 0)), - EAGLES_PEAK_ROCK_CLIMB("Rock Climb", 25, new WorldPoint(2320, 3499, 0)), - FALADOR_UNDERWALL_TUNNEL("Underwall Tunnel", 26, new WorldPoint(2947, 3313, 0)), - MOUNT_KARUULM_LOWER("Rocks", 29, new WorldPoint(1324, 3782, 0)), - CORSAIR_COVE_RESOURCE_ROCKS("Rocks", 30, new WorldPoint(2545, 2871, 0)), - SOUTHEAST_KARAJMA_STEPPING_STONES("Stepping Stones", 30, new WorldPoint(2924, 2946, 0)), - DRAYNOR_MANOR_STEPPING_STONES("Stepping Stones", 31, new WorldPoint(3150, 3362, 0)), - CATHERBY_CLIFFSIDE_GRAPPLE("Grapple Rock", 32, new WorldPoint(2868, 3429, 0)), - ARDOUGNE_LOG_BALANCE("Log Balance", 33, new WorldPoint(2602, 3336, 0)), - GNOME_STRONGHOLD_ROCKS("Rocks", 37, new WorldPoint(2485, 3515, 0)), - AL_KHARID_MINING_PITCLIFF_SCRAMBLE("Rocks", 38, new WorldPoint(3305, 3315, 0)), - YANILLE_WALL_GRAPPLE("Grapple Wall", 39, new WorldPoint(2552, 3072, 0)), - NEITIZNOT_BRIDGE_REPAIR("Bridge Repair - Quest", 40, new WorldPoint(2315, 3828, 0)), - KOUREND_LAKE_JUMP_WEST("Stepping Stones", 40, new WorldPoint(1604, 3572, 0)), - KOUREND_LAKE_JUMP_EAST("Stepping Stones", 40, new WorldPoint(1612, 3570, 0)), - TROLLHEIM_EASY_CLIFF_SCRAMBLE("Rocks", 41, new WorldPoint(2869, 3670, 0)), - DWARVEN_MINE_NARROW_CREVICE("Narrow Crevice", 42, new WorldPoint(3034, 9806, 0)), - DRAYNOR_UNDERWALL_TUNNEL("Underwall Tunnel", 42, new WorldPoint(3068, 3261, 0)), - TROLLHEIM_MEDIUM_CLIFF_SCRAMBLE_NORTH("Rocks", 43, new WorldPoint(2886, 3684, 0)), - TROLLHEIM_MEDIUM_CLIFF_SCRAMBLE_SOUTH("Rocks", 43, new WorldPoint(2876, 3666, 0)), - TROLLHEIM_ADVANCED_CLIFF_SCRAMBLE("Rocks", 44, new WorldPoint(2907, 3686, 0)), - KOUREND_RIVER_STEPPING_STONES("Stepping Stones", 45, new WorldPoint(1721, 3509, 0)), - COSMIC_ALTAR_MEDIUM_WALKWAY("Narrow Walkway", 46, new WorldPoint(2399, 4403, 0)), - DEEP_WILDERNESS_DUNGEON_CREVICE_NORTH("Narrow Crevice", 46, new WorldPoint(3047, 10335, 0)), - DEEP_WILDERNESS_DUNGEON_CREVICE_SOUTH("Narrow Crevice", 46, new WorldPoint(3045, 10327, 0)), - TROLLHEIM_HARD_CLIFF_SCRAMBLE("Rocks", 47, new WorldPoint(2902, 3680, 0)), - FREMENNIK_LOG_BALANCE("Log Balance", 48, new WorldPoint(2721, 3591, 0)), - ARCEUUS_ESSENCE_MINE_BOULDER("Boulder", 49, new WorldPoint(1774, 3888, 0)), - MORYTANIA_STEPPING_STONE("Stepping Stone", 50, new WorldPoint(3418, 3326, 0)), - VARROCK_SEWERS_PIPE_SQUEEZE("Pipe Squeeze", 51, new WorldPoint(3152, 9905, 0)), - ARCEUUS_ESSENCE_MINE_EAST_SCRAMBLE("Rock Climb", 52, new WorldPoint(1770, 3851, 0)), - KARAMJA_VOLCANO_GRAPPLE_NORTH("Grapple Rock", 53, new WorldPoint(2873, 3143, 0)), - KARAMJA_VOLCANO_GRAPPLE_SOUTH("Grapple Rock", 53, new WorldPoint(2874, 3128, 0)), - MOTHERLODE_MINE_WALL_WEST("Wall", 54, new WorldPoint(3118, 9702, 0)), - MOTHERLODE_MINE_WALL_EAST("Wall", 54, new WorldPoint(3124, 9703, 0)), - MISCELLANIA_DOCK_STEPPING_STONE("Stepping Stone", 55, new WorldPoint(2572, 3862, 0)), - RELEKKA_EAST_FENCE("Fence", 57, new WorldPoint(2688, 3697, 0)), - ELVEN_OVERPASS_CLIFF_SCRAMBLE("Rocks", 59, new WorldPoint(2345, 3300, 0)), - WILDERNESS_GWD_CLIMB_WEST("Rocks", 60, new WorldPoint(2928, 3760, 0)), - WILDERNESS_GWD_CLIMB_EAST("Rocks", 60, new WorldPoint(2943, 3770, 0)), - MOS_LEHARMLESS_STEPPING_STONE("Stepping Stone", 60, new WorldPoint(3710, 2970, 0)), - WINTERTODT_GAP("Gap", 60, new WorldPoint(1629, 4023, 0)), - SLAYER_TOWER_MEDIUM_CHAIN_FIRST("Spiked Chain (Floor 1)", 61, new WorldPoint(3421, 3550, 0)), - SLAYER_TOWER_MEDIUM_CHAIN_SECOND("Spiked Chain (Floor 2)", 61, new WorldPoint(3420, 3551, 0)), - SLAYER_DUNGEON_CREVICE("Narrow Crevice", 62, new WorldPoint(2729, 10008, 0)), - MOUNT_KARUULM_UPPER("Rocks", 62, new WorldPoint(1322, 3791, 0)), - TAVERLEY_DUNGEON_RAILING("Loose Railing", 63, new WorldPoint(2935, 9811, 0)), - TROLLHEIM_WILDERNESS_ROCKS("Rocks", 64, new WorldPoint(2945, 3678, 0)), - FOSSIL_ISLAND_VOLCANO("Rope", 64, new WorldPoint(3780, 3822, 0)), - MORYTANIA_TEMPLE("Loose Railing", 65, new WorldPoint(3422, 3476, 0)), - REVENANT_CAVES_GREEN_DRAGONS("Jump", 65, new WorldPoint(3220, 10086, 0)), - COSMIC_ALTAR_ADVANCED_WALKWAY("Narrow Walkway", 66, new WorldPoint(2408, 4401, 0)), - LUMBRIDGE_DESERT_STEPPING_STONE("Stepping Stone", 66, new WorldPoint(3210, 3135, 0)), - HEROS_GUILD_TUNNEL_WEST("Crevice", 67, new WorldPoint(2898, 9901, 0)), - HEROS_GUILD_TUNNEL_EAST("Crevice", 67, new WorldPoint(2913, 9895, 0)), - ELVEN_OVERPASS_MEDIUM_CLIFF("Rocks", 68, new WorldPoint(2337, 3288, 0)), - ARCEUUS_ESSENSE_NORTH("Rock Climb", 69, new WorldPoint(1759, 3873, 0)), - TAVERLEY_DUNGEON_PIPE_BLUE_DRAGON("Pipe Squeeze", 70, new WorldPoint(2886, 9798, 0)), - FOSSIL_ISLAND_HARDWOOD("Hole", 70, new WorldPoint(3663, 3810, 0)), - GWD_SARADOMIN_ROPE_FIRST("Rope Descent", 70, new WorldPoint(2912, 5300, 0)), - GWD_SARADOMIN_ROPE_SECOND("Rope Descent", 70, new WorldPoint(2951, 5267, 0)), - SLAYER_TOWER_ADVANCED_CHAIN_FIRST("Spiked Chain (Floor 2)", 71, new WorldPoint(3447, 3578, 0)), - SLAYER_TOWER_ADVANCED_CHAIN_SECOND("Spiked Chain (Floor 3)", 71, new WorldPoint(3446, 3576, 0)), - SLAYER_CAVE_WALL_CLIMB("Tunnel", 72, new WorldPoint(2431, 9806, 0)), - TROLL_STRONGHOLD_WALL_CLIMB("Rocks", 73, new WorldPoint(2841, 3694, 0)), - ARCEUUS_ESSENSE_MINE_WEST("Rock Climb", 73, new WorldPoint(1742, 3853, 0)), - LAVA_DRAGON_ISLE_JUMP("Stepping Stone", 74, new WorldPoint(3200, 3807, 0)), - REVENANT_CAVES_DEMONS_JUMP("Jump", 75, new WorldPoint(3199, 10135, 0)), - REVENANT_CAVES_ANKOU_EAST("Jump", 75, new WorldPoint(3201, 10195, 0)), - REVENANT_CAVES_ANKOU_NORTH("Jump", 75, new WorldPoint(3180, 10209, 0)), - ZUL_ANDRA_ISLAND_CROSSING("Stepping Stone", 76, new WorldPoint(2156, 3073, 0)), - SHILO_VILLAGE_STEPPING_STONES("Stepping Stones", 77, new WorldPoint(2863, 2974, 0)), - KHARAZI_JUNGLE_VINE_CLIMB("Vine", 79, new WorldPoint(2897, 2939, 0)), - TAVERLEY_DUNGEON_SPIKED_BLADES("Strange Floor", 80, new WorldPoint(2877, 9813, 0)), - TAVERLEY_DUNGEON_ROCKS("Rocks", 70, new WorldPoint(2887, 9823, 0)), - SLAYER_DUNGEON_CHASM_JUMP("Spiked Blades", 81, new WorldPoint(2770, 10003, 0)), - LAVA_MAZE_NORTH_JUMP("Stepping Stone", 82, new WorldPoint(3092, 3880, 0)), - BRIMHAVEN_DUNGEON_EAST_STEPPING_NORTH("Stepping Stones", 83, new WorldPoint(2685, 9547, 0)), - BRIMHAVEN_DUNGEON_EAST_STEPPING_SOUTH("Stepping Stones", 83, new WorldPoint(2693, 9529, 0)), - ELVEN_ADVANCED_CLIFF_SCRAMBLE("Rocks", 85, new WorldPoint(2337, 3253, 0)), - KALPHITE_WALL("Crevice", 86, new WorldPoint(3214, 9508, 0)), - BRIMHAVEN_DUNGEON_VINE_EAST("Vine", 87, new WorldPoint(2672, 9582, 0)), - BRIMHAVEN_DUNGEON_VINE_WEST("Vine", 87, new WorldPoint(2606, 9584, 0)), - RENEVANT_CAVES("Jump", 89, new WorldPoint(3240, 10144, 0)); - - private final String tooltip; - private final WorldPoint location; - private final int levelReq; - - AgilityShortcutLocation(String description, int level, WorldPoint location) - { - this.tooltip = description + " - Level " + level; - this.location = location; - this.levelReq = level; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutPoint.java index 74f4673c85..c99979f103 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutPoint.java @@ -27,12 +27,13 @@ package net.runelite.client.plugins.worldmap; import java.awt.image.BufferedImage; import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; +import net.runelite.client.game.AgilityShortcut; class AgilityShortcutPoint extends WorldMapPoint { - AgilityShortcutPoint(AgilityShortcutLocation data, BufferedImage icon, boolean showTooltip) + AgilityShortcutPoint(AgilityShortcut data, BufferedImage icon, boolean showTooltip) { - super(data.getLocation(), icon); + super(data.getWorldMapLocation(), icon); if (showTooltip) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java index fea186927b..276e2083e4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java @@ -36,6 +36,7 @@ import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ExperienceChanged; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.AgilityShortcut; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager; @@ -167,9 +168,10 @@ public class WorldMapPlugin extends Plugin if (config.agilityShortcutLevelIcon() || config.agilityShortcutTooltips()) { - Arrays.stream(AgilityShortcutLocation.values()) + Arrays.stream(AgilityShortcut.values()) + .filter(value -> value.getWorldMapLocation() != null) .map(value -> new AgilityShortcutPoint(value, - agilityLevel > 0 && config.agilityShortcutLevelIcon() && value.getLevelReq() > agilityLevel ? NOPE_ICON : BLANK_ICON, + agilityLevel > 0 && config.agilityShortcutLevelIcon() && value.getLevel() > agilityLevel ? NOPE_ICON : BLANK_ICON, config.agilityShortcutTooltips())) .forEach(worldMapPointManager::add); } From 9d7dbe2aeaefd8778794f11799057e293b59d3ac Mon Sep 17 00:00:00 2001 From: theGeekPirate Date: Wed, 20 Feb 2019 00:38:59 -0800 Subject: [PATCH 105/304] Correct Falador teleport XP in Skill Calc (#7943) --- .../runelite/client/plugins/skillcalculator/skill_magic.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_magic.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_magic.json index 38719b3d00..15905e0a0c 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_magic.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_magic.json @@ -238,7 +238,7 @@ "level": 37, "sprite": 33, "name": "Falador Teleport", - "xp": 47 + "xp": 48 }, { "level": 39, From 3cf17cb6e547235a424724cf8220076255ff1dff Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 19 Feb 2019 09:20:42 -0500 Subject: [PATCH 106/304] item prices: add high alch profit to overlay Co-authored-by: Medes --- .../plugins/itemprices/ItemPricesConfig.java | 12 +++++++ .../plugins/itemprices/ItemPricesOverlay.java | 36 +++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesConfig.java index ed69408341..a7b62e52b3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesConfig.java @@ -74,4 +74,16 @@ public interface ItemPricesConfig extends Config { return true; } + + @ConfigItem( + keyName = "showAlchProfit", + name = "Show High Alchemy Profit", + description = "Show the profit from casting high alchemy on items", + position = 5 + ) + default boolean showAlchProfit() + { + return false; + } + } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java index 7e170db214..3d9553ca62 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java @@ -196,6 +196,7 @@ class ItemPricesOverlay extends Overlay int gePrice = 0; int haPrice = 0; + int haProfit = 0; if (config.showGEPrice()) { @@ -205,16 +206,20 @@ class ItemPricesOverlay extends Overlay { haPrice = Math.round(itemDef.getPrice() * HIGH_ALCHEMY_CONSTANT); } + if (gePrice > 0 && haPrice > 0 && config.showAlchProfit()) + { + haProfit = calculateHAProfit(haPrice, gePrice); + } if (gePrice > 0 || haPrice > 0) { - return stackValueText(qty, gePrice, haPrice); + return stackValueText(qty, gePrice, haPrice, haProfit); } return null; } - private String stackValueText(int qty, int gePrice, int haValue) + private String stackValueText(int qty, int gePrice, int haValue, int haProfit) { if (gePrice > 0) { @@ -246,9 +251,36 @@ class ItemPricesOverlay extends Overlay } } + if (haProfit > 0) + { + Color haColor = haProfitColor(haProfit); + + itemStringBuilder.append("
"); + itemStringBuilder.append("HA Profit: ") + .append(ColorUtil.wrapWithColorTag(String.valueOf(haProfit * qty), haColor)) + .append(" gp"); + if (config.showEA() && qty > 1) + { + itemStringBuilder.append(" (") + .append(ColorUtil.wrapWithColorTag(String.valueOf(haProfit), haColor)) + .append(" ea)"); + } + } + // Build string and reset builder final String text = itemStringBuilder.toString(); itemStringBuilder.setLength(0); return text; } + + private int calculateHAProfit(int haPrice, int gePrice) + { + int natureRunePrice = itemManager.getItemPrice(ItemID.NATURE_RUNE); + return haPrice - gePrice - natureRunePrice; + } + + private static Color haProfitColor(int haProfit) + { + return haProfit >= 0 ? Color.GREEN : Color.RED; + } } From 8923dae45e3efb4a466e3947a55ec2a91b5b7c23 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 20 Feb 2019 19:29:13 -0500 Subject: [PATCH 107/304] client: only enable developer mode if launcher version isn't set --- .../src/main/java/net/runelite/client/RuneLite.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLite.java b/runelite-client/src/main/java/net/runelite/client/RuneLite.java index b7fae34e2c..ecdda28103 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -183,9 +183,9 @@ public class RuneLite System.exit(0); } - final boolean developerMode = options.has("developer-mode"); + final boolean developerMode = options.has("developer-mode") && RuneLiteProperties.getLauncherVersion() == null; - if (developerMode && RuneLiteProperties.getLauncherVersion() == null) + if (developerMode) { boolean assertions = false; assert assertions = true; From ccaa955572615038c5c53d85276eb4a79a8ef194 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 21 Feb 2019 12:11:50 +0000 Subject: [PATCH 108/304] [maven-release-plugin] prepare release runelite-parent-1.5.13 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 21e66169bc..05429ae427 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 0ea164ee8d..507a7f30a5 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 17a7524427..e947d4e56e 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 0829178ece..594e9e240d 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 32dc046a4c..60819f5391 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 Web Service diff --git a/pom.xml b/pom.xml index 44828e6d8e..931e6e13b2 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.13 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 46d1cd9593..ee7f34b67a 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 91084dfbe6..3e55dead1e 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 34afe917d0..0cd8522d97 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 3cb78ed8f2..3964781464 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index bd4ddb5801..927a805860 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 9b274b38f5..b42d7e2b81 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 03417c67e0..5b06826b55 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13-SNAPSHOT + 1.5.13 net.runelite.rs From 18167a77827f2958082a81c0c4aa11cc3c2272c9 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 21 Feb 2019 12:11:57 +0000 Subject: [PATCH 109/304] [maven-release-plugin] prepare for next development iteration --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 05429ae427..9ad16f216c 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 507a7f30a5..f6d5cc5ffa 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index e947d4e56e..072a7e4767 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 594e9e240d..910cacdbd6 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 60819f5391..d1217f0ced 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index 931e6e13b2..a5187a029c 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.13 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index ee7f34b67a..df42e1e53a 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 3e55dead1e..490f2eb372 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 0cd8522d97..f9b875d6fa 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 3964781464..e026f85423 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 927a805860..8b90c2bec0 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index b42d7e2b81..57ce1ecb31 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 5b06826b55..4986a1d5fa 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.13 + 1.5.14-SNAPSHOT net.runelite.rs From 3c1da4bb1e6f39fafb1a4b948e8f57148c0dcd1f Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 21 Feb 2019 08:51:39 -0500 Subject: [PATCH 110/304] http service: disable spring jmx Multiple api deployments is causing Spring to try to register the datasources multiple times and is erroring --- http-service/src/main/resources/application.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml index 7b6785a325..9aa02c58ac 100644 --- a/http-service/src/main/resources/application.yaml +++ b/http-service/src/main/resources/application.yaml @@ -4,4 +4,9 @@ datasource: runelite-cache: jndiName: java:comp/env/jdbc/runelite-cache2 runelite-tracker: - jndiName: java:comp/env/jdbc/runelite-tracker \ No newline at end of file + jndiName: java:comp/env/jdbc/runelite-tracker +# By default Spring tries to register the datasource as an MXBean, +# so if multiple apis are delpoyed on one web container with +# shared datasource it tries to register it multiples times and +# fails when starting the 2nd api +spring.jmx.enabled: false \ No newline at end of file From 7df862de4d32262699f1ee76e63825ec14d726b2 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 21 Feb 2019 16:05:10 +0100 Subject: [PATCH 111/304] Do not try to draw infobox caption if text is null or empty Closes #7964 Signed-off-by: Tomas Slusny --- .../ui/overlay/components/InfoBoxComponent.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java index be055179bb..d8f7841099 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java @@ -24,6 +24,7 @@ */ package net.runelite.client.ui.overlay.components; +import com.google.common.base.Strings; import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; @@ -86,11 +87,14 @@ public class InfoBoxComponent implements LayoutableRenderableEntity null); // Render caption - final TextComponent textComponent = new TextComponent(); - textComponent.setColor(color); - textComponent.setText(text); - textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR)); - textComponent.render(graphics); + if (!Strings.isNullOrEmpty(text)) + { + final TextComponent textComponent = new TextComponent(); + textComponent.setColor(color); + textComponent.setText(text); + textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR)); + textComponent.render(graphics); + } this.bounds.setBounds(bounds); return bounds.getSize(); From dad7b05e6a39118ffa040fd9e84466d6e0c841bb Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 21 Feb 2019 16:41:53 +0100 Subject: [PATCH 112/304] Remove emptyOrNull text check from InfoboxOverlay This is unnecessary as it should be checked when drawing the text. Signed-off-by: Tomas Slusny --- .../runelite/client/ui/overlay/infobox/InfoBoxOverlay.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java index e6a8d6f749..58f20aae63 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java @@ -99,10 +99,7 @@ public class InfoBoxOverlay extends Overlay final Color color = box.getTextColor(); final InfoBoxComponent infoBoxComponent = new InfoBoxComponent(); - if (!Strings.isNullOrEmpty(text)) - { - infoBoxComponent.setText(text); - } + infoBoxComponent.setText(text); if (color != null) { infoBoxComponent.setColor(color); From 66997ac71baa88aeca443b65e56f582a6bb7160e Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 21 Feb 2019 10:43:47 -0500 Subject: [PATCH 113/304] item prices: show negative high alch profits too --- .../runelite/client/plugins/itemprices/ItemPricesOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java index 3d9553ca62..7c748a7702 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java @@ -251,7 +251,7 @@ class ItemPricesOverlay extends Overlay } } - if (haProfit > 0) + if (haProfit != 0) { Color haColor = haProfitColor(haProfit); From 0e2ea20db04eed1eec9361cc648076cd3cec965c Mon Sep 17 00:00:00 2001 From: chestnut1693 Date: Thu, 21 Feb 2019 22:44:13 +0100 Subject: [PATCH 114/304] Add home tag to Default World plugin --- .../client/plugins/defaultworld/DefaultWorldPlugin.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java index 636d9b923b..c371a13c08 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java @@ -43,7 +43,8 @@ import net.runelite.http.api.worlds.WorldResult; @PluginDescriptor( name = "Default World", - description = "Enable a default world to be selected when launching the client" + description = "Enable a default world to be selected when launching the client", + tags = {"home"} ) @Slf4j public class DefaultWorldPlugin extends Plugin From 654ee9051222ceefff271cec8c1cd88238bcd2fa Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 17 Jan 2019 20:51:38 +0100 Subject: [PATCH 115/304] Add button to sync local config with remote Add button to info panel that will show when you are logged in to sync local configuration with remote. Signed-off-by: Tomas Slusny --- .../runelite/client/config/ConfigManager.java | 58 +++++++++++++++++- .../client/plugins/info/InfoPanel.java | 41 +++++++++++-- .../client/plugins/info/import_icon.png | Bin 0 -> 8483 bytes 3 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/info/import_icon.png diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 2cde4900ad..bb04cbec5f 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -111,12 +111,17 @@ public class ConfigManager load(); // load profile specific config } + private File getLocalPropertiesFile() + { + return new File(RuneLite.RUNELITE_DIR, SETTINGS_FILE_NAME); + } + private File getPropertiesFile() { // Sessions that aren't logged in have no username if (session == null || session.getUsername() == null) { - return new File(RuneLite.RUNELITE_DIR, SETTINGS_FILE_NAME); + return getLocalPropertiesFile(); } else { @@ -184,6 +189,57 @@ public class ConfigManager } } + private synchronized void syncPropertiesFromFile(File propertiesFile) + { + final Properties properties = new Properties(); + try (FileInputStream in = new FileInputStream(propertiesFile)) + { + properties.load(new InputStreamReader(in, Charset.forName("UTF-8"))); + } + catch (Exception e) + { + log.debug("Malformed properties, skipping update"); + return; + } + + final Map copy = (Map) ImmutableMap.copyOf(this.properties); + copy.forEach((groupAndKey, value) -> + { + if (!properties.containsKey(groupAndKey)) + { + final String[] split = groupAndKey.split("\\.", 2); + if (split.length != 2) + { + return; + } + + final String groupName = split[0]; + final String key = split[1]; + unsetConfiguration(groupName, key); + } + }); + + properties.forEach((objGroupAndKey, objValue) -> + { + final String groupAndKey = String.valueOf(objGroupAndKey); + final String[] split = groupAndKey.split("\\.", 2); + if (split.length != 2) + { + return; + } + + final String groupName = split[0]; + final String key = split[1]; + final String value = String.valueOf(objValue); + setConfiguration(groupName, key, value); + }); + } + + public void importLocal() + { + syncPropertiesFromFile(getLocalPropertiesFile()); + } + private synchronized void loadFromFile() { properties.clear(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java index 2edb250135..203b688b4e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java @@ -40,6 +40,7 @@ import javax.inject.Singleton; import javax.swing.Box; import javax.swing.ImageIcon; import javax.swing.JLabel; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.event.HyperlinkEvent; @@ -48,6 +49,7 @@ import net.runelite.api.events.SessionClose; import net.runelite.api.events.SessionOpen; import net.runelite.client.RuneLiteProperties; import net.runelite.client.account.SessionManager; +import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.ui.ColorScheme; @@ -66,9 +68,12 @@ public class InfoPanel extends PluginPanel private static final ImageIcon DISCORD_ICON; private static final ImageIcon PATREON_ICON; private static final ImageIcon WIKI_ICON; + private static final ImageIcon IMPORT_ICON; private final JLabel loggedLabel = new JLabel(); private final JRichTextPane emailLabel = new JRichTextPane(); + private JPanel syncPanel; + private JPanel actionsContainer; @Inject @Nullable @@ -86,6 +91,9 @@ public class InfoPanel extends PluginPanel @Inject private ScheduledExecutorService executor; + @Inject + private ConfigManager configManager; + static { ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "/util/arrow_right.png")); @@ -93,6 +101,7 @@ public class InfoPanel extends PluginPanel DISCORD_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "discord_icon.png")); PATREON_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "patreon_icon.png")); WIKI_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "wiki_icon.png")); + IMPORT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "import_icon.png")); } void init() @@ -150,11 +159,22 @@ public class InfoPanel extends PluginPanel versionPanel.add(loggedLabel); versionPanel.add(emailLabel); - updateLoggedIn(); - - JPanel actionsContainer = new JPanel(); + actionsContainer = new JPanel(); actionsContainer.setBorder(new EmptyBorder(10, 0, 0, 0)); - actionsContainer.setLayout(new GridLayout(4, 1, 0, 10)); + actionsContainer.setLayout(new GridLayout(0, 1, 0, 10)); + + syncPanel = buildLinkPanel(IMPORT_ICON, "Import local settings", "to remote RuneLite account", () -> + { + final int result = JOptionPane.showOptionDialog(syncPanel, + "This will replace your current RuneLite account settings with settings from your local profile.", + "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, + null, new String[]{"Yes", "No"}, "No"); + + if (result == JOptionPane.YES_OPTION) + { + configManager.importLocal(); + } + }); actionsContainer.add(buildLinkPanel(GITHUB_ICON, "Report an issue or", "make a suggestion", runeLiteProperties.getGithubLink())); actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "discord server", runeLiteProperties.getDiscordInvite())); @@ -164,6 +184,7 @@ public class InfoPanel extends PluginPanel add(versionPanel, BorderLayout.NORTH); add(actionsContainer, BorderLayout.CENTER); + updateLoggedIn(); eventBus.register(this); } @@ -171,6 +192,14 @@ public class InfoPanel extends PluginPanel * Builds a link panel with a given icon, text and url to redirect to. */ private static JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, String url) + { + return buildLinkPanel(icon, topText, bottomText, () -> LinkBrowser.browse(url)); + } + + /** + * Builds a link panel with a given icon, text and callable to call. + */ + private static JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, Runnable callback) { JPanel container = new JPanel(); container.setBackground(ColorScheme.DARKER_GRAY_COLOR); @@ -193,7 +222,6 @@ public class InfoPanel extends PluginPanel @Override public void mousePressed(MouseEvent mouseEvent) { - LinkBrowser.browse(url); container.setBackground(pressedColor); textContainer.setBackground(pressedColor); } @@ -201,6 +229,7 @@ public class InfoPanel extends PluginPanel @Override public void mouseReleased(MouseEvent e) { + callback.run(); container.setBackground(hoverColor); textContainer.setBackground(hoverColor); } @@ -252,12 +281,14 @@ public class InfoPanel extends PluginPanel emailLabel.setContentType("text/plain"); emailLabel.setText(name); loggedLabel.setText("Logged in as"); + actionsContainer.add(syncPanel, 0); } else { emailLabel.setContentType("text/html"); emailLabel.setText("Login to sync settings to the cloud."); loggedLabel.setText("Not logged in"); + actionsContainer.remove(syncPanel); } } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/info/import_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/info/import_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..32263bf15962b926d8c5862f0becbb3780753967 GIT binary patch literal 8483 zcmV+;A>7`HP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3>zb{snnWdCy&vxMX~xg0V{o-;d`<*nJZj+Z>&{rP8lUbl_cD$>|?RnjQJqmNB=MCxG89lGt`19HA6Z&Gc&ntiVg-_01@Bh7> z-CCopHP79(kT|Jio|}5z%KnKrc8=2Tk0rh`e}8}<38rX4YsSFC3>`-qlfANY*;>xA zV4ud$oe!>K0UM(m)+}t}ahmLk)3y0bw)?#36`Vxb42!v7 zv3QmRaA+r+UB!mrWI5UFs)DQNu$qlB&ako=77Ww6xa^1RJ}vi0yO|jNBfGiZSm7yUUgk_ zl{+uai9g&bAktGFHP3s^u;yx^ER*J3-se2-Wa~XgoPAdQ(%Tnlv*Yx6jjIp6Qhm+B%v2Yv#B;<|m-ZQYJt*@5?UcD6!W-Ng~AwYc7z!@9fHV2A+{^}O-B zXjjEENiz1{%aKUxJeO#e9dqHE{rdg8Fzny$Xk7o%lIC;G|87b1(>DLjlIG8M{`X6o zKiqk~X9Xr&6L_2;dpSWIBV=$6PnpBu1sPr#ptu(o$uap=2c+|6?=g?OH~-DW9|vdO+4Z}~ zsZHiIZr>*toww!BH9UXkmAGcebu4big)w@*`{)bIfh-D}a?|z78eGtV**Y~H++Tgq zoy)qkN&uIDD0ocIv4MrA=G-c|_Kul|=Uh^U4z&ue0`7dTw#@7%k>6m|fG6~7m7J#q z*a2XlfIn{1#CvdzBNH04Dc(6tvUOQX?&U7Fgme+tcHOhfH>M4h!@%&(vOGL1%@ZPJ zM!>ajY8Jd+g}6)=92nY1ukEU7T2g3jvyNDchc!gmzQLahM6Zw3n+f0;*0{ZWVHhVr zB6QQXEYit8y1(Zd3!#G7^!okCbKvw0>~h(ZZx*eY-EeyR*vKtcY+?AjbB1a1EtLCi zHZX(9ni-yN(+1A;VF10=HoUk#6Fd%rtXT?<4ovpWz3$+!a}3zeSP;3C zeHT`=$oc{mBC(k`3FNDdkwmQmsrPs zPD@mD3;@gEE+L^TWFvu|*#a&>o=Qu=f_XMa0t~xf7w{yKjt^rW%Ogs4Mh*jeNnS!fZE!7EGNN5EX49IZsxI z#1rom8Yrjl5Wx$GG;|)Gq3Vlrk78q4?UQ%{GOGZHD6a$uOdUtNkBx~(05#pjkeRoa zgW-TX-4N+wp=C7~Il(#a#GeZMT5LB4m#B3mQfGp+lZh;FCNDNib|xBbQd{bR?>G_v zsSr!h1qp#F#ct#62D^)mcyD(k>p0T$Bp7j=I?cen$e!T=*sEJe@J@Nt!37ogY!Nnz zB*-^0(ihwAS1;O8=DdUvN|66S!nQkKC0U=6$v5s&? z|K>~{Eg2o1L`^(FF$<80gTh8n7A!e#@9v!F8m^c!1-s#DJDjgyzsrrTux=^#67Y9t zlWz|#){%IQJXcef5(+Z1cDx>$x^gE{rMT`DFc&N;@e$ z|KJ}v0kYWezXN}DTfnyse-E1Ce+0Q9e3iU5rj(MDdSr8n&N@=*+0O*4WK(y7p^Gpk z{49HT*1`bx+Wu*c!qMtiN#_6`gItMm&*N_WUZCWXd|kV;G%Eg;cpLYDKY@)q!8U^s zK!x<;9&d60WQx6o<4t2jdH36!Hk1=Hk5MQ2`yg%Tx5*VaeIaezgd4{BAngqvp=J-# zCT^w|A+2Q5P`KQ((oTTa4iPcnL$|okbhrrljpXP_5t|pfC|-B~wjbgX9|3XJlY%@; zg51w~XSLs~C62i^$NajISs&~CcRMp5xB6f1%&c#R_HTD)z8~7Z-I;kmw1FZ<$r2M= zO?*U5Mh3hGOdL=c6l{t(8ZMH34aNiOPU-|cK(rPd+-`4=@@1&o@%G>$$TRX!`8qNu z9j2W?PgEwFmQ}zi=w()lg}4+83+{#8DSIhcUc8!etZ^EGlm2S40ij zV8K(p?us-i76fVNu%PI!N3Y$LY%Qr{w_ZcL-%!_kXDZ+vfV>Q#qYOmKN3(3|{lFmF z{yLzvg|gd+4ip{$Y}=;U0Rn7}WN9YocuSuqFiJ_kdyiOaaiDnPCZ@edj1|%Rej21WCv$jM+d7Q&loOXc_%n8OvJbW`j7K9eSN`A?^?-Q=cST3vT1M5s2m}HhC6n zDhB?1)rQ33+Ny4y9M?rPl8X?a8V8P11x}WEOf($l)Tp+-MTo|>?5gHLJ6p?j|A?VdcgxR8(wou!MO&bnK0Vh zvdtp}P`N4rNeMS`jDY6BHUGi+$_NqtU))6a!n^9N23n|uVs=BL=VeF%s! zO1erzaBcy?j`Ca9X>VC)*|12;+@WZmK&*%@vPMy`1WQ0AzKo+f7KzB580 zI6DRptF-k%`01p_smDOD05`4tV_3dN<*KaZCBiVmz+VtGr$)o4yl89NsYI}Zfa?OK z4M|v(R5gjJ&1q1QPc6;bta1TC`zofLdcjjn%e!9i6w`LSK*h8ey?B+!TLEN|9}68S zwN=$dSU%dO(ip%FASbwwC92A;s4pv%fq{K4k&3ihIR%%>`J|rYE{W*L!_+P@L!Rn) z>;nIp$!bd5=o__uxbMRVN>p=d*L9+pE*pO8I-FD4(T^sW7Uc(cJI>H)?WaOag2%<6 z-fkzLR7wkXuhn^XC2LCs3xL+PgxT+AB|K1OV(J%il+4-44e=%dQMcCsLIVt&FhPU? zEhS!{i>#BLXw;9*I-oAp)ZR4_lX91Aw#M044 z3Z~PX0&wChnC3dcWZq+RN7J98^!gH~uQ1&~YRfi z;1j7I^x-2?RonyXrS|w_5)Vz#u5%LZnGRQ2=AOwdM~$y0F+&q0Wws8zUoU@!1a!W)v1z?L43VLpPjm5c+Y!4CUtPWT|+){9z+-4#>@MNHUqcrnoNw z@QeR{z`KjbZOjQH`Ayk=Q@0!UwYhiB=X!VO4|nToXIqUgT#<8wXDauTP|aBp8pLMh zHEGvH%P$-UScPmJ&dbUQd#xJ}X9(TAmcGI%Sg<%WPXsHr(+yBPrnpl<`F#YK69W4{ zz9hWw`EHZ7b$HCV;9-3+1>I~k#64F(NOM@<*?hdtErb0EUcPiIr(doCCEP3yl{&&v z2i)_u&R~9ZRK{gSmdDIX6m!9ldWN0n3A3~E2-(83Y1jbjBJGOh2nZ&pPF9EF zAu$5F)?5Xhm`HD%J{Oj zKQ0JPAE_7B6S{)g`eh|mw|8kN5jeZbep6x* zREynnqbQ+10r7k0)G!;V2LDEnnbY2eu{V$LRNIX^W?Lvld<)O03D>n`0fHgHERndk z7y`F@=#4;%Eb@r_4?ZoCKQ0lM^^xtJ{gUk)%WXd3x*F+jdp1XU?5GCQep_ntGYLWm zbQ9Z~4s!4lSDmm*^h|BLcmfDUm`lB_nTVqTdI(BaZUBl}^qksuQah$v$8I+qK|AqE zrLU-DkHVK% z>c^-jO^aEXovBZr4l1nY=b-ITjB4S8p@SX>Vs7PDiBI!2KC#1cYsv;{QwQ{mV;tn2nKfr%rkaXfa|+Ym@VaXc`jD&Uy$}@Kj+>FYft8USTvh+kS0uQ@*Z^gC z(%qKpUozfDp-t`L7c4!DK*014OPd*}2o|alVR&nA25eYmWL3e~Ss>baiy^R!=T`DZ z5sb76g-BUNFr)G$s61>3$*rc~oyzzeJhn~FkD_2ds0N=Q$s6} z+!qNEbqCrRTe-{W4tS4@4qo5($31n&^XZO&DRZe~z z`Zx*o%h(68_L}>cqrZ)PsA~h;fsDLbcj{B@7Rxg*Foi{9k00$&H;Q$RE=P_IECI@p zFhTS(UwAE4uXUSnv0i+yAOS|tUA*o_BqBHnV)0p{P49@g#+`KUb!fK1H?oKBT@bXp z&(LCWTUYlPL*%@3y;p@>(*%fPrQxgWN*$a=PnZzc68)NXaTqg@7Y7p3BHaQh{8k-a zIqdeLze9~YfGwV36AWHXD{4nVWo5OZ!YO4c5~8*clr z_GQk-{`-BIUxx1f<-W}OfqmcCyd~6Lfsa;WZL*WXzGPL3l_N=@A;;THqU-x)PdGJc=F^MD{W_7!LTX0eIDOu|X!4Po&>G=*MlN;}`qX94(8X>;_k2b! zP8)gv%jQg7e6*qMnH%NZrx6|Xv_V!Mo3Qqg1vKZkD<)(iH5mBaxNkh$%BOwQz{STb z-c;8YUmS;dlfd!R$ zZ}|c-8jvv%gucg<)}xl~Kf`*v#r5-qkvTf&LkXcvzbK)i z8h{$O&yb;L{Kqs@?LZY!m|Az{ty7F}IMYz`3=luP;@6PjYmjEo7@l$Iv0*vGW2f2k z(rwS&wKFfhXYR^tUV7JC&fNcYv9GgtX}xCe_OwsLS|7uA>23J#p}BYYDKBZ-tgqKN zqS3GhY3Zk|v`atZh~%QF+@#*(MXKL>O6s)QJ(jg*G6<%D_TsZQQH&cZPh2bBsx)W- zK_ZDD=w|}cYZPCT_~{wJ?9U{=@vxKR+I>dxgN8bvQT%-Ub&-tk=HcKfZ{fM;6wc7y z=PA6++@;T%I|%P<<_?8s_VDd^vFqBu_Nu|Hr&s;3>-bBnnwWSVh0z4gi?9$uWiD^C(=ulBS z={B!o*bl9-zGVdp06Mjmq#b&`P;+5NNCHpXE7CJ1IAn|!ij;{C?)!q7evTPFf%V>v zjtZ=2csKTq!)JKcv~p&bSis^RODs5xVEvAD;P{XxtD^6oaR%rEkvOHY&s=1I z#0SSs?kS_Wr;N^!kp|#5t4W{HYQcO{2e2W$!bc z-p&w^@0w0G7a&?}C(&s<9U%>IRJYFWfuvJWYy|tIF2JcLrv1oHed>vPWUf|>3W}Tt zMt^!1hd!X?PQu3u4}DmhK4`c`6C8VD!tKI|7aEu|*jv&F@<$?PvAYzYrM9#H)Yn@(s|CR{6k;=H(P?SIisPnvneT|ubWbrFF&oq^gQ39 zjj49p^UH3amWOB8GdhgjtkOUNRja?dyE4u-AOhhk_x9&L(*64hMDq+sW|a_OE!(ch z7TMM1SIubG5^%$rg3PM1fr`M%lHj1lm5V23myjy?tt&qH9+OPWYMk1-v&gs<(# znA{$PkDDJ^l%}cg{HU%cFs_`RQo91fDoReFy*|&f?Lxb&WWww;o80zukQ!qY9KOZ| zr)Kld<0C+4u$s$%9v^Yh4YzT(5N zU+DSvm{mECSuJ-S$kfbdfgl{XzT*(EsR(AFCTa$eoAlhb)8NW}%#W`?t_>TKP|S08 z7lP)e$Ov#ql!m&QQxABL;D*zj)L^?Is=1P)y5VYO3XU{K_1O;(n&T#;&hy-8!)?ML z5x26;Qr%=14ua}oXEbQ6*Mp~MjOW4AQ*4G*0iY+qW!3q{tq2o+orFu9OTWHEPdLqzq>*6+E2tw5C}tQ z3ZT?92(GHJux8;G=n=3CB^+w%-rcQPNPZ3TA|+(a00NImL_t(Y$L*HEYg0iG#=mVETVvWoBML?k5u}Qcs~1UoX^s{2 zVEYFMUcKl=u!0yo6hsf!dh{UJgGCT5XtALsf(oLxRUssof}-F>p=$kknFs6ZOZu8b z5OiVT&CbqzGxKI=M*7#5i+d5+FX^bHAxQ@%WsLPn(xRjpNq3!dZ`)!SkO$^~8c+m= zfZaeBkOumJg7GSLH{S|iH*g)O0wX{ohD^flR!z2hv!H#z0&oxLZNlgtlU)G%;tHjJ zGH?axXdz-9rlSm`;s{Ivw*l9N{BWjgGEO4ZfSz_e8w-22VZs3=U^L=9*h%0d@DTV2 zdEAMfm^m$fm{^u7*MQZlz>~n zci@;8fgp*_82F6_UKfF}D8?h85Mk*#&#Q}`A>FnE`ZDkn*i#3%0L(@)R)DNWcUt(? zfIGl>AZ@%PFk?FiZ^j}r1?-K`p9NN;fLDPokG^1D9uI{!01cK8{>nQa2Rc1{TY%L# zz%PNvAyC=>oc93cfwLZeo6-0=(+D^m>aW1K|C~JDP7ioTgmD7y1C@HA_DkZjq(dIP zWbLonRq Date: Fri, 22 Feb 2019 00:25:59 +0100 Subject: [PATCH 116/304] Backup RuneLite account settings before overwriting them Signed-off-by: Tomas Slusny --- .../runelite/client/config/ConfigManager.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index bb04cbec5f..78b84776a1 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -43,8 +43,11 @@ import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; import java.nio.channels.FileLock; import java.nio.charset.Charset; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.time.Instant; import java.util.Arrays; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -70,6 +73,7 @@ import net.runelite.http.api.config.Configuration; public class ConfigManager { private static final String SETTINGS_FILE_NAME = "settings.properties"; + private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); @Inject EventBus eventBus; @@ -179,7 +183,7 @@ public class ConfigManager try { - saveToFile(); + saveToFile(propertiesFile); log.debug("Updated configuration on disk with the latest version"); } @@ -237,6 +241,24 @@ public class ConfigManager public void importLocal() { + if (session == null) + { + // No session, no import + return; + } + + final File file = new File(propertiesFile.getParent(), propertiesFile.getName() + "." + TIME_FORMAT.format(new Date())); + + try + { + saveToFile(file); + } + catch (IOException e) + { + log.warn("Backup failed, skipping import", e); + return; + } + syncPropertiesFromFile(getLocalPropertiesFile()); } @@ -287,7 +309,7 @@ public class ConfigManager } } - private synchronized void saveToFile() throws IOException + private synchronized void saveToFile(final File propertiesFile) throws IOException { propertiesFile.getParentFile().mkdirs(); @@ -368,7 +390,7 @@ public class ConfigManager { try { - saveToFile(); + saveToFile(propertiesFile); } catch (IOException ex) { @@ -411,7 +433,7 @@ public class ConfigManager { try { - saveToFile(); + saveToFile(propertiesFile); } catch (IOException ex) { From 4e1e132985b7d7bf6d76d4231732e34461f15256 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Fri, 22 Feb 2019 00:39:17 +0100 Subject: [PATCH 117/304] Log config property changes only if they really change This prevents spam from previous property loading addition Signed-off-by: Tomas Slusny --- .../java/net/runelite/client/config/ConfigManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 78b84776a1..9ef92ed01c 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -372,8 +372,6 @@ public class ConfigManager public void setConfiguration(String groupName, String key, String value) { - log.debug("Setting configuration value for {}.{} to {}", groupName, key, value); - String oldValue = (String) properties.setProperty(groupName + "." + key, value); if (Objects.equals(oldValue, value)) @@ -381,6 +379,8 @@ public class ConfigManager return; } + log.debug("Setting configuration value for {}.{} to {}", groupName, key, value); + synchronized (pendingChanges) { pendingChanges.put(groupName + "." + key, value); @@ -415,8 +415,6 @@ public class ConfigManager public void unsetConfiguration(String groupName, String key) { - log.debug("Unsetting configuration value for {}.{}", groupName, key); - String oldValue = (String) properties.remove(groupName + "." + key); if (oldValue == null) @@ -424,6 +422,8 @@ public class ConfigManager return; } + log.debug("Unsetting configuration value for {}.{}", groupName, key); + synchronized (pendingChanges) { pendingChanges.put(groupName + "." + key, null); From 114422e3919d2ef50e955e84d4d4cca04c65a8b7 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Fri, 22 Feb 2019 00:54:48 +0100 Subject: [PATCH 118/304] Properly split config properties loaded from config client Some keys contain multiple dots (account-based, farming) and so this was setting incorrect value before. Signed-off-by: Tomas Slusny --- .../java/net/runelite/client/config/ConfigManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 9ef92ed01c..b24c9ccb96 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -167,7 +167,13 @@ public class ConfigManager for (ConfigEntry entry : configuration.getConfig()) { log.debug("Loading configuration value from client {}: {}", entry.getKey(), entry.getValue()); - final String[] split = entry.getKey().split("\\."); + final String[] split = entry.getKey().split("\\.", 2); + + if (split.length != 2) + { + continue; + } + final String groupName = split[0]; final String key = split[1]; final String value = entry.getValue(); From 4787fe71e447e52ab45c75d2bd706a8860f6e131 Mon Sep 17 00:00:00 2001 From: Royce Mathews Date: Fri, 22 Feb 2019 01:31:27 -0600 Subject: [PATCH 119/304] Add enchanting jewelry to the idle notification plugin. (#7977) Closes #7975 --- runelite-api/src/main/java/net/runelite/api/AnimationID.java | 1 + .../runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java | 1 + 2 files changed, 2 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java index ee1a50d7ed..1f96e9c898 100644 --- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java +++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java @@ -123,6 +123,7 @@ public final class AnimationID public static final int HERBLORE_POTIONMAKING = 363; //used for both herb and secondary public static final int MAGIC_CHARGING_ORBS = 726; public static final int MAGIC_MAKE_TABLET = 4068; + public static final int MAGIC_ENCHANTING_JEWELRY = 931; public static final int BURYING_BONES = 827; public static final int USING_GILDED_ALTAR = 3705; public static final int LOOKING_INTO = 832; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java index 9a47e57de0..8a23af905f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java @@ -202,6 +202,7 @@ public class IdleNotifierPlugin extends Plugin case MAGIC_CHARGING_ORBS: case MAGIC_LUNAR_STRING_JEWELRY: case MAGIC_MAKE_TABLET: + case MAGIC_ENCHANTING_JEWELRY: /* Prayer */ case USING_GILDED_ALTAR: /* Farming */ From de0d3bc787e209f664323b627c8404401c88688f Mon Sep 17 00:00:00 2001 From: RyBo Date: Fri, 22 Feb 2019 00:37:05 -0700 Subject: [PATCH 120/304] Highlight more efficient ledge in the Falador Agility course (#7938) --- .../java/net/runelite/client/plugins/agility/Obstacles.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java index 4506891e99..92df605a36 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java @@ -78,7 +78,7 @@ class Obstacles STEPPING_STONE_15412, TROPICAL_TREE_15414, MONKEYBARS_15417, SKULL_SLOPE_15483, ROPE_15487, TROPICAL_TREE_16062, // Falador ROUGH_WALL_10833, TIGHTROPE_10834, HAND_HOLDS_10836, GAP_11161, GAP_11360, TIGHTROPE_11361, - TIGHTROPE_11364, GAP_11365, LEDGE_11366, LEDGE_11367, LEDGE_11368, LEDGE_11370, EDGE_11371, + TIGHTROPE_11364, GAP_11365, LEDGE_11366, LEDGE_11367, LEDGE_11369, LEDGE_11370, EDGE_11371, // Wilderness OBSTACLE_PIPE_23137, ROPESWING_23132, STEPPING_STONE_23556, LOG_BALANCE_23542, ROCKS_23640, // Seers From 7f066a5bc558d89f05050253903f3a3e05820eef Mon Sep 17 00:00:00 2001 From: Koekkruimels <47660479+Koekkruimels@users.noreply.github.com> Date: Fri, 22 Feb 2019 09:53:21 +0100 Subject: [PATCH 121/304] Add color to the library customer based on player inventory (#7951) --- .../plugins/kourendlibrary/KourendLibraryOverlay.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java index 3c6863af3a..b581b10bd8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java @@ -31,6 +31,7 @@ import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.geom.Rectangle2D; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Set; @@ -38,6 +39,8 @@ import java.util.stream.Collectors; import lombok.AccessLevel; import lombok.Setter; import net.runelite.api.Client; +import net.runelite.api.InventoryID; +import net.runelite.api.ItemContainer; import net.runelite.api.Perspective; import static net.runelite.api.Perspective.getCanvasTilePoly; import net.runelite.api.Player; @@ -216,9 +219,13 @@ class KourendLibraryOverlay extends Overlay .forEach(n -> { Book b = library.getCustomerBook(); + ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); + boolean hasBookInInventory = itemContainer != null + && b != null + && Arrays.stream(itemContainer.getItems()).anyMatch(item -> item.getId() == b.getItem()); LocalPoint local = n.getLocalLocation(); Polygon poly = getCanvasTilePoly(client, local); - OverlayUtil.renderPolygon(g, poly, Color.WHITE); + OverlayUtil.renderPolygon(g, poly, hasBookInInventory ? Color.GREEN : Color.WHITE); Point screen = Perspective.localToCanvas(client, local, client.getPlane(), n.getLogicalHeight()); if (screen != null) { From 8bfca20223a3ffb422cb12f229e8a296ba9d0217 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Fri, 22 Feb 2019 13:22:29 +0000 Subject: [PATCH 122/304] Catch JVM incompatible library JNA error when initializing Discord Signed-off-by: Tomas Slusny --- .../main/java/net/runelite/client/discord/DiscordService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java b/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java index 0988273ecc..091c479ac6 100644 --- a/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java +++ b/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java @@ -78,7 +78,7 @@ public class DiscordService implements AutoCloseable discordRPC = DiscordRPC.INSTANCE; discordEventHandlers = new DiscordEventHandlers(); } - catch (UnsatisfiedLinkError e) + catch (Error e) { log.warn("Failed to load Discord library, Discord support will be disabled."); } From 6e707a1f5223b108a9990946e4ad78b39adf2601 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sat, 23 Feb 2019 16:54:33 +0100 Subject: [PATCH 123/304] Move slayer weakness overlay 1 layer up above In order to not draw the weakness overlay under NPC HP bars and prayers move overlay 1 layer up to UNDER_WIDGETS. Signed-off-by: Tomas Slusny --- .../runelite/client/plugins/slayer/TargetWeaknessOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java index 5521380e57..ada3f3a727 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java @@ -59,7 +59,7 @@ class TargetWeaknessOverlay extends Overlay this.itemManager = itemManager; this.npcManager = npcManager; setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); + setLayer(OverlayLayer.UNDER_WIDGETS); } @Override From 813be24ad1284fae545fe70a754fe591e9a3241c Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 24 Feb 2019 00:05:05 +0100 Subject: [PATCH 124/304] Limit access levels for InfoBox fields Signed-off-by: Tomas Slusny --- .../net/runelite/client/ui/overlay/infobox/InfoBox.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBox.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBox.java index fc498d3635..8c2889e8e6 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBox.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBox.java @@ -26,24 +26,25 @@ package net.runelite.client.ui.overlay.infobox; import java.awt.Color; import java.awt.Image; +import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.runelite.client.plugins.Plugin; public abstract class InfoBox { - @Getter + @Getter(AccessLevel.PACKAGE) private final Plugin plugin; @Getter @Setter private Image image; - @Getter - @Setter + @Getter(AccessLevel.PACKAGE) + @Setter(AccessLevel.PACKAGE) private Image scaledImage; - @Getter + @Getter(AccessLevel.PACKAGE) @Setter private InfoBoxPriority priority; From 78f16f28f0e4befc52da19c3f2338bee90388d72 Mon Sep 17 00:00:00 2001 From: Koekkruimels Date: Wed, 20 Feb 2019 13:26:51 +0100 Subject: [PATCH 125/304] kourend library plugin: add config option to hide duplicate books --- .../kourendlibrary/KourendLibraryConfig.java | 10 +++++ .../kourendlibrary/KourendLibraryOverlay.java | 19 +++++++-- .../kourendlibrary/KourendLibraryPlugin.java | 42 +++++++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryConfig.java index b61a24c139..6ec40a00fd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryConfig.java @@ -42,4 +42,14 @@ public interface KourendLibraryConfig extends Config { return true; } + + @ConfigItem( + keyName = "hideDuplicateBook", + name = "Hide duplicate book", + description = "Don't show the duplicate book locations in the library" + ) + default boolean hideDuplicateBook() + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java index b581b10bd8..f1f0162d59 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import javax.annotation.Nullable; import lombok.AccessLevel; import lombok.Setter; import net.runelite.api.Client; @@ -57,15 +58,19 @@ class KourendLibraryOverlay extends Overlay private final static int MAXIMUM_DISTANCE = 24; private final Library library; private final Client client; + private final KourendLibraryConfig config; + private final KourendLibraryPlugin plugin; @Setter(AccessLevel.PACKAGE) private boolean hidden; @Inject - private KourendLibraryOverlay(Library library, Client client) + private KourendLibraryOverlay(Library library, Client client, KourendLibraryConfig config, KourendLibraryPlugin plugin) { this.library = library; this.client = client; + this.config = config; + this.plugin = plugin; setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.ABOVE_SCENE); @@ -136,7 +141,7 @@ class KourendLibraryOverlay extends Overlay Color color = bookIsKnown ? Color.ORANGE : Color.WHITE; // Render the poly on the floor - if (!(bookIsKnown && book == null) && (library.getState() == SolvedState.NO_DATA || book != null || !possible.isEmpty())) + if (!(bookIsKnown && book == null) && (library.getState() == SolvedState.NO_DATA || book != null || !possible.isEmpty()) && !shouldHideOverlayIfDuplicateBook(book)) { Polygon poly = getCanvasTilePoly(client, localBookcase); if (poly != null) @@ -149,7 +154,7 @@ class KourendLibraryOverlay extends Overlay // If the book is singled out, render the text and the book's icon if (bookIsKnown) { - if (book != null) + if (book != null && !shouldHideOverlayIfDuplicateBook(book)) { FontMetrics fm = g.getFontMetrics(); Rectangle2D bounds = fm.getStringBounds(book.getShortName(), g); @@ -236,4 +241,12 @@ class KourendLibraryOverlay extends Overlay return null; } + + private boolean shouldHideOverlayIfDuplicateBook(@Nullable Book book) + { + return config.hideDuplicateBook() + && book != null + && !book.isDarkManuscript() + && plugin.doesPlayerContainBook(book); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java index 73602299f4..649189fc47 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java @@ -26,6 +26,7 @@ package net.runelite.client.plugins.kourendlibrary; import com.google.inject.Provides; import java.awt.image.BufferedImage; +import java.util.EnumSet; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.inject.Inject; @@ -34,6 +35,9 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.api.AnimationID; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; +import net.runelite.api.InventoryID; +import net.runelite.api.Item; +import net.runelite.api.ItemContainer; import net.runelite.api.MenuAction; import net.runelite.api.Player; import net.runelite.api.coords.WorldPoint; @@ -41,6 +45,7 @@ import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameTick; +import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; @@ -94,6 +99,7 @@ public class KourendLibraryPlugin extends Plugin private boolean buttonAttached = false; private WorldPoint lastBookcaseClick = null; private WorldPoint lastBookcaseAnimatedOn = null; + private EnumSet playerBooks = null; @Provides KourendLibraryConfig provideConfig(ConfigManager configManager) @@ -120,6 +126,8 @@ public class KourendLibraryPlugin extends Plugin overlayManager.add(overlay); + updatePlayerBooks(); + if (!config.hideButton()) { clientToolbar.addNavigation(navButton); @@ -135,6 +143,7 @@ public class KourendLibraryPlugin extends Plugin buttonAttached = false; lastBookcaseClick = null; lastBookcaseAnimatedOn = null; + playerBooks = null; } @Subscribe @@ -271,4 +280,37 @@ public class KourendLibraryPlugin extends Plugin } } } + + @Subscribe + public void onItemContainerChanged(ItemContainerChanged itemContainerChangedEvent) + { + updatePlayerBooks(); + } + + boolean doesPlayerContainBook(Book book) + { + return playerBooks.contains(book); + } + + private void updatePlayerBooks() + { + ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); + + if (itemContainer != null) + { + EnumSet books = EnumSet.noneOf(Book.class); + + for (Item item : itemContainer.getItems()) + { + Book book = Book.byId(item.getId()); + + if (book != null) + { + books.add(book); + } + } + + playerBooks = books; + } + } } \ No newline at end of file From fbd9bce202f9609e2917cfa9772e2f3e8ec7359c Mon Sep 17 00:00:00 2001 From: Koekkruimels Date: Sun, 24 Feb 2019 10:37:03 +0100 Subject: [PATCH 126/304] Refactor changes of #7951 to use doesPlayerContainBook --- .../plugins/kourendlibrary/KourendLibraryOverlay.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java index f1f0162d59..5cf7910ee6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java @@ -31,7 +31,6 @@ import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.geom.Rectangle2D; -import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Set; @@ -40,8 +39,6 @@ import javax.annotation.Nullable; import lombok.AccessLevel; import lombok.Setter; import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.ItemContainer; import net.runelite.api.Perspective; import static net.runelite.api.Perspective.getCanvasTilePoly; import net.runelite.api.Player; @@ -224,13 +221,10 @@ class KourendLibraryOverlay extends Overlay .forEach(n -> { Book b = library.getCustomerBook(); - ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); - boolean hasBookInInventory = itemContainer != null - && b != null - && Arrays.stream(itemContainer.getItems()).anyMatch(item -> item.getId() == b.getItem()); + boolean doesPlayerContainBook = b != null && plugin.doesPlayerContainBook(b); LocalPoint local = n.getLocalLocation(); Polygon poly = getCanvasTilePoly(client, local); - OverlayUtil.renderPolygon(g, poly, hasBookInInventory ? Color.GREEN : Color.WHITE); + OverlayUtil.renderPolygon(g, poly, doesPlayerContainBook ? Color.GREEN : Color.WHITE); Point screen = Perspective.localToCanvas(client, local, client.getPlane(), n.getLogicalHeight()); if (screen != null) { From 8d34c4960f5f96c8c21778217b731df464aff8a4 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 24 Feb 2019 11:55:11 +0100 Subject: [PATCH 127/304] Fix infobox impl access levels and remove unused values Signed-off-by: Tomas Slusny --- .../client/plugins/cannon/CannonCounter.java | 2 +- .../kingdomofmiscellania/KingdomCounter.java | 2 +- .../plugins/mta/graveyard/GraveyardCounter.java | 2 +- .../nightmarezone/AbsorptionCounter.java | 17 ++--------------- .../nightmarezone/NightmareZoneOverlay.java | 2 +- .../client/plugins/slayer/TaskCounter.java | 4 ++-- .../client/ui/overlay/infobox/Timer.java | 8 ++------ 7 files changed, 10 insertions(+), 27 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java index 631410d8c2..bd13e194be 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java @@ -32,7 +32,7 @@ public class CannonCounter extends InfoBox { private final CannonPlugin plugin; - public CannonCounter(BufferedImage img, CannonPlugin plugin) + CannonCounter(BufferedImage img, CannonPlugin plugin) { super(img, plugin); this.plugin = plugin; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java index 24f8029184..8a2871125f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java @@ -32,7 +32,7 @@ public class KingdomCounter extends Counter { private final KingdomPlugin plugin; - public KingdomCounter(BufferedImage image, KingdomPlugin plugin) + KingdomCounter(BufferedImage image, KingdomPlugin plugin) { super(image, plugin, plugin.getFavor()); this.plugin = plugin; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java index 907712ab28..ecfbafd544 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java @@ -31,7 +31,7 @@ import net.runelite.client.ui.overlay.infobox.Counter; public class GraveyardCounter extends Counter { - public GraveyardCounter(BufferedImage image, Plugin plugin) + GraveyardCounter(BufferedImage image, Plugin plugin) { super(image, plugin, 0); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java index 4c6b496a29..4671edde12 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java @@ -26,36 +26,23 @@ package net.runelite.client.plugins.nightmarezone; import java.awt.Color; import java.awt.image.BufferedImage; -import lombok.Getter; import lombok.Setter; import net.runelite.client.plugins.Plugin; import net.runelite.client.ui.overlay.infobox.Counter; +@Setter public class AbsorptionCounter extends Counter { - @Getter - @Setter private int threshold; - - @Getter - @Setter private Color aboveThresholdColor = Color.GREEN; - - @Getter - @Setter private Color belowThresholdColor = Color.RED; - public AbsorptionCounter(BufferedImage image, Plugin plugin, int absorption, int threshold) + AbsorptionCounter(BufferedImage image, Plugin plugin, int absorption, int threshold) { super(image, plugin, absorption); this.threshold = threshold; } - public void setAbsorption(int absorption) - { - setCount(absorption); - } - @Override public Color getTextColor() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java index e2a123b1af..71ae196d3e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java @@ -129,7 +129,7 @@ class NightmareZoneOverlay extends Overlay } else { - absorptionCounter.setAbsorption(absorptionPoints); + absorptionCounter.setCount(absorptionPoints); } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java index f73a5aae5b..0d4274c063 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java @@ -29,9 +29,9 @@ import net.runelite.client.ui.overlay.infobox.Counter; import java.awt.image.BufferedImage; -public class TaskCounter extends Counter +class TaskCounter extends Counter { - public TaskCounter(BufferedImage img, Plugin plugin, int amount) + TaskCounter(BufferedImage img, Plugin plugin, int amount) { super(img, plugin, amount); } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Timer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Timer.java index 3219b487b2..4d6c2b7be4 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Timer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Timer.java @@ -31,9 +31,11 @@ import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; import lombok.Getter; +import lombok.ToString; import net.runelite.client.plugins.Plugin; @Getter +@ToString public class Timer extends InfoBox { private final Instant startTime; @@ -51,12 +53,6 @@ public class Timer extends InfoBox endTime = startTime.plus(duration); } - @Override - public String toString() - { - return "Timer{" + "startTime=" + startTime + ", endTime=" + endTime + ", duration=" + duration + '}'; - } - @Override public String getText() { From 7f1a50ca7702304640be2910ad1034483fa3aeaa Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 24 Feb 2019 19:11:36 +0100 Subject: [PATCH 128/304] Add missing toggle for clan chat icons Signed-off-by: Tomas Slusny --- .../client/plugins/clanchat/ClanChatConfig.java | 13 +++++++++++-- .../client/plugins/clanchat/ClanChatPlugin.java | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java index 9b70ce0fca..22979c3349 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java @@ -31,11 +31,20 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("clanchat") public interface ClanChatConfig extends Config { + @ConfigItem( + keyName = "clanChatIcons", + name = "Clan Chat Icons", + description = "Show clan chat icons next to clan members." + ) + default boolean clanChatIcons() + { + return true; + } + @ConfigItem( keyName = "recentChats", name = "Recent Chats", - description = "Show recent clan chats.", - position = 1 + description = "Show recent clan chats." ) default boolean recentChats() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index 0b738c3f4b..eac97eec76 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -149,6 +149,11 @@ public class ClanChatPlugin extends Plugin private void insertClanRankIcon(final ChatMessage message) { + if (!config.clanChatIcons()) + { + return; + } + final ClanMemberRank rank = clanManager.getRank(message.getName()); if (rank != null && rank != ClanMemberRank.UNRANKED) From f57b310e5b4e15d87aee23ea9482a7c1f7d88499 Mon Sep 17 00:00:00 2001 From: SebastiaanVanspauwen <43320258+SebastiaanVanspauwen@users.noreply.github.com> Date: Sun, 24 Feb 2019 19:09:53 +0100 Subject: [PATCH 129/304] Clanchat: Show amount of members near you in infobox --- .../plugins/clanchat/ClanChatConfig.java | 10 ++ .../plugins/clanchat/ClanChatIndicator.java | 58 ++++++++++++ .../plugins/clanchat/ClanChatPlugin.java | 94 ++++++++++++++++++- .../client/ui/overlay/infobox/Counter.java | 2 +- 4 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatIndicator.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java index 22979c3349..6a8000391c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java @@ -51,6 +51,16 @@ public interface ClanChatConfig extends Config return true; } + @ConfigItem( + keyName = "clanCounter", + name = "Clan Members Counter", + description = "Show the amount of clan members near you." + ) + default boolean showClanCounter() + { + return false; + } + @ConfigItem( keyName = "chatsData", name = "", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatIndicator.java new file mode 100644 index 0000000000..e8f7542d7d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatIndicator.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018 Sebastiaan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.clanchat; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import net.runelite.client.ui.overlay.infobox.Counter; + +class ClanChatIndicator extends Counter +{ + private final ClanChatPlugin plugin; + + ClanChatIndicator(BufferedImage image, ClanChatPlugin plugin) + { + super(image, plugin, plugin.getClanAmount()); + this.plugin = plugin; + } + + @Override + public int getCount() + { + return plugin.getClanAmount(); + } + + @Override + public String getTooltip() + { + return plugin.getClanAmount() + " clan member(s) near you"; + } + + @Override + public Color getTextColor() + { + return Color.WHITE; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index eac97eec76..c73b731268 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -27,6 +27,7 @@ package net.runelite.client.plugins.clanchat; import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.inject.Provides; +import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; @@ -34,19 +35,27 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.ClanMemberRank; import net.runelite.api.Client; import net.runelite.api.GameState; +import net.runelite.api.Player; +import net.runelite.api.SpriteID; import net.runelite.api.VarClientStr; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; +import net.runelite.api.events.PlayerDespawned; +import net.runelite.api.events.PlayerSpawned; import net.runelite.api.events.VarClientStrChanged; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetType; +import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ClanManager; +import net.runelite.client.game.SpriteManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.util.Text; @PluginDescriptor( @@ -69,7 +78,18 @@ public class ClanChatPlugin extends Plugin @Inject private ClanChatConfig config; + @Inject + private InfoBoxManager infoBoxManager; + + @Inject + private SpriteManager spriteManager; + + @Inject + private ClientThread clientThread; + private List chats = new ArrayList<>(); + private List clanMembers = new ArrayList<>(); + private ClanChatIndicator clanMemberCounter; @Provides ClanChatConfig getConfig(ConfigManager configManager) @@ -86,15 +106,29 @@ public class ClanChatPlugin extends Plugin @Override public void shutDown() { + clanMembers.clear(); + removeClanCounter(); resetClanChats(); } @Subscribe public void onConfigChanged(ConfigChanged configChanged) { - if (configChanged.getGroup().equals("clanchat") && !config.recentChats()) + if (configChanged.getGroup().equals("clanchat")) { - resetClanChats(); + if (!config.recentChats()) + { + resetClanChats(); + } + + if (config.showClanCounter()) + { + clientThread.invoke(this::addClanCounter); + } + else + { + removeClanCounter(); + } } } @@ -147,6 +181,44 @@ public class ClanChatPlugin extends Plugin } } + @Subscribe + public void onGameStateChanged(GameStateChanged state) + { + if (state.getGameState() == GameState.LOADING) + { + clanMembers.clear(); + removeClanCounter(); + } + } + + @Subscribe + public void onPlayerSpawned(PlayerSpawned event) + { + if (event.getPlayer().isClanMember()) + { + clanMembers.add(event.getPlayer()); + + if (clanMemberCounter == null) + { + addClanCounter(); + } + } + } + + @Subscribe + public void onPlayerDespawned(PlayerDespawned event) + { + if (clanMembers.remove(event.getPlayer()) && clanMembers.isEmpty()) + { + removeClanCounter(); + } + } + + int getClanAmount() + { + return clanMembers.size(); + } + private void insertClanRankIcon(final ChatMessage message) { if (!config.clanChatIcons()) @@ -228,4 +300,22 @@ public class ClanChatPlugin extends Plugin config.chatsData(Text.toCSV(chats)); } + + private void removeClanCounter() + { + infoBoxManager.removeInfoBox(clanMemberCounter); + clanMemberCounter = null; + } + + private void addClanCounter() + { + if (!config.showClanCounter() || clanMemberCounter != null ) + { + return; + } + + final BufferedImage image = spriteManager.getSprite(SpriteID.TAB_CLAN_CHAT, 0); + clanMemberCounter = new ClanChatIndicator(image, this); + infoBoxManager.addInfoBox(clanMemberCounter); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Counter.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Counter.java index 49614e9b61..a498d4200d 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Counter.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/Counter.java @@ -47,7 +47,7 @@ public class Counter extends InfoBox @Override public String getText() { - return Integer.toString(count); + return Integer.toString(getCount()); } @Override From e4250c5d3b874274cf65620285bc2fce27d5e69b Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Feb 2019 10:15:30 -0500 Subject: [PATCH 130/304] xptracker service: only update last_updated after hiscores are saved --- .../runelite/http/service/xp/XpTrackerService.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java index 9f4e639964..9e8e0a5e06 100644 --- a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java +++ b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java @@ -96,17 +96,11 @@ public class XpTrackerService log.warn("Username update queue is full ({})", QUEUE_LIMIT); return; } + + usernameUpdateQueue.add(username); } - - con.createQuery("update player set last_updated = CURRENT_TIMESTAMP where id = :id") - .addParameter("id", playerEntity.getId()) - .executeUpdate(); } - synchronized (usernameUpdateQueue) - { - usernameUpdateQueue.add(username); - } usernameFilter.put(username); } @@ -190,7 +184,7 @@ public class XpTrackerService .addParameter("overall_rank", hiscoreResult.getOverall().getRank()) .executeUpdate(); - con.createQuery("update player set rank = :rank where id = :id") + con.createQuery("update player set rank = :rank, last_updated = CURRENT_TIMESTAMP where id = :id") .addParameter("id", playerEntity.getId()) .addParameter("rank", hiscoreResult.getOverall().getRank()) .executeUpdate(); From 368a080ad0b476d66a3ac3cc87c0e544efe4eb0d Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Feb 2019 13:44:49 -0500 Subject: [PATCH 131/304] xptracker: up xp threshold to 10k --- .../net/runelite/client/plugins/xptracker/XpTrackerPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java index 54dff5a299..bb43ffdd7a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java @@ -73,7 +73,7 @@ public class XpTrackerPlugin extends Plugin /** * Amount of EXP that must be gained for an update to be submitted. */ - private static final int XP_THRESHOLD = 1000; + private static final int XP_THRESHOLD = 10_000; static final List COMBAT = ImmutableList.of( Skill.ATTACK, From c8e85d07f7d8b31b0257e90c44e3aa7bbb0d7b40 Mon Sep 17 00:00:00 2001 From: Magic fTail Date: Sun, 24 Feb 2019 23:55:34 +0100 Subject: [PATCH 132/304] Split synchronizing and uploading loot data into separate configs --- .../plugins/loottracker/LootTrackerConfig.java | 16 ++++++++++++++-- .../plugins/loottracker/LootTrackerPanel.java | 8 +++++--- .../plugins/loottracker/LootTrackerPlugin.java | 5 ++--- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java index 98b7053117..bba5994d89 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java @@ -51,11 +51,23 @@ public interface LootTrackerConfig extends Config @ConfigItem( keyName = "saveLoot", - name = "Save loot", - description = "Save loot between client sessions (requires being logged in)" + name = "Submit loot tracker data", + description = "Submit loot tracker data (requires being logged in)" ) default boolean saveLoot() { return true; } + + @ConfigItem( + keyName = "syncPanel", + name = "Synchronize panel contents", + description = "Synchronize you local loot tracker with your online (requires being logged in). This means" + + " that panel is filled with portion of your remote data on startup and deleting data in panel deletes them" + + " also on server." + ) + default boolean syncPanel() + { + return true; + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java index 4aaa7e0c7a..ed850cdcbb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java @@ -99,6 +99,7 @@ class LootTrackerPanel extends PluginPanel private final ItemManager itemManager; private final LootTrackerPlugin plugin; + private final LootTrackerConfig config; private boolean groupLoot; private boolean hideIgnoredItems; @@ -130,10 +131,11 @@ class LootTrackerPanel extends PluginPanel INVISIBLE_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -220)); } - LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager) + LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager, final LootTrackerConfig config) { this.itemManager = itemManager; this.plugin = plugin; + this.config = config; this.hideIgnoredItems = true; setBorder(new EmptyBorder(6, 6, 6, 6)); @@ -297,7 +299,7 @@ class LootTrackerPanel extends PluginPanel // Delete all loot, or loot matching the current view LootTrackerClient client = plugin.getLootTrackerClient(); - if (client != null) + if (client != null && config.syncPanel()) { client.delete(currentView); } @@ -472,7 +474,7 @@ class LootTrackerPanel extends PluginPanel LootTrackerClient client = plugin.getLootTrackerClient(); // Without loot being grouped we have no way to identify single kills to be deleted - if (client != null && groupLoot) + if (client != null && groupLoot && config.syncPanel()) { client.delete(box.getId()); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 30d4a25ba5..055c2cc3f4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -195,7 +195,7 @@ public class LootTrackerPlugin extends Plugin protected void startUp() throws Exception { ignoredItems = Text.fromCSV(config.getIgnoredItems()); - panel = new LootTrackerPanel(this, itemManager); + panel = new LootTrackerPanel(this, itemManager, config); spriteManager.getSpriteAsync(SpriteID.TAB_INVENTORY, 0, panel::loadHeaderIcon); final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png"); @@ -227,9 +227,8 @@ public class LootTrackerPlugin extends Plugin { Collection lootRecords; - if (!config.saveLoot()) + if (!config.syncPanel()) { - // don't load loot if we're not saving loot return; } From ffb60d5b2a64ae49597e5b8669c8b182734798fd Mon Sep 17 00:00:00 2001 From: TheStonedTurtle <29030969+TheStonedTurtle@users.noreply.github.com> Date: Mon, 25 Feb 2019 10:43:47 -0800 Subject: [PATCH 133/304] Add dynamic hitpoints orb icon to poison plugin (#6517) To improve visibility of poison/venom/disease on low HP, also recolor heart icon when poisoned/venomed/diseased. --- .../main/java/net/runelite/api/VarPlayer.java | 4 + .../client/plugins/poison/PoisonConfig.java | 10 ++ .../client/plugins/poison/PoisonPlugin.java | 160 ++++++++++++++---- .../client/plugins/poison/1067-DISEASE.png | Bin 0 -> 2991 bytes .../client/plugins/poison/1067-POISON.png | Bin 0 -> 2992 bytes .../client/plugins/poison/1067-VENOM.png | Bin 0 -> 2986 bytes 6 files changed, 141 insertions(+), 33 deletions(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-DISEASE.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-POISON.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-VENOM.png diff --git a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java index 37b71aaf66..c3183074b0 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java +++ b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java @@ -37,6 +37,10 @@ public enum VarPlayer ATTACK_STYLE(43), QUEST_POINTS(101), IS_POISONED(102), + /** + * Seems to start at 50(10 splash) and goes down by 1 every 30 seconds + */ + DISEASE_VALUE(456), BANK_TAB(115), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java index 2595009205..6c723d4f71 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java @@ -42,4 +42,14 @@ public interface PoisonConfig extends Config { return false; } + + @ConfigItem( + keyName = "changeHealthIcon", + name = "Change HP Orb Icon", + description = "Configures whether the hp orb icon should change color to match poison/disease" + ) + default boolean changeHealthIcon() + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java index 68b9889a2a..84a4c5e3d6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java @@ -35,12 +35,13 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; import javax.inject.Inject; import lombok.Getter; -import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; +import net.runelite.api.GameState; import net.runelite.api.SpriteID; import net.runelite.api.VarPlayer; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.VarbitChanged; +import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.SpriteManager; @@ -50,22 +51,36 @@ import net.runelite.client.ui.FontManager; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.util.ColorUtil; +import net.runelite.client.util.ImageUtil; @PluginDescriptor( name = "Poison", description = "Tracks current damage values for Poison and Venom", - tags = {"combat", "poison", "venom"} + tags = {"combat", "poison", "venom", "heart", "hp"} ) -@Slf4j public class PoisonPlugin extends Plugin { static final int POISON_TICK_MILLIS = 18200; private static final int VENOM_THRESHOLD = 1000000; private static final int VENOM_MAXIUMUM_DAMAGE = 20; + private static final BufferedImage HEART_DISEASE; + private static final BufferedImage HEART_POISON; + private static final BufferedImage HEART_VENOM; + + static + { + HEART_DISEASE = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(PoisonPlugin.class, "1067-DISEASE.png"), 26, 26); + HEART_POISON = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(PoisonPlugin.class, "1067-POISON.png"), 26, 26); + HEART_VENOM = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(PoisonPlugin.class, "1067-VENOM.png"), 26, 26); + } + @Inject private Client client; + @Inject + private ClientThread clientThread; + @Inject private PoisonOverlay poisonOverlay; @@ -88,6 +103,8 @@ public class PoisonPlugin extends Plugin private Instant poisonNaturalCure; private Instant nextPoisonTick; private int lastValue = -1; + private int lastDiseaseValue = -1; + private BufferedImage heart; @Provides PoisonConfig getConfig(ConfigManager configManager) @@ -99,6 +116,11 @@ public class PoisonPlugin extends Plugin protected void startUp() throws Exception { overlayManager.add(poisonOverlay); + + if (client.getGameState() == GameState.LOGGED_IN) + { + clientThread.invoke(this::checkHealthIcon); + } } @Override @@ -117,64 +139,87 @@ public class PoisonPlugin extends Plugin poisonNaturalCure = null; nextPoisonTick = null; lastValue = -1; + lastDiseaseValue = -1; + clientThread.invoke(this::resetHealthIcon); } @Subscribe public void onVarbitChanged(VarbitChanged event) { final int poisonValue = client.getVar(VarPlayer.POISON); - if (poisonValue == lastValue) + if (poisonValue != lastValue) { - return; - } + lastValue = poisonValue; + nextPoisonTick = Instant.now().plus(Duration.of(POISON_TICK_MILLIS, ChronoUnit.MILLIS)); - lastValue = poisonValue; - nextPoisonTick = Instant.now().plus(Duration.of(POISON_TICK_MILLIS, ChronoUnit.MILLIS)); + final int damage = nextDamage(poisonValue); + this.lastDamage = damage; - final int damage = nextDamage(poisonValue); - this.lastDamage = damage; + envenomed = poisonValue >= VENOM_THRESHOLD; - envenomed = poisonValue >= VENOM_THRESHOLD; - - if (poisonValue < VENOM_THRESHOLD) - { - poisonNaturalCure = Instant.now().plus(Duration.of(POISON_TICK_MILLIS * poisonValue, ChronoUnit.MILLIS)); - } - else - { - poisonNaturalCure = null; - } - - if (config.showInfoboxes()) - { - if (infobox != null) + if (poisonValue < VENOM_THRESHOLD) { - infoBoxManager.removeInfoBox(infobox); - infobox = null; + poisonNaturalCure = Instant.now().plus(Duration.of(POISON_TICK_MILLIS * poisonValue, ChronoUnit.MILLIS)); + } + else + { + poisonNaturalCure = null; } - if (damage > 0) + if (config.showInfoboxes()) { - final BufferedImage image = getSplat(envenomed ? SpriteID.HITSPLAT_DARK_GREEN_VENOM : SpriteID.HITSPLAT_GREEN_POISON, damage); - - if (image != null) + if (infobox != null) { - infobox = new PoisonInfobox(image, this); - infoBoxManager.addInfoBox(infobox); + infoBoxManager.removeInfoBox(infobox); + infobox = null; + } + + if (damage > 0) + { + final BufferedImage image = getSplat(envenomed ? SpriteID.HITSPLAT_DARK_GREEN_VENOM : SpriteID.HITSPLAT_GREEN_POISON, damage); + + if (image != null) + { + infobox = new PoisonInfobox(image, this); + infoBoxManager.addInfoBox(infobox); + } } } + + checkHealthIcon(); + } + + final int diseaseValue = client.getVar(VarPlayer.DISEASE_VALUE); + if (diseaseValue != lastDiseaseValue) + { + lastDiseaseValue = diseaseValue; + checkHealthIcon(); } } @Subscribe public void onConfigChanged(ConfigChanged event) { - if (event.getGroup().equals(PoisonConfig.GROUP) && !config.showInfoboxes() && infobox != null) + if (!event.getGroup().equals(PoisonConfig.GROUP)) + { + return; + } + + if (!config.showInfoboxes() && infobox != null) { infoBoxManager.removeInfoBox(infobox); infobox = null; } + + if (config.changeHealthIcon()) + { + clientThread.invoke(this::checkHealthIcon); + } + else + { + clientThread.invoke(this::resetHealthIcon); + } } private static int nextDamage(int poisonValue) @@ -250,4 +295,53 @@ public class PoisonPlugin extends Plugin return line1 + line2; } + + private void checkHealthIcon() + { + if (!config.changeHealthIcon()) + { + return; + } + + final BufferedImage newHeart; + final int poison = client.getVar(VarPlayer.IS_POISONED); + + if (poison >= VENOM_THRESHOLD) + { + newHeart = HEART_VENOM; + } + else if (poison > 0) + { + newHeart = HEART_POISON; + } + else if (client.getVar(VarPlayer.DISEASE_VALUE) > 0) + { + newHeart = HEART_DISEASE; + } + else + { + resetHealthIcon(); + return; + } + + // Only update sprites when the heart icon actually changes + if (newHeart != heart) + { + heart = newHeart; + client.getWidgetSpriteCache().reset(); + client.getSpriteOverrides().put(SpriteID.MINIMAP_ORB_HITPOINTS_ICON, ImageUtil.getImageSpritePixels(heart, client)); + } + } + + private void resetHealthIcon() + { + if (heart == null) + { + return; + } + + client.getWidgetSpriteCache().reset(); + client.getSpriteOverrides().remove(SpriteID.MINIMAP_ORB_HITPOINTS_ICON); + heart = null; + } } \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-DISEASE.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-DISEASE.png new file mode 100644 index 0000000000000000000000000000000000000000..f2ff5ac911aafdd5efdebda94d62098d226a1eb2 GIT binary patch literal 2991 zcmV;g3sCflP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0002mNklIq7* zIMl_&wkB482)yv}y`Q|72ws{^`Xv>GG8b(*S0#6wF@+!CMF-Mb$(A>;UfeZ!zI1?o z8OmG;1rFv*0J75&CzGVNnpp#eYtqF5DEvStRXiFBy=-y;yy!rd#1wu&FNyh8t_qw? z;zg2w-OQS+^h5aHX`*%YICp^Fo7SiselbM!m7a3 lf9Smlw8G8LU;+W20|4(PYp5iOkT(DT002ovPDHLkV1fjkjR^n% literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-POISON.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-POISON.png new file mode 100644 index 0000000000000000000000000000000000000000..a4b05c1ca1c413f92f9e3f421500aafcfdc15016 GIT binary patch literal 2992 zcmV;h3s3ZkP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0002nNkl-L=rrxSK(vZZ69}!OjcWOsxsZD=9!LtLl<%;5{VEF```MCnct^>F# zi*g|~I2$hjNDm>&D25lHuD*W-Tx9`xc2F6*?u|rsOp*ZGaz%Ow@$7)~5`sl5NnIpX zOj5?JL1=NcI4Ywj^t6YY;wN~YG@SNbvM3kw-?Wcpo$h>DPd)Vw{??!g{D7Mpn7~F@ mH@LqdjGz&&e}*Oy;5Go2@ME3bOWqIw0000KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0002hNkl+)kPyLB(JD5)s3~eO=1FTV_G?m^an>iyttC3*fOb1|U~st;5u2u{g|y&i zz5}3AIc1{WfWGuHBqBBeKq@n5*jXeKw}vDE&iX{9a#ER5bvX!rlC(o96s1-_g8;$U z0ds2yJz;OVJIqGG;Bp5bylR@F7V_V=k7nEc?RomGZ}7JOANT?L0){{@Yy Date: Mon, 25 Feb 2019 20:20:00 +0000 Subject: [PATCH 134/304] skills calc: add new farmable crops and trees Add trees added with farming guild and snapegrass/giant seaweed. Signed-off-by: Will Thomas --- .../skillcalculator/skill_farming.json | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json index ae795fdcc4..d78b804943 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json @@ -60,6 +60,12 @@ "name": "Sweetcorn", "xp": 17 }, + { + "level": 23, + "icon": 21504, + "name": "Giant seaweed", + "xp": 21 + }, { "level": 26, "icon": 255, @@ -180,18 +186,36 @@ "name": "Papaya Tree", "xp": 6218.4 }, + { + "level": 57, + "icon": 22932, + "name": "White lily", + "xp": 292 + }, { "level": 60, "icon": 1515, "name": "Yew Tree", "xp": 7150.9 }, + { + "level": 61, + "icon": 231, + "name": "Snape grass", + "xp": 82 + }, { "level": 62, "icon": 3000, "name": "Snapdragon", "xp": 87.5 }, + { + "level": 65, + "icon": 23044, + "name": "Hespori", + "xp": 12662 + }, { "level": 67, "icon": 265, @@ -228,17 +252,35 @@ "name": "Dwarf Weed", "xp": 170.5 }, + { + "level": 82, + "icon": 22929, + "name": "Dragonfruit Tree", + "xp": 17895 + }, { "level": 83, "icon": 6063, "name": "Spirit Tree", "xp": 19501.3 }, + { + "level": 85, + "icon": 22935, + "name": "Celastrus Tree", + "xp": 14334 + }, { "level": 85, "icon": 269, "name": "Torstol", "xp": 199.5 + }, + { + "level": 90, + "icon": 19669, + "name": "Redwood Tree", + "xp": 22680 } ] } \ No newline at end of file From 7830d003ca7c3cdbf57accca53c1136570e2a526 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Feb 2019 14:21:42 -0500 Subject: [PATCH 135/304] api: add RS Enum API --- .../main/java/net/runelite/api/Client.java | 2 + .../net/runelite/api/EnumComposition.java | 36 +++++++++ .../net/runelite/mixins/RSClientMixin.java | 26 +++++++ .../java/net/runelite/mixins/RSEnumMixin.java | 75 +++++++++++++++++++ .../java/net/runelite/rs/api/RSClient.java | 3 + .../main/java/net/runelite/rs/api/RSEnum.java | 48 ++++++++++++ 6 files changed, 190 insertions(+) create mode 100644 runelite-api/src/main/java/net/runelite/api/EnumComposition.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSEnumMixin.java create mode 100644 runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index a410eb96a6..3fb789cf26 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1579,4 +1579,6 @@ public interface Client extends GameEngine * Returns client item composition cache */ NodeCache getItemCompositionCache(); + + EnumComposition getEnum(int id); } diff --git a/runelite-api/src/main/java/net/runelite/api/EnumComposition.java b/runelite-api/src/main/java/net/runelite/api/EnumComposition.java new file mode 100644 index 0000000000..7bbfaa1693 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/EnumComposition.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api; + +public interface EnumComposition +{ + int[] getIntVals(); + + String[] getStringVals(); + + int getIntValue(int key); + + String getStringValue(int key); +} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 122811ee37..d162081476 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -24,6 +24,8 @@ */ package net.runelite.mixins; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; @@ -32,6 +34,7 @@ import javax.annotation.Nullable; import javax.inject.Named; import net.runelite.api.ChatMessageType; import net.runelite.api.ClanMember; +import net.runelite.api.EnumComposition; import net.runelite.api.Friend; import net.runelite.api.GameState; import net.runelite.api.GrandExchangeOffer; @@ -106,6 +109,7 @@ import net.runelite.rs.api.RSChatLineBuffer; import net.runelite.rs.api.RSClanMemberManager; import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSDeque; +import net.runelite.rs.api.RSEnum; import net.runelite.rs.api.RSFriendContainer; import net.runelite.rs.api.RSFriendManager; import net.runelite.rs.api.RSHashTable; @@ -176,6 +180,11 @@ public abstract class RSClientMixin implements RSClient @Inject static int skyboxColor; + @Inject + private final Cache enumCache = CacheBuilder.newBuilder() + .maximumSize(64) + .build(); + @Inject @Override public Callbacks getCallbacks() @@ -1442,4 +1451,21 @@ public abstract class RSClientMixin implements RSClient return false; } + + @Inject + @Override + public EnumComposition getEnum(int id) + { + assert isClientThread() : "getEnum must be called on client thread"; + + RSEnum rsEnum = enumCache.getIfPresent(id); + if (rsEnum != null) + { + return rsEnum; + } + + rsEnum = getRsEnum(id); + enumCache.put(id, rsEnum); + return rsEnum; + } } \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSEnumMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSEnumMixin.java new file mode 100644 index 0000000000..06dd3ab2e8 --- /dev/null +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSEnumMixin.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.mixins; + +import net.runelite.api.mixins.Inject; +import net.runelite.api.mixins.Mixin; +import net.runelite.rs.api.RSEnum; + +@Mixin(RSEnum.class) +public abstract class RSEnumMixin implements RSEnum +{ + @Inject + @Override + public int getIntValue(int key) + { + final int[] keys = getKeys(); + if (keys == null) + { + return getDefaultInt(); + } + + for (int i = 0; i < keys.length; ++i) + { + if (keys[i] == key) + { + final int[] values = getIntVals(); + return values[i]; + } + } + return getDefaultInt(); + } + + @Inject + @Override + public String getStringValue(int key) + { + final int[] keys = getKeys(); + if (keys == null) + { + return getDefaultString(); + } + + for (int i = 0; i < keys.length; ++i) + { + if (keys[i] == key) + { + final String[] values = getStringVals(); + return values[i]; + } + } + return getDefaultString(); + } +} diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index 587eceb6e1..654e0048ea 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -929,4 +929,7 @@ public interface RSClient extends RSGameEngine, Client @Import("spellSelected") @Override void setSpellSelected(boolean selected); + + @Import("getEnum") + RSEnum getRsEnum(int id); } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java b/runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java new file mode 100644 index 0000000000..d1a5273e5b --- /dev/null +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.rs.api; + +import net.runelite.api.EnumComposition; +import net.runelite.mapping.Import; + +public interface RSEnum extends EnumComposition, RSCacheableNode +{ + @Import("keys") + int[] getKeys(); + + @Import("intVals") + @Override + int[] getIntVals(); + + @Import("stringVals") + @Override + String[] getStringVals(); + + @Import("defaultInt") + int getDefaultInt(); + + @Import("defaultString") + String getDefaultString(); +} From 5cdb642815c322888434b2c4b857ee55c55140a3 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Feb 2019 16:52:36 -0500 Subject: [PATCH 136/304] client: fix indenting of getItemCompositionCache javadoc --- runelite-api/src/main/java/net/runelite/api/Client.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 3fb789cf26..4c44c7e3ef 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1576,7 +1576,7 @@ public interface Client extends GameEngine void setSpellSelected(boolean selected); /** - * Returns client item composition cache + * Returns client item composition cache */ NodeCache getItemCompositionCache(); From 01bfb8af197f01beee14ecb1093747f211fc492f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Feb 2019 20:13:11 -0500 Subject: [PATCH 137/304] Revert "Clear stored npcs in fishing/pc/rc plugins" This reverts commit 7eeb484c648c95f84505b039fd33ad18bf9c55d6. --- .../client/plugins/fishing/FishingPlugin.java | 11 ----------- .../plugins/pestcontrol/PestControlPlugin.java | 13 +------------ .../client/plugins/runecraft/RunecraftPlugin.java | 1 - 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java index 07977334e4..592f706455 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java @@ -50,7 +50,6 @@ import net.runelite.api.NPC; import net.runelite.api.Varbits; import net.runelite.api.coords.LocalPoint; import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.ItemContainerChanged; @@ -144,16 +143,6 @@ public class FishingPlugin extends Plugin currentSpot = null; } - @Subscribe - public void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOADING) - { - fishingSpots.clear(); - minnowSpots.clear(); - } - } - @Subscribe public void onItemContainerChanged(ItemContainerChanged event) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java index 360e56f40d..7407c5f301 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java @@ -35,14 +35,12 @@ import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; -import net.runelite.api.GameState; import net.runelite.api.NPC; import net.runelite.api.NpcID; import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; +import net.runelite.client.eventbus.Subscribe; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; -import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager; @@ -89,15 +87,6 @@ public class PestControlPlugin extends Plugin spinners.clear(); } - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - spinners.clear(); - } - } - @Subscribe public void onChatMessage(ChatMessage chatMessage) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java index 14b53f9995..7f0cef2d94 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java @@ -232,7 +232,6 @@ public class RunecraftPlugin extends Plugin if (event.getGameState() == GameState.LOADING) { abyssObjects.clear(); - darkMage = null; } } From 0821cf216d43265188f4408be29e64f83bc6c286 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Feb 2019 20:18:31 -0500 Subject: [PATCH 138/304] Clear stored npcs in fishing/pc/rc plugins Fixes #5970 This was originally attempted in 7eeb484c648c95f84505b039fd33ad18bf9c55d6 but NPCs are not automatically despawned from a scene change, which causes eg. the fishing plugin to lose fishing spots that are in view during a scene change. --- .../client/plugins/fishing/FishingPlugin.java | 12 ++++++++++++ .../plugins/pestcontrol/PestControlPlugin.java | 14 +++++++++++++- .../client/plugins/runecraft/RunecraftPlugin.java | 12 ++++++++++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java index 592f706455..8da48d7cdc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java @@ -50,6 +50,7 @@ import net.runelite.api.NPC; import net.runelite.api.Varbits; import net.runelite.api.coords.LocalPoint; import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.ItemContainerChanged; @@ -143,6 +144,17 @@ public class FishingPlugin extends Plugin currentSpot = null; } + @Subscribe + public void onGameStateChanged(GameStateChanged gameStateChanged) + { + GameState gameState = gameStateChanged.getGameState(); + if (gameState == GameState.CONNECTION_LOST || gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING) + { + fishingSpots.clear(); + minnowSpots.clear(); + } + } + @Subscribe public void onItemContainerChanged(ItemContainerChanged event) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java index 7407c5f301..7e711e66a0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java @@ -35,12 +35,14 @@ import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; +import net.runelite.api.GameState; import net.runelite.api.NPC; import net.runelite.api.NpcID; import net.runelite.api.events.ChatMessage; -import net.runelite.client.eventbus.Subscribe; +import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; +import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager; @@ -87,6 +89,16 @@ public class PestControlPlugin extends Plugin spinners.clear(); } + @Subscribe + public void onGameStateChanged(GameStateChanged event) + { + GameState gameState = event.getGameState(); + if (gameState == GameState.CONNECTION_LOST || gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING) + { + spinners.clear(); + } + } + @Subscribe public void onChatMessage(ChatMessage chatMessage) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java index 7f0cef2d94..4662b95d5a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java @@ -229,9 +229,17 @@ public class RunecraftPlugin extends Plugin @Subscribe public void onGameStateChanged(GameStateChanged event) { - if (event.getGameState() == GameState.LOADING) + GameState gameState = event.getGameState(); + switch (gameState) { - abyssObjects.clear(); + case LOADING: + abyssObjects.clear(); + break; + case CONNECTION_LOST: + case HOPPING: + case LOGIN_SCREEN: + darkMage = null; + break; } } From 81b98c18960c8afcfb20fe3469da5ced66ef4528 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Feb 2019 09:33:17 -0500 Subject: [PATCH 139/304] Revert "Clear Cerberus ghost on LOADING game state" This reverts commit b99c8d748083ebfbf8eecc7e399ce9a0d29d5aaf. --- .../net/runelite/client/plugins/cerberus/CerberusPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java index 322e8c38cd..2087e31844 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java @@ -75,7 +75,7 @@ public class CerberusPlugin extends Plugin @Subscribe public void onGameStateChanged(GameStateChanged event) { - if (event.getGameState() == GameState.LOADING) + if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING) { ghosts.clear(); } From 1dee0120becb956b9b101949b3cf288ee339533e Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Feb 2019 09:44:39 -0500 Subject: [PATCH 140/304] cerb plugin: clear ghosts on connection lost too --- .../net/runelite/client/plugins/cerberus/CerberusPlugin.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java index 2087e31844..47f1adbec4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java @@ -75,7 +75,8 @@ public class CerberusPlugin extends Plugin @Subscribe public void onGameStateChanged(GameStateChanged event) { - if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING) + GameState gameState = event.getGameState(); + if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING || gameState == GameState.CONNECTION_LOST) { ghosts.clear(); } From b86061dc80e2e122b87206d9072cf8421ffce056 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Feb 2019 17:38:01 -0500 Subject: [PATCH 141/304] http service: remove ws service This has been unused now for a few releases --- .../http/service/account/AccountService.java | 14 --- .../http/service/ws/SessionManager.java | 67 ------------ .../runelite/http/service/ws/WSService.java | 100 ------------------ 3 files changed, 181 deletions(-) delete mode 100644 http-service/src/main/java/net/runelite/http/service/ws/SessionManager.java delete mode 100644 http-service/src/main/java/net/runelite/http/service/ws/WSService.java diff --git a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java index 3ef3a98659..c78a25b9ff 100644 --- a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java +++ b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java @@ -45,8 +45,6 @@ import net.runelite.http.api.ws.messages.LoginResponse; import net.runelite.http.service.account.beans.SessionEntry; import net.runelite.http.service.account.beans.UserEntry; import net.runelite.http.service.util.redis.RedisPool; -import net.runelite.http.service.ws.SessionManager; -import net.runelite.http.service.ws.WSService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -241,12 +239,6 @@ public class AccountService LoginResponse response = new LoginResponse(); response.setUsername(username); - WSService service = SessionManager.findSession(uuid); - if (service != null) - { - service.send(response); - } - try (Jedis jedis = jedisPool.getResource()) { jedis.publish("session." + uuid, websocketGson.toJson(response, WebsocketMessage.class)); @@ -276,10 +268,4 @@ public class AccountService { auth.handle(request, response); } - - @RequestMapping("/wscount") - public int wscount() - { - return SessionManager.getCount(); - } } diff --git a/http-service/src/main/java/net/runelite/http/service/ws/SessionManager.java b/http-service/src/main/java/net/runelite/http/service/ws/SessionManager.java deleted file mode 100644 index 815ab911e8..0000000000 --- a/http-service/src/main/java/net/runelite/http/service/ws/SessionManager.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.service.ws; - -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class SessionManager -{ - private static final ConcurrentMap sessions = new ConcurrentHashMap<>(); - - public static void changeSessionUID(WSService service, UUID uuid) - { - synchronized (service) - { - remove(service); - service.setUuid(uuid); - sessions.put(uuid, service); - } - } - - static void remove(WSService service) - { - synchronized (service) - { - UUID current = service.getUuid(); - if (current != null) - { - sessions.remove(current); - service.setUuid(null); - } - } - } - - public static WSService findSession(UUID uuid) - { - return sessions.get(uuid); - } - - public static int getCount() - { - return sessions.size(); - } -} diff --git a/http-service/src/main/java/net/runelite/http/service/ws/WSService.java b/http-service/src/main/java/net/runelite/http/service/ws/WSService.java deleted file mode 100644 index 05489f2b87..0000000000 --- a/http-service/src/main/java/net/runelite/http/service/ws/WSService.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.service.ws; - -import com.google.gson.Gson; -import java.util.UUID; -import javax.websocket.CloseReason; -import javax.websocket.EndpointConfig; -import javax.websocket.OnClose; -import javax.websocket.OnError; -import javax.websocket.OnMessage; -import javax.websocket.OnOpen; -import javax.websocket.Session; -import javax.websocket.server.ServerEndpoint; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.http.api.ws.WebsocketGsonFactory; -import net.runelite.http.api.ws.WebsocketMessage; -import net.runelite.http.api.ws.messages.Handshake; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@ServerEndpoint("/ws") -public class WSService -{ - private static final Logger logger = LoggerFactory.getLogger(WSService.class); - - private static final Gson gson = WebsocketGsonFactory.build(); - - private Session session; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private UUID uuid; - - public void send(WebsocketMessage message) - { - String json = gson.toJson(message, WebsocketMessage.class); - - logger.debug("Sending {}", json); - - session.getAsyncRemote().sendText(json); - } - - @OnOpen - public void onOpen(Session session, EndpointConfig config) - { - this.session = session; - logger.debug("New session {}", session); - } - - @OnClose - public void onClose(Session session, CloseReason resaon) - { - SessionManager.remove(this); - logger.debug("Close session {}", session); - } - - @OnError - public void onError(Session session, Throwable ex) - { - SessionManager.remove(this); - logger.debug("Error in session {}", session, ex); - } - - @OnMessage - public void onMessage(Session session, String text) - { - WebsocketMessage message = gson.fromJson(text, WebsocketMessage.class); - logger.debug("Got message: {}", message); - - if (message instanceof Handshake) - { - Handshake hs = (Handshake) message; - SessionManager.changeSessionUID(this, hs.getSession()); - } - } -} From 5e9d0c1abb57e430eab2410007d7f2353fc52b54 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 26 Feb 2019 08:47:31 -0500 Subject: [PATCH 142/304] mixins: inject Client constructor for initialization of enumCache --- .../src/main/java/net/runelite/mixins/RSClientMixin.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index d162081476..5638409b51 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -185,6 +185,11 @@ public abstract class RSClientMixin implements RSClient .maximumSize(64) .build(); + @Inject + public RSClientMixin() + { + } + @Inject @Override public Callbacks getCallbacks() From d92db797c390dd2ad0c96dd32f9f05d4ff6c792a Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Tue, 26 Feb 2019 13:21:41 +0000 Subject: [PATCH 143/304] Add account prompt to the OAuth URL --- .../net/runelite/http/service/account/AccountService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java index c78a25b9ff..5a6518e838 100644 --- a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java +++ b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java @@ -33,6 +33,8 @@ import com.github.scribejava.core.model.Verb; import com.github.scribejava.core.oauth.OAuth20Service; import com.google.gson.Gson; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; import java.util.UUID; import java.util.concurrent.ExecutionException; import javax.servlet.http.HttpServletRequest; @@ -148,7 +150,10 @@ public class AccountService .state(gson.toJson(state)) .build(GoogleApi20.instance()); - String authorizationUrl = service.getAuthorizationUrl(); + final Map additionalParams = new HashMap<>(); + additionalParams.put("prompt", "select_account"); + + String authorizationUrl = service.getAuthorizationUrl(additionalParams); OAuthResponse lr = new OAuthResponse(); lr.setOauthUrl(authorizationUrl); From dc3b89a80735148b329e972aea0d0b7d844395e8 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 13 Feb 2019 23:13:05 +0100 Subject: [PATCH 144/304] Add Swagger static document generation Signed-off-by: Tomas Slusny --- http-service/pom.xml | 42 +++++++ http-service/src/main/templates/markdown.hbs | 110 ++++++++++++++++++ http-service/src/main/templates/operation.hbs | 71 +++++++++++ http-service/src/main/templates/security.hbs | 88 ++++++++++++++ .../src/main/templates/template.html.hbs | 49 ++++++++ 5 files changed, 360 insertions(+) create mode 100644 http-service/src/main/templates/markdown.hbs create mode 100644 http-service/src/main/templates/operation.hbs create mode 100644 http-service/src/main/templates/security.hbs create mode 100644 http-service/src/main/templates/template.html.hbs diff --git a/http-service/pom.xml b/http-service/pom.xml index d1217f0ced..7a58a078b9 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -180,6 +180,48 @@ spring-boot-maven-plugin ${spring.boot.version} + + com.github.kongchen + swagger-maven-plugin + 3.1.8 + + + + true + + net.runelite + + + https + + api.runelite.net + /runelite-${project.version} + + ${project.parent.name} HTTP API + ${project.version} + ${project.description} + + https://tldrlegal.com/license/bsd-2-clause-license-(freebsd) + BSD 2-Clause "Simplified" + + + ${basedir}/src/main/templates/template.html.hbs + ${project.build.directory}/swagger-ui + ${project.build.directory}/site/api.html + true + json + + + + + + compile + + generate + + + + diff --git a/http-service/src/main/templates/markdown.hbs b/http-service/src/main/templates/markdown.hbs new file mode 100644 index 0000000000..1beacd052a --- /dev/null +++ b/http-service/src/main/templates/markdown.hbs @@ -0,0 +1,110 @@ +{{#info}} +# {{title}} +{{join schemes " | "}}://{{host}}{{basePath}} + +{{description}} + +{{#contact}} +[**Contact the developer**](mailto:{{email}}) +{{/contact}} + +**Version** {{version}} + +{{#if termsOfService}} +[**Terms of Service**]({{termsOfService}}) +{{/if}} + +{{/info}} + +{{#if consumes}}__Consumes:__ {{join consumes ", "}}{{/if}} + +{{#if produces}}__Produces:__ {{join produces ", "}}{{/if}} + +{{#if securityDefinitions}} +# Security Definitions +{{> security}} +{{/if}} + +
+Table Of Contents +[toc] +
+ +# APIs + +{{#each paths}} +## {{@key}} +{{#this}} +{{#get}} +### GET +{{> operation}} +{{/get}} + +{{#put}} +### PUT +{{> operation}} +{{/put}} + +{{#post}} +### POST + +{{> operation}} + +{{/post}} + +{{#delete}} +### DELETE +{{> operation}} +{{/delete}} + +{{#option}} +### OPTION +{{> operation}} +{{/option}} + +{{#patch}} +### PATCH +{{> operation}} +{{/patch}} + +{{#head}} +### HEAD +{{> operation}} +{{/head}} + +{{/this}} +{{/each}} + +# Definitions +{{#each definitions}} +## {{@key}} + + + + + + + + + + {{#each this.properties}} + + + + + + + + {{/each}} +
nametyperequireddescriptionexample
{{@key}} + {{#ifeq type "array"}} + {{#items.$ref}} + {{type}}[{{basename items.$ref}}] + {{/items.$ref}} + {{^items.$ref}}{{type}}[{{items.type}}]{{/items.$ref}} + {{else}} + {{#$ref}}{{basename $ref}}{{/$ref}} + {{^$ref}}{{type}}{{#format}} ({{format}}){{/format}}{{/$ref}} + {{/ifeq}} + {{#required}}required{{/required}}{{^required}}optional{{/required}}{{#description}}{{{description}}}{{/description}}{{^description}}-{{/description}}{{example}}
+{{/each}} diff --git a/http-service/src/main/templates/operation.hbs b/http-service/src/main/templates/operation.hbs new file mode 100644 index 0000000000..f7015850b8 --- /dev/null +++ b/http-service/src/main/templates/operation.hbs @@ -0,0 +1,71 @@ +{{#deprecated}}-deprecated-{{/deprecated}} +{{summary}} + +{{description}} + +{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}}) +{{/if}} + +{{#if security}} +#### Security +{{/if}} + +{{#security}} +{{#each this}} +* {{@key}} +{{#this}} * {{this}} +{{/this}} +{{/each}} +{{/security}} + +#### Request + +{{#if consumes}}__Content-Type:__ {{join consumes ", "}}{{/if}} + +##### Parameters +{{#if parameters}} + + + + + + + + + +{{/if}} + +{{#parameters}} + + + + + + +{{#ifeq in "body"}} + +{{else}} + {{#ifeq type "array"}} + + {{else}} + + {{/ifeq}} +{{/ifeq}} + +{{/parameters}} +{{#if parameters}} +
NameLocated inRequiredDescriptionDefaultSchema
{{name}}{{in}}{{#if required}}yes{{else}}no{{/if}}{{description}}{{#if pattern}} (**Pattern**: `{{pattern}}`){{/if}} - + {{#ifeq schema.type "array"}}Array[{{basename schema.items.$ref}}]{{/ifeq}} + {{#schema.$ref}}{{basename schema.$ref}} {{/schema.$ref}} + Array[{{items.type}}] ({{collectionFormat}}){{type}} {{#format}}({{format}}){{/format}}
+{{/if}} + + +#### Response + +{{#if produces}}__Content-Type:__ {{join produces ", "}}{{/if}} + +| Status Code | Reason | Response Model | +|-------------|-------------|----------------| +{{#each responses}}| {{@key}} | {{description}} | {{#schema.$ref}}{{basename schema.$ref}}{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[{{basename schema.items.$ref}}]{{/ifeq}}{{^schema}} - {{/schema}}| +{{/each}} diff --git a/http-service/src/main/templates/security.hbs b/http-service/src/main/templates/security.hbs new file mode 100644 index 0000000000..04f86e8380 --- /dev/null +++ b/http-service/src/main/templates/security.hbs @@ -0,0 +1,88 @@ +{{#each securityDefinitions}} +### {{@key}} +{{#this}} +{{#ifeq type "oauth2"}} + + + + + +{{#if description}} + + + + +{{/if}} +{{#if authorizationUrl}} + + + + +{{/if}} +{{#if flow}} + + + + +{{/if}} +{{#if tokenUrl}} + + + + +{{/if}} +{{#if scopes}} + + +{{#each scopes}} + + + + +{{/each}} + +{{/if}} +
type{{type}}
description{{description}}
authorizationUrl{{authorizationUrl}}
flow{{flow}}
tokenUrl{{tokenUrl}}
scopes{{@key}}{{this}}
+{{/ifeq}} +{{#ifeq type "apiKey"}} + + + + + +{{#if description}} + + + + +{{/if}} +{{#if name}} + + + + +{{/if}} +{{#if in}} + + + + +{{/if}} +
type{{type}}
description{{description}}
name{{name}}
in{{in}}
+{{/ifeq}} +{{#ifeq type "basic"}} + + + + + +{{#if description}} + + + + +{{/if}} +
type{{type}}
description{{description}}
+{{/ifeq}} +{{/this}} +{{/each}} \ No newline at end of file diff --git a/http-service/src/main/templates/template.html.hbs b/http-service/src/main/templates/template.html.hbs new file mode 100644 index 0000000000..da587c2cc4 --- /dev/null +++ b/http-service/src/main/templates/template.html.hbs @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + {{info.title}} {{info.version}} + + + + + \ No newline at end of file From d92f1ccab8a64d58e626ca38c872cec29118f0cd Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 13 Feb 2019 23:13:20 +0100 Subject: [PATCH 145/304] Fix RequestMapping annotations in http-service Signed-off-by: Tomas Slusny --- .../http/service/account/AccountService.java | 9 +++++---- .../http/service/cache/CacheController.java | 19 ++++++++++--------- .../http/service/config/ConfigController.java | 3 ++- .../service/examine/ExamineController.java | 7 ++++--- .../http/service/feed/FeedController.java | 3 ++- .../service/hiscore/HiscoreController.java | 5 +++-- .../http/service/item/ItemController.java | 15 ++++++++------- .../loottracker/LootTrackerController.java | 3 ++- .../osbuddy/OSBGrandExchangeController.java | 3 ++- .../http/service/sprite/SpriteController.java | 3 ++- .../http/service/worlds/WorldController.java | 3 ++- .../http/service/xp/XpTrackerController.java | 5 +++-- .../http/service/xtea/XteaController.java | 5 +++-- 13 files changed, 48 insertions(+), 35 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java index c78a25b9ff..cda996ea1e 100644 --- a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java +++ b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java @@ -50,6 +50,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -133,7 +134,7 @@ public class AccountService } } - @RequestMapping("/login") + @GetMapping("/login") public OAuthResponse login(@RequestParam UUID uuid) { State state = new State(); @@ -157,7 +158,7 @@ public class AccountService return lr; } - @RequestMapping("/callback") + @GetMapping("/callback") public Object callback( HttpServletRequest request, HttpServletResponse response, @@ -245,7 +246,7 @@ public class AccountService } } - @RequestMapping("/logout") + @GetMapping("/logout") public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException { SessionEntry session = auth.handle(request, response); @@ -263,7 +264,7 @@ public class AccountService } } - @RequestMapping("/session-check") + @GetMapping("/session-check") public void sessionCheck(HttpServletRequest request, HttpServletResponse response) throws IOException { auth.handle(request, response); diff --git a/http-service/src/main/java/net/runelite/http/service/cache/CacheController.java b/http-service/src/main/java/net/runelite/http/service/cache/CacheController.java index 9e4c0ab0bb..f86f453412 100644 --- a/http-service/src/main/java/net/runelite/http/service/cache/CacheController.java +++ b/http-service/src/main/java/net/runelite/http/service/cache/CacheController.java @@ -62,6 +62,7 @@ import net.runelite.http.service.cache.beans.IndexEntry; import net.runelite.http.service.util.exception.NotFoundException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -75,7 +76,7 @@ public class CacheController @Autowired private CacheService cacheService; - @RequestMapping("/") + @GetMapping("/") public List listCaches() { return cacheService.listCaches().stream() @@ -83,7 +84,7 @@ public class CacheController .collect(Collectors.toList()); } - @RequestMapping("{cacheId}") + @GetMapping("{cacheId}") public List listIndexes(@PathVariable int cacheId) { CacheEntry cache = cacheService.findCache(cacheId); @@ -99,7 +100,7 @@ public class CacheController .collect(Collectors.toList()); } - @RequestMapping("{cacheId}/{indexId}") + @GetMapping("{cacheId}/{indexId}") public List listArchives(@PathVariable int cacheId, @PathVariable int indexId) { @@ -122,7 +123,7 @@ public class CacheController .collect(Collectors.toList()); } - @RequestMapping("{cacheId}/{indexId}/{archiveId}") + @GetMapping("{cacheId}/{indexId}/{archiveId}") public CacheArchive getCacheArchive(@PathVariable int cacheId, @PathVariable int indexId, @PathVariable int archiveId) @@ -149,7 +150,7 @@ public class CacheController archiveEntry.getNameHash(), archiveEntry.getRevision()); } - @RequestMapping("{cacheId}/{indexId}/{archiveId}/data") + @GetMapping("{cacheId}/{indexId}/{archiveId}/data") public byte[] getArchiveData( @PathVariable int cacheId, @PathVariable int indexId, @@ -200,7 +201,7 @@ public class CacheController return archiveEntry; } - @RequestMapping("item/{itemId}") + @GetMapping("item/{itemId}") public ItemDefinition getItem(@PathVariable int itemId) throws IOException { ArchiveEntry archiveEntry = findConfig(ConfigType.ITEM); @@ -221,7 +222,7 @@ public class CacheController return itemdef; } - @RequestMapping(path = "item/{itemId}/image", produces = "image/png") + @GetMapping(path = "item/{itemId}/image", produces = "image/png") public ResponseEntity getItemImage( @PathVariable int itemId, @RequestParam(defaultValue = "1") int quantity, @@ -313,7 +314,7 @@ public class CacheController return ResponseEntity.ok(bao.toByteArray()); } - @RequestMapping("object/{objectId}") + @GetMapping("object/{objectId}") public ObjectDefinition getObject( @PathVariable int objectId ) throws IOException @@ -336,7 +337,7 @@ public class CacheController return objectdef; } - @RequestMapping("npc/{npcId}") + @GetMapping("npc/{npcId}") public NpcDefinition getNpc( @PathVariable int npcId ) throws IOException diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java index 966d49cda2..b14a03659c 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java @@ -31,6 +31,7 @@ import net.runelite.http.api.config.Configuration; import net.runelite.http.service.account.AuthFilter; import net.runelite.http.service.account.beans.SessionEntry; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -52,7 +53,7 @@ public class ConfigController this.authFilter = authFilter; } - @RequestMapping + @GetMapping public Configuration get(HttpServletRequest request, HttpServletResponse response) throws IOException { SessionEntry session = authFilter.handle(request, response); diff --git a/http-service/src/main/java/net/runelite/http/service/examine/ExamineController.java b/http-service/src/main/java/net/runelite/http/service/examine/ExamineController.java index c689172e9b..b7e079497f 100644 --- a/http-service/src/main/java/net/runelite/http/service/examine/ExamineController.java +++ b/http-service/src/main/java/net/runelite/http/service/examine/ExamineController.java @@ -30,6 +30,7 @@ import static net.runelite.http.service.examine.ExamineType.OBJECT; import net.runelite.http.service.item.ItemEntry; import net.runelite.http.service.item.ItemService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -50,19 +51,19 @@ public class ExamineController this.itemService = itemService; } - @RequestMapping("/npc/{id}") + @GetMapping("/npc/{id}") public String getNpc(@PathVariable int id) { return examineService.get(NPC, id); } - @RequestMapping("/object/{id}") + @GetMapping("/object/{id}") public String getObject(@PathVariable int id) { return examineService.get(OBJECT, id); } - @RequestMapping("/item/{id}") + @GetMapping("/item/{id}") public String getItem(@PathVariable int id) { // Tradeable item examine info is available from the Jagex item API diff --git a/http-service/src/main/java/net/runelite/http/service/feed/FeedController.java b/http-service/src/main/java/net/runelite/http/service/feed/FeedController.java index fa641d3714..c679cd319f 100644 --- a/http-service/src/main/java/net/runelite/http/service/feed/FeedController.java +++ b/http-service/src/main/java/net/runelite/http/service/feed/FeedController.java @@ -38,6 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.CacheControl; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -95,7 +96,7 @@ public class FeedController feedResult = new FeedResult(items); } - @RequestMapping + @GetMapping public ResponseEntity getFeed() { if (feedResult == null) diff --git a/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreController.java b/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreController.java index d144b7db79..25a89e6a8d 100644 --- a/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreController.java +++ b/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreController.java @@ -34,6 +34,7 @@ import net.runelite.http.service.util.HiscoreEndpointEditor; import net.runelite.http.service.xp.XpTrackerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -50,7 +51,7 @@ public class HiscoreController @Autowired private XpTrackerService xpTrackerService; - @RequestMapping("/{endpoint}") + @GetMapping("/{endpoint}") public HiscoreResult lookup(@PathVariable HiscoreEndpoint endpoint, @RequestParam String username) throws ExecutionException { HiscoreResult result = hiscoreService.lookupUsername(username, endpoint); @@ -68,7 +69,7 @@ public class HiscoreController return result; } - @RequestMapping("/{endpoint}/{skillName}") + @GetMapping("/{endpoint}/{skillName}") public SingleHiscoreSkillResult singleSkillLookup(@PathVariable HiscoreEndpoint endpoint, @PathVariable String skillName, @RequestParam String username) throws ExecutionException { HiscoreSkill skill = HiscoreSkill.valueOf(skillName.toUpperCase()); diff --git a/http-service/src/main/java/net/runelite/http/service/item/ItemController.java b/http-service/src/main/java/net/runelite/http/service/item/ItemController.java index 9c05889330..9d1ed5710e 100644 --- a/http-service/src/main/java/net/runelite/http/service/item/ItemController.java +++ b/http-service/src/main/java/net/runelite/http/service/item/ItemController.java @@ -40,6 +40,7 @@ import net.runelite.http.api.item.SearchResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.CacheControl; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -78,7 +79,7 @@ public class ItemController .toArray(ItemPrice[]::new), 30, TimeUnit.MINUTES); } - @RequestMapping("/{itemId}") + @GetMapping("/{itemId}") public Item getItem(HttpServletResponse response, @PathVariable int itemId) { ItemEntry item = itemService.getItem(itemId); @@ -91,7 +92,7 @@ public class ItemController return null; } - @RequestMapping(path = "/{itemId}/icon", produces = "image/gif") + @GetMapping(path = "/{itemId}/icon", produces = "image/gif") public ResponseEntity getIcon(@PathVariable int itemId) { ItemEntry item = itemService.getItem(itemId); @@ -104,7 +105,7 @@ public class ItemController return ResponseEntity.notFound().build(); } - @RequestMapping(path = "/{itemId}/icon/large", produces = "image/gif") + @GetMapping(path = "/{itemId}/icon/large", produces = "image/gif") public ResponseEntity getIconLarge(HttpServletResponse response, @PathVariable int itemId) { ItemEntry item = itemService.getItem(itemId); @@ -117,7 +118,7 @@ public class ItemController return ResponseEntity.notFound().build(); } - @RequestMapping("/{itemId}/price") + @GetMapping("/{itemId}/price") public ResponseEntity itemPrice( @PathVariable int itemId, @RequestParam(required = false) Instant time @@ -179,7 +180,7 @@ public class ItemController .body(itemPrice); } - @RequestMapping("/search") + @GetMapping("/search") public SearchResult search(@RequestParam String query) { List result = itemService.search(query); @@ -193,7 +194,7 @@ public class ItemController return searchResult; } - @RequestMapping("/price") + @GetMapping("/price") public ItemPrice[] prices(@RequestParam("id") int[] itemIds) { if (itemIds.length > MAX_BATCH_LOOKUP) @@ -216,7 +217,7 @@ public class ItemController .toArray(ItemPrice[]::new); } - @RequestMapping("/prices") + @GetMapping("/prices") public ResponseEntity prices() { return ResponseEntity.ok() diff --git a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerController.java b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerController.java index d5a09f44d2..2c1bd77140 100644 --- a/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerController.java +++ b/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerController.java @@ -35,6 +35,7 @@ import net.runelite.http.service.account.AuthFilter; import net.runelite.http.service.account.beans.SessionEntry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -65,7 +66,7 @@ public class LootTrackerController response.setStatus(HttpStatusCodes.STATUS_CODE_OK); } - @RequestMapping + @GetMapping public Collection getLootRecords(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "count", defaultValue = "1024") int count, @RequestParam(value = "start", defaultValue = "0") int start) throws IOException { SessionEntry e = auth.handle(request, response); diff --git a/http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeController.java b/http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeController.java index 847c415772..eaade27c12 100644 --- a/http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeController.java +++ b/http-service/src/main/java/net/runelite/http/service/osbuddy/OSBGrandExchangeController.java @@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.CacheControl; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -45,7 +46,7 @@ public class OSBGrandExchangeController this.grandExchangeService = grandExchangeService; } - @RequestMapping + @GetMapping public ResponseEntity get(@RequestParam("itemId") int itemId) throws ExecutionException { GrandExchangeEntry grandExchangeEntry = grandExchangeService.get(itemId); diff --git a/http-service/src/main/java/net/runelite/http/service/sprite/SpriteController.java b/http-service/src/main/java/net/runelite/http/service/sprite/SpriteController.java index 42b285761e..80d8f738ba 100644 --- a/http-service/src/main/java/net/runelite/http/service/sprite/SpriteController.java +++ b/http-service/src/main/java/net/runelite/http/service/sprite/SpriteController.java @@ -31,6 +31,7 @@ import java.io.IOException; import java.util.concurrent.TimeUnit; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -55,7 +56,7 @@ public class SpriteController } }); - @RequestMapping(produces = "image/png") + @GetMapping(produces = "image/png") public ResponseEntity getSprite( @RequestParam int spriteId, @RequestParam(defaultValue = "0") int frameId diff --git a/http-service/src/main/java/net/runelite/http/service/worlds/WorldController.java b/http-service/src/main/java/net/runelite/http/service/worlds/WorldController.java index 7dba1bc1dd..51769e181c 100644 --- a/http-service/src/main/java/net/runelite/http/service/worlds/WorldController.java +++ b/http-service/src/main/java/net/runelite/http/service/worlds/WorldController.java @@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.CacheControl; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -45,7 +46,7 @@ public class WorldController private WorldResult worldResult; - @RequestMapping + @GetMapping public ResponseEntity listWorlds() throws IOException { return ResponseEntity.ok() diff --git a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerController.java b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerController.java index 9710faef20..d247d735a4 100644 --- a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerController.java +++ b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerController.java @@ -28,6 +28,7 @@ import java.time.Instant; import net.runelite.http.api.xp.XpData; import net.runelite.http.service.xp.beans.XpEntity; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -39,13 +40,13 @@ public class XpTrackerController @Autowired private XpTrackerService xpTrackerService; - @RequestMapping("/update") + @GetMapping("/update") public void update(@RequestParam String username) { xpTrackerService.tryUpdate(username); } - @RequestMapping("/get") + @GetMapping("/get") public XpData get(@RequestParam String username, @RequestParam(required = false) Instant time) { if (time == null) diff --git a/http-service/src/main/java/net/runelite/http/service/xtea/XteaController.java b/http-service/src/main/java/net/runelite/http/service/xtea/XteaController.java index 5f06429a80..3868acb8c6 100644 --- a/http-service/src/main/java/net/runelite/http/service/xtea/XteaController.java +++ b/http-service/src/main/java/net/runelite/http/service/xtea/XteaController.java @@ -30,6 +30,7 @@ import net.runelite.http.api.xtea.XteaKey; import net.runelite.http.api.xtea.XteaRequest; import net.runelite.http.service.util.exception.NotFoundException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -49,7 +50,7 @@ public class XteaController xteaService.submit(xteaRequest); } - @RequestMapping + @GetMapping public List get() { return xteaService.get().stream() @@ -57,7 +58,7 @@ public class XteaController .collect(Collectors.toList()); } - @RequestMapping("/{region}") + @GetMapping("/{region}") public XteaKey getRegion(@PathVariable int region) { XteaEntry xteaRegion = xteaService.getRegion(region); From 3cedd84943bc311e812c720d1b23f1be4f562a5e Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 27 Feb 2019 00:07:54 +0100 Subject: [PATCH 146/304] Fix RAIDS_POINTS_INFOBOX widget ID Signed-off-by: Tomas Slusny --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index be7e595dd7..d8a4dba5cd 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -570,7 +570,7 @@ public class WidgetID static class Raids { - static final int POINTS_INFOBOX = 3; + static final int POINTS_INFOBOX = 6; } static class ExperienceDrop From 6a7f84200420f3444a1dc93b29ab072058320f08 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 27 Feb 2019 00:08:16 +0100 Subject: [PATCH 147/304] Make raids widget moveable Signed-off-by: Tomas Slusny --- .../main/java/net/runelite/client/ui/overlay/WidgetOverlay.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java index b5fd07609c..87a4de12ac 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java @@ -44,6 +44,7 @@ public class WidgetOverlay extends Overlay .put(WidgetInfo.RESIZABLE_MINIMAP_STONES_WIDGET, OverlayPosition.CANVAS_TOP_RIGHT) .put(WidgetInfo.FOSSIL_ISLAND_OXYGENBAR, OverlayPosition.TOP_LEFT) .put(WidgetInfo.EXPERIENCE_TRACKER_WIDGET, OverlayPosition.TOP_RIGHT) + .put(WidgetInfo.RAIDS_POINTS_INFOBOX, OverlayPosition.TOP_RIGHT) .put(WidgetInfo.TITHE_FARM, OverlayPosition.TOP_RIGHT) .put(WidgetInfo.PEST_CONTROL_BOAT_INFO, OverlayPosition.TOP_LEFT) .put(WidgetInfo.PEST_CONTROL_INFO, OverlayPosition.TOP_LEFT) From fbd3ea6202a07b4dc4d3aab4eeebf62afa793c7c Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 27 Feb 2019 00:09:24 +0100 Subject: [PATCH 148/304] Remove raids points overlay As we can just make raids overlay moveable there is no need to have our own. Signed-off-by: Tomas Slusny --- .../client/plugins/raids/RaidsPlugin.java | 30 ------ .../plugins/raids/RaidsPointsOverlay.java | 94 ------------------- 2 files changed, 124 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index d0c0d7c16c..46570b3b5a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -49,9 +49,6 @@ import net.runelite.api.Varbits; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.callback.ClientThread; import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatMessageBuilder; @@ -104,9 +101,6 @@ public class RaidsPlugin extends Plugin @Inject private RaidsOverlay overlay; - @Inject - private RaidsPointsOverlay pointsOverlay; - @Inject private LayoutSolver layoutSolver; @@ -152,7 +146,6 @@ public class RaidsPlugin extends Plugin protected void startUp() throws Exception { overlayManager.add(overlay); - overlayManager.add(pointsOverlay); updateLists(); clientThread.invokeLater(() -> checkRaidPresence(true)); } @@ -161,17 +154,10 @@ public class RaidsPlugin extends Plugin protected void shutDown() throws Exception { overlayManager.remove(overlay); - overlayManager.remove(pointsOverlay); infoBoxManager.removeInfoBox(timer); inRaidChambers = false; raid = null; timer = null; - - final Widget widget = client.getWidget(WidgetInfo.RAIDS_POINTS_INFOBOX); - if (widget != null) - { - widget.setHidden(false); - } } @Subscribe @@ -192,22 +178,6 @@ public class RaidsPlugin extends Plugin clientThread.invokeLater(() -> checkRaidPresence(true)); } - @Subscribe - public void onWidgetHiddenChanged(WidgetHiddenChanged event) - { - if (!inRaidChambers || event.isHidden()) - { - return; - } - - Widget widget = event.getWidget(); - - if (widget == client.getWidget(WidgetInfo.RAIDS_POINTS_INFOBOX)) - { - widget.setHidden(true); - } - } - @Subscribe public void onVarbitChanged(VarbitChanged event) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java deleted file mode 100644 index 5e66876bce..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.raids; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Varbits; -import static net.runelite.client.plugins.raids.RaidsPlugin.POINTS_FORMAT; -import net.runelite.client.ui.overlay.Overlay; -import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; -import net.runelite.client.ui.overlay.OverlayMenuEntry; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -public class RaidsPointsOverlay extends Overlay -{ - @Inject - private Client client; - - @Inject - private RaidsPlugin plugin; - - private final PanelComponent panel = new PanelComponent(); - - @Inject - private RaidsPointsOverlay(RaidsPlugin plugin) - { - super(plugin); - setPosition(OverlayPosition.TOP_RIGHT); - setPriority(OverlayPriority.HIGH); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInRaidChambers()) - { - return null; - } - - int totalPoints = client.getVar(Varbits.TOTAL_POINTS); - int personalPoints = client.getVar(Varbits.PERSONAL_POINTS); - int partySize = client.getVar(Varbits.RAID_PARTY_SIZE); - - panel.getChildren().clear(); - panel.getChildren().add(LineComponent.builder() - .left("Total:") - .right(POINTS_FORMAT.format(totalPoints)) - .build()); - - panel.getChildren().add(LineComponent.builder() - .left(client.getLocalPlayer().getName() + ":") - .right(POINTS_FORMAT.format(personalPoints)) - .build()); - - if (partySize > 1) - { - panel.getChildren().add(LineComponent.builder() - .left("Party size:") - .right(String.valueOf(partySize)) - .build()); - } - - return panel.render(graphics); - } -} From 8f8f27c8418d9b51433e5519ac4849406dcf4dde Mon Sep 17 00:00:00 2001 From: Gio Date: Wed, 27 Feb 2019 00:28:05 +0100 Subject: [PATCH 149/304] Add heal amount for castle wars bandages (#7878) Closes #7862 --- .../plugins/itemstats/ItemStatChanges.java | 6 +- .../itemstats/special/CastleWarsBandage.java | 85 +++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/CastleWarsBandage.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java index 6b66cf57e0..099b5a16a7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java @@ -36,6 +36,7 @@ import net.runelite.client.plugins.itemstats.food.Anglerfish; import net.runelite.client.plugins.itemstats.potions.PrayerPotion; import net.runelite.client.plugins.itemstats.potions.SaradominBrew; import net.runelite.client.plugins.itemstats.potions.SuperRestore; +import net.runelite.client.plugins.itemstats.special.CastleWarsBandage; import net.runelite.client.plugins.itemstats.special.SpicyStew; import static net.runelite.client.plugins.itemstats.stats.Stats.*; @@ -137,6 +138,9 @@ public class ItemStatChanges // Regular overload (NMZ) add(combo(5, boost(ATTACK, perc(.15, 5)), boost(STRENGTH, perc(.15, 5)), boost(DEFENCE, perc(.15, 5)), boost(RANGED, perc(.15, 5)), boost(MAGIC, perc(.15, 5)), heal(HITPOINTS, -50)), OVERLOAD_1, OVERLOAD_2, OVERLOAD_3, OVERLOAD_4); + // Bandages (Castle Wars) + add(new CastleWarsBandage(), BANDAGES); + // Recovery potions add(combo(5, heal(ATTACK, perc(.30, 10)), heal(STRENGTH, perc(.30, 10)), heal(DEFENCE, perc(.30, 10)), heal(RANGED, perc(.30, 10)), heal(MAGIC, perc(.30, 10))), RESTORE_POTION1, RESTORE_POTION2, RESTORE_POTION3, RESTORE_POTION4); add(heal(RUN_ENERGY, 10), ENERGY_POTION1, ENERGY_POTION2, ENERGY_POTION3, ENERGY_POTION4); @@ -174,7 +178,7 @@ public class ItemStatChanges // Misc/run energy add(heal(RUN_ENERGY, 10), WHITE_TREE_FRUIT); - add(heal(RUN_ENERGY, 30), STRANGE_FRUIT, BANDAGES); + add(heal(RUN_ENERGY, 30), STRANGE_FRUIT); add(heal(RUN_ENERGY, 50), MINT_CAKE); add(combo(food(12), heal(RUN_ENERGY, 50)), GOUT_TUBER); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/CastleWarsBandage.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/CastleWarsBandage.java new file mode 100644 index 0000000000..e66f9ed709 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/CastleWarsBandage.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2019, Giovds + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.itemstats.special; + +import com.google.common.collect.ImmutableSet; +import java.util.Comparator; +import java.util.stream.Stream; +import net.runelite.api.Client; +import net.runelite.api.EquipmentInventorySlot; +import net.runelite.api.InventoryID; +import net.runelite.api.Item; +import net.runelite.api.ItemContainer; +import net.runelite.api.ItemID; +import static net.runelite.client.plugins.itemstats.Builders.heal; +import static net.runelite.client.plugins.itemstats.Builders.perc; +import net.runelite.client.plugins.itemstats.Effect; +import net.runelite.client.plugins.itemstats.StatChange; +import net.runelite.client.plugins.itemstats.StatsChanges; +import static net.runelite.client.plugins.itemstats.stats.Stats.HITPOINTS; +import static net.runelite.client.plugins.itemstats.stats.Stats.RUN_ENERGY; + +public class CastleWarsBandage implements Effect +{ + private static final ImmutableSet BRACELETS = ImmutableSet.of( + ItemID.CASTLE_WARS_BRACELET1, ItemID.CASTLE_WARS_BRACELET2, ItemID.CASTLE_WARS_BRACELET3 + ); + + private static final double BASE_HP_PERC = .10; + private static final double BRACELET_HP_PERC = .50; + + @Override + public StatsChanges calculate(Client client) + { + final ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT); + final double percH = hasBracelet(equipmentContainer) ? BRACELET_HP_PERC : BASE_HP_PERC; + final StatChange hitPoints = heal(HITPOINTS, perc(percH, 0)).effect(client); + final StatChange runEnergy = heal(RUN_ENERGY, 30).effect(client); + final StatsChanges changes = new StatsChanges(2); + changes.setStatChanges(new StatChange[]{hitPoints, runEnergy}); + changes.setPositivity(Stream.of(changes.getStatChanges()) + .map(StatChange::getPositivity) + .max(Comparator.comparing(Enum::ordinal)).get()); + + return changes; + } + + private boolean hasBracelet(ItemContainer equipmentContainer) + { + if (equipmentContainer == null) + { + return false; + } + + final Item[] equipment = equipmentContainer.getItems(); + + if (equipment.length > EquipmentInventorySlot.GLOVES.getSlotIdx()) + { + return BRACELETS.contains(equipment[EquipmentInventorySlot.GLOVES.getSlotIdx()].getId()); + } + + return false; + } +} \ No newline at end of file From ceee6e36ea648e5128b3bf8489ca6afb89c044a0 Mon Sep 17 00:00:00 2001 From: Shaun Dreclin Date: Mon, 25 Feb 2019 18:29:14 -0500 Subject: [PATCH 150/304] wiki plugin: Add support for achievement diaries --- .../client/plugins/wiki/WikiPlugin.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index 21c58db79a..aaf6a084e9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -80,9 +80,10 @@ public class WikiPlugin extends Plugin private static final String MENUOP_GUIDE = "Guide"; private static final String MENUOP_QUICKGUIDE = "Quick Guide"; - private static final String MENUOP_WIKI_SKILL = "Wiki"; + private static final String MENUOP_WIKI = "Wiki"; private static final Pattern SKILL_REGEX = Pattern.compile("([A-Za-z]+) guide"); + private static final Pattern DIARY_REGEX = Pattern.compile("([A-Za-z &]+) Journal"); @Inject private SpriteManager spriteManager; @@ -285,8 +286,9 @@ public class WikiPlugin extends Plugin } LinkBrowser.browse(ub.build().toString()); break; - case MENUOP_WIKI_SKILL: + case MENUOP_WIKI: Matcher skillRegex = WikiPlugin.SKILL_REGEX.matcher(Text.removeTags(ev.getMenuTarget())); + Matcher diaryRegex = WikiPlugin.DIARY_REGEX.matcher(Text.removeTags(ev.getMenuTarget())); if (skillRegex.find()) { @@ -296,6 +298,14 @@ public class WikiPlugin extends Plugin .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE) .build().toString()); } + else if (diaryRegex.find()) + { + LinkBrowser.browse(WIKI_BASE.newBuilder() + .addPathSegment("w") + .addPathSegment(diaryRegex.group(1) + " Diary") + .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE) + .build().toString()); + } } } } @@ -334,13 +344,14 @@ public class WikiPlugin extends Plugin client.setMenuEntries(menuEntries); } - if ((WidgetInfo.TO_GROUP(widgetID) == WidgetID.SKILLS_GROUP_ID) && event.getOption().startsWith("View")) + if ((WidgetInfo.TO_GROUP(widgetID) == WidgetID.SKILLS_GROUP_ID && event.getOption().startsWith("View")) + || (WidgetInfo.TO_GROUP(widgetID) == WidgetID.DIARY_GROUP_ID && event.getOption().startsWith("Open"))) { menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); - menuEntry.setTarget(event.getOption().replace("View ", "")); - menuEntry.setOption(MENUOP_WIKI_SKILL); + menuEntry.setTarget(event.getOption().replace("View ", "").replace("Open ", "")); + menuEntry.setOption(MENUOP_WIKI); menuEntry.setParam0(widgetIndex); menuEntry.setParam1(widgetID); menuEntry.setIdentifier(event.getIdentifier()); From 14fe12e7d6b56e469232ec5e322ef418d6e27750 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 20 Feb 2019 18:14:25 +0100 Subject: [PATCH 151/304] Convert item stats mapping to use item ids instead of names Signed-off-by: Tomas Slusny --- .../java/net/runelite/http/api/item/ItemClient.java | 7 ++++--- .../java/net/runelite/client/game/ItemManager.java | 10 +++++----- .../client/plugins/itemstats/ItemStatOverlay.java | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java b/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java index 93b138dc7f..2aa8b5c678 100644 --- a/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java +++ b/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java @@ -204,11 +204,12 @@ public class ItemClient } } - public Map getStats() throws IOException + public Map getStats() throws IOException { HttpUrl.Builder urlBuilder = RuneLiteAPI.getStaticBase().newBuilder() .addPathSegment("item") - .addPathSegment("stats.min.json"); + // TODO: Change this to stats.min.json later after release is undeployed + .addPathSegment("stats.ids.min.json"); HttpUrl url = urlBuilder.build(); @@ -227,7 +228,7 @@ public class ItemClient } InputStream in = response.body().byteStream(); - final Type typeToken = new TypeToken>() + final Type typeToken = new TypeToken>() { }.getType(); return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), typeToken); diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java index c91de9262c..0f21a5b434 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java @@ -84,7 +84,7 @@ public class ItemManager private final ItemClient itemClient = new ItemClient(); private Map itemPrices = Collections.emptyMap(); - private Map itemStats = Collections.emptyMap(); + private Map itemStats = Collections.emptyMap(); private final LoadingCache itemImages; private final LoadingCache itemCompositions; private final LoadingCache itemOutlines; @@ -226,7 +226,7 @@ public class ItemManager { try { - final Map stats = itemClient.getStats(); + final Map stats = itemClient.getStats(); if (stats != null) { itemStats = ImmutableMap.copyOf(stats); @@ -307,16 +307,16 @@ public class ItemManager * @return item stats */ @Nullable - public ItemStats getItemStats(int itemId) + public ItemStats getItemStats(int itemId, boolean allowNote) { ItemComposition itemComposition = getItemComposition(itemId); - if (itemComposition == null || itemComposition.getName() == null) + if (itemComposition == null || itemComposition.getName() == null || (!allowNote && itemComposition.getNote() != -1)) { return null; } - return itemStats.get(itemComposition.getName()); + return itemStats.get(canonicalize(itemId)); } /** diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java index 73113bd0ac..206ab6fc13 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java @@ -139,7 +139,7 @@ public class ItemStatOverlay extends Overlay if (config.equipmentStats()) { - final ItemStats stats = itemManager.getItemStats(itemId); + final ItemStats stats = itemManager.getItemStats(itemId, false); if (stats != null) { @@ -205,7 +205,7 @@ public class ItemStatOverlay extends Overlay final Item item = items[slot]; if (item != null) { - other = itemManager.getItemStats(item.getId()); + other = itemManager.getItemStats(item.getId(), false); } } From 29f1115d83dc7b13e8624defefbb4ef67ab30d9d Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 27 Feb 2019 15:05:18 +0100 Subject: [PATCH 152/304] Null-check remote configuration in config manager This field can be null if the config service do not find absolutely anything in config table for the user. Signed-off-by: Tomas Slusny --- .../src/main/java/net/runelite/client/config/ConfigManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index b24c9ccb96..54318b887a 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -155,7 +155,7 @@ public class ConfigManager return; } - if (configuration.getConfig().isEmpty()) + if (configuration.getConfig() == null || configuration.getConfig().isEmpty()) { log.debug("No configuration from client, using saved configuration on disk"); loadFromFile(); From 11120422b6db301e8b00563efed4027fcdc34d2e Mon Sep 17 00:00:00 2001 From: Ron Young Date: Wed, 27 Feb 2019 10:32:33 -0600 Subject: [PATCH 153/304] TabInterface: remember search when clicking withdraw-x --- .../plugins/banktags/tabs/TabInterface.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index 2daaf0f5c6..e0b1af23eb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -130,6 +130,8 @@ public class TabInterface private int currentTabIndex; private TagTab iconToSet = null; private Instant startScroll = Instant.now(); + private String rememberedSearch; + private boolean waitSearchTick; @Getter private Widget upButton; @@ -384,6 +386,8 @@ public class TabInterface currentTabIndex = 0; maxTabs = 0; parent = null; + waitSearchTick = false; + rememberedSearch = ""; if (upButton != null) { @@ -400,6 +404,8 @@ public class TabInterface if (isHidden()) { parent = null; + waitSearchTick = false; + rememberedSearch = ""; // If bank window was just hidden, update last active tab position if (currentTabIndex != config.position()) @@ -464,6 +470,20 @@ public class TabInterface activateTab(null); } + if (!waitSearchTick + && activeTab == null + && !Strings.isNullOrEmpty(rememberedSearch) + && client.getVar(VarClientInt.INPUT_TYPE) == InputType.NONE.getType()) + { + bankSearch.reset(true); + bankSearch.search(InputType.NONE, rememberedSearch, true); + rememberedSearch = ""; + } + else if (waitSearchTick) + { + waitSearchTick = false; + } + updateBounds(); scrollTab(0); } @@ -544,6 +564,15 @@ public class TabInterface return; } + if (event.getWidgetId() == WidgetInfo.BANK_ITEM_CONTAINER.getId() + && event.getMenuAction() == MenuAction.EXAMINE_ITEM_BANK_EQ + && event.getMenuOption().equalsIgnoreCase("withdraw-x")) + { + waitSearchTick = true; + rememberedSearch = client.getVar(VarClientStr.INPUT_TEXT); + bankSearch.search(InputType.NONE, rememberedSearch, true); + } + if (iconToSet != null) { if (event.getMenuOption().startsWith(CHANGE_ICON + " (")) From 4a63f50abcbcd05b58670bf35bc162a389c7b092 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 27 Feb 2019 20:06:29 +0100 Subject: [PATCH 154/304] Change logged-in redir to redirect to HTTPS Signed-off-by: Tomas Slusny --- .../java/net/runelite/http/service/account/AccountService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java index c78a25b9ff..605ef052ed 100644 --- a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java +++ b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java @@ -87,7 +87,7 @@ public class AccountService private static final String SCOPE = "https://www.googleapis.com/auth/userinfo.email"; private static final String USERINFO = "https://www.googleapis.com/oauth2/v2/userinfo"; private static final String RL_OAUTH_URL = "https://api.runelite.net/oauth/"; - private static final String RL_REDIR = "http://runelite.net/logged-in"; + private static final String RL_REDIR = "https://runelite.net/logged-in"; private final Gson gson = RuneLiteAPI.GSON; private final Gson websocketGson = WebsocketGsonFactory.build(); From 3589c60243d9dc557f5c93f034f93946250f3c2d Mon Sep 17 00:00:00 2001 From: Magic fTail Date: Wed, 27 Feb 2019 23:15:19 +0100 Subject: [PATCH 155/304] Fix splashes not resetting idle countdown in idle notifier (#8025) A splash doesn't make a hitsplat, but will still keep you logged in. Useful for when splashing on yourself --- .../main/java/net/runelite/api/GraphicID.java | 1 + .../idlenotifier/IdleNotifierPlugin.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/GraphicID.java b/runelite-api/src/main/java/net/runelite/api/GraphicID.java index 913cb9d881..b1d2c3d00f 100644 --- a/runelite-api/src/main/java/net/runelite/api/GraphicID.java +++ b/runelite-api/src/main/java/net/runelite/api/GraphicID.java @@ -26,6 +26,7 @@ package net.runelite.api; public class GraphicID { + public static final int SPLASH = 85; public static final int TELEPORT = 111; public static final int GREY_BUBBLE_TELEPORT = 86; public static final int ENTANGLE = 179; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java index 8a23af905f..4cc3de95c9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java @@ -47,6 +47,7 @@ import net.runelite.api.Varbits; import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; +import net.runelite.api.events.GraphicChanged; import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.InteractingChanged; import net.runelite.client.Notifier; @@ -330,6 +331,22 @@ public class IdleNotifierPlugin extends Plugin } } + @Subscribe + public void onGraphicChanged(GraphicChanged event) + { + Actor actor = event.getActor(); + + if (actor != client.getLocalPlayer()) + { + return; + } + + if (actor.getGraphic() == GraphicID.SPLASH) + { + lastCombatCountdown = HIGHEST_MONSTER_ATTACK_SPEED; + } + } + @Subscribe public void onGameTick(GameTick event) { From f0abdbdda2aa71dc7958ea0b3166eaa04128cf5b Mon Sep 17 00:00:00 2001 From: Shaun Dreclin Date: Wed, 27 Feb 2019 17:19:06 -0500 Subject: [PATCH 156/304] idle notifier: Add support for grinding with pestle and mortar --- runelite-api/src/main/java/net/runelite/api/AnimationID.java | 1 + .../runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java | 1 + 2 files changed, 2 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java index 1f96e9c898..45b67c9a33 100644 --- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java +++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java @@ -33,6 +33,7 @@ package net.runelite.api; public final class AnimationID { public static final int IDLE = -1; + public static final int HERBLORE_PESTLE_AND_MORTAR = 364; public static final int WOODCUTTING_BRONZE = 879; public static final int WOODCUTTING_IRON = 877; public static final int WOODCUTTING_STEEL = 875; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java index 4cc3de95c9..c49eb37f8f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java @@ -197,6 +197,7 @@ public class IdleNotifierPlugin extends Plugin case MINING_MOTHERLODE_INFERNAL: case MINING_MOTHERLODE_3A: /* Herblore */ + case HERBLORE_PESTLE_AND_MORTAR: case HERBLORE_POTIONMAKING: case HERBLORE_MAKE_TAR: /* Magic */ From 0bf814c3ab23a180ab55d0d42172a3a43099d9d1 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 28 Feb 2019 11:33:30 +0000 Subject: [PATCH 157/304] Update Item IDs to 2019-02-28-rev177 --- .../src/main/java/net/runelite/api/ItemID.java | 12 ++++++++++++ .../src/main/java/net/runelite/api/NullItemID.java | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index d8ce5fc04a..7da66715b0 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -10637,5 +10637,17 @@ public final class ItemID public static final int ALCHEMICAL_HYDRA_HEAD = 23081; public static final int ANTIQUE_LAMP_23082 = 23082; public static final int BRIMSTONE_KEY = 23083; + public static final int ORNATE_GLOVES = 23091; + public static final int ORNATE_BOOTS = 23093; + public static final int ORNATE_LEGS = 23095; + public static final int ORNATE_TOP = 23097; + public static final int ORNATE_CAPE = 23099; + public static final int ORNATE_HELM = 23101; + public static final int COOKS_SHOPPING_LIST = 23103; + public static final int COOKS_LETTER = 23104; + public static final int BREWERS_FOLLY = 23105; + public static final int VYVINS_WINE = 23106; + public static final int BEER_GLASS_OF_WATER = 23107; + public static final int BIRTHDAY_CAKE = 23108; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index 8c4072cbe3..467ce59eab 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -12267,5 +12267,12 @@ public final class NullItemID public static final int NULL_23088 = 23088; public static final int NULL_23089 = 23089; public static final int NULL_23090 = 23090; + public static final int NULL_23092 = 23092; + public static final int NULL_23094 = 23094; + public static final int NULL_23096 = 23096; + public static final int NULL_23098 = 23098; + public static final int NULL_23100 = 23100; + public static final int NULL_23102 = 23102; + public static final int NULL_23109 = 23109; /* This file is automatically generated. Do not edit. */ } From 42c78f9a5e19b5f7346d0c3e02b8f3541b9a32b8 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 28 Feb 2019 11:33:32 +0000 Subject: [PATCH 158/304] Update Object IDs to 2019-02-28-rev177 --- .../java/net/runelite/api/NullObjectID.java | 20 ++++++++ .../main/java/net/runelite/api/ObjectID.java | 47 +++++++++++++++---- 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java index 5371b0fdc2..4216a1571a 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -4639,6 +4639,7 @@ public final class NullObjectID public static final int NULL_11016 = 11016; public static final int NULL_11026 = 11026; public static final int NULL_11027 = 11027; + public static final int NULL_11040 = 11040; public static final int NULL_11045 = 11045; public static final int NULL_11046 = 11046; public static final int NULL_11047 = 11047; @@ -16101,5 +16102,24 @@ public final class NullObjectID public static final int NULL_34651 = 34651; public static final int NULL_34652 = 34652; public static final int NULL_34662 = 34662; + public static final int NULL_34678 = 34678; + public static final int NULL_34679 = 34679; + public static final int NULL_34680 = 34680; + public static final int NULL_34690 = 34690; + public static final int NULL_34691 = 34691; + public static final int NULL_34692 = 34692; + public static final int NULL_34693 = 34693; + public static final int NULL_34694 = 34694; + public static final int NULL_34695 = 34695; + public static final int NULL_34699 = 34699; + public static final int NULL_34700 = 34700; + public static final int NULL_34701 = 34701; + public static final int NULL_34703 = 34703; + public static final int NULL_34704 = 34704; + public static final int NULL_34707 = 34707; + public static final int NULL_34708 = 34708; + public static final int NULL_34709 = 34709; + public static final int NULL_34710 = 34710; + public static final int NULL_34711 = 34711; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index 6679539d8f..e47f1533d9 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -6405,7 +6405,6 @@ public final class ObjectID public static final int WALL_11037 = 11037; public static final int WALL_11038 = 11038; public static final int WALL_11039 = 11039; - public static final int RUBBLE_11040 = 11040; public static final int LADDER_11041 = 11041; public static final int LADDER_11042 = 11042; public static final int STONE_LADDER = 11043; @@ -17884,12 +17883,12 @@ public final class ObjectID public static final int POTATO_CACTUS_33746 = 33746; public static final int POTATO_CACTUS_33747 = 33747; public static final int POTATO_CACTUS_33748 = 33748; - public static final int DISEASED_POATO_CACTUS = 33749; - public static final int DISEASED_POATO_CACTUS_33750 = 33750; - public static final int DISEASED_POATO_CACTUS_33751 = 33751; - public static final int DISEASED_POATO_CACTUS_33752 = 33752; - public static final int DISEASED_POATO_CACTUS_33753 = 33753; - public static final int DISEASED_POATO_CACTUS_33754 = 33754; + public static final int DISEASED_POTATO_CACTUS = 33749; + public static final int DISEASED_POTATO_CACTUS_33750 = 33750; + public static final int DISEASED_POTATO_CACTUS_33751 = 33751; + public static final int DISEASED_POTATO_CACTUS_33752 = 33752; + public static final int DISEASED_POTATO_CACTUS_33753 = 33753; + public static final int DISEASED_POTATO_CACTUS_33754 = 33754; public static final int DEAD_POTATO_CACTUS = 33755; public static final int DEAD_POTATO_CACTUS_33756 = 33756; public static final int DEAD_POTATO_CACTUS_33757 = 33757; @@ -18545,10 +18544,40 @@ public final class ObjectID public static final int ALCHEMICAL_TOPIARY = 34654; public static final int MYSTERIOUS_PIPE = 34655; public static final int CHEMICAL_WASTE_PIPE = 34656; - public static final int GANGPLANK_34657 = 34657; - public static final int GANGPLANK_34658 = 34658; + public static final int LIGHT_34657 = 34657; + public static final int LIGHT_34658 = 34658; public static final int THE_SHEARED_RAM = 34659; public static final int BRIMSTONE_CHEST = 34660; public static final int BRIMSTONE_CHEST_34661 = 34661; + public static final int RUBBLE_34663 = 34663; + public static final int RUBBLE_34664 = 34664; + public static final int RUBBLE_34665 = 34665; + public static final int RUBBLE_34666 = 34666; + public static final int GANGPLANK_34667 = 34667; + public static final int GANGPLANK_34668 = 34668; + public static final int GANGPLANK_34669 = 34669; + public static final int GANGPLANK_34670 = 34670; + public static final int GANGPLANK_34671 = 34671; + public static final int GANGPLANK_34672 = 34672; + public static final int LIGHT_34673 = 34673; + public static final int LIGHT_34674 = 34674; + public static final int LIGHT_34675 = 34675; + public static final int LIGHT_34676 = 34676; + public static final int VERZIK_VITUR_DISPLAY = 34677; + public static final int MAKING_FRIENDS_WITH_MY_ARM_DISPLAY = 34681; + public static final int FIRE_34682 = 34682; + public static final int MAGIC_MIRROR = 34683; + public static final int ALCHEMICAL_HYDRA_DISPLAY_34684 = 34684; + public static final int ATTAS_PLANT_DISPLAY = 34685; + public static final int LEATHER_SHIELDS = 34686; + public static final int BRYOPHYTA_DISPLAY = 34687; + public static final int BANNER_34688 = 34688; + public static final int BANNER_34689 = 34689; + public static final int BANQUET_TABLE_34696 = 34696; + public static final int PRESENT_TABLE_34697 = 34697; + public static final int BIRTHDAY_HAT_TABLE_34698 = 34698; + public static final int PARTY_BALLOONS_34702 = 34702; + public static final int BLOOMING_HESPORI_SPROUT = 34705; + public static final int SHRIVELLED_PLANT = 34706; /* This file is automatically generated. Do not edit. */ } From 05597fc5c5258ce4ba1feb047c5b08c306fda1c2 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 28 Feb 2019 11:33:32 +0000 Subject: [PATCH 159/304] Update NPC IDs to 2019-02-28-rev177 --- .../src/main/java/net/runelite/api/NpcID.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index 4222a45a62..64b032dc50 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -1033,8 +1033,6 @@ public final class NpcID public static final int ANGRY_BEAR = 1060; public static final int ANGRY_UNICORN = 1061; public static final int ANGRY_GIANT_RAT = 1062; - public static final int ANGRY_GIANT_RAT_1063 = 1063; - public static final int ANGRY_GIANT_RAT_1064 = 1064; public static final int ANGRY_GOBLIN = 1065; public static final int FEAR_REAPER = 1066; public static final int CONFUSION_BEAST = 1067; @@ -2685,7 +2683,7 @@ public final class NpcID public static final int BAT = 2827; public static final int DRYAD = 2828; public static final int FAIRY_2829 = 2829; - public static final int LEPRECHAUN = 2830; + public static final int MYSTERIOUS_OLD_MAN = 2830; public static final int LIZARD_MAN = 2831; public static final int ORC = 2832; public static final int TROLL_2833 = 2833; @@ -6186,7 +6184,7 @@ public final class NpcID public static final int EVIL_CHICKEN_6739 = 6739; public static final int SHADE_6740 = 6740; public static final int ZOMBIE_6741 = 6741; - public static final int MYSTERIOUS_OLD_MAN = 6742; + public static final int MYSTERIOUS_OLD_MAN_6742 = 6742; public static final int SERGEANT_DAMIEN_6743 = 6743; public static final int FLIPPA_6744 = 6744; public static final int LEO = 6745; @@ -6209,6 +6207,7 @@ public final class NpcID public static final int SPAWN_6768 = 6768; public static final int OSTEN = 6769; public static final int ARCIS = 6770; + public static final int COOK_6771 = 6771; public static final int LOVADA = 6772; public static final int DOOMSAYER = 6773; public static final int DOOMSAYER_6774 = 6774; @@ -6218,6 +6217,7 @@ public final class NpcID public static final int MAZE_GUARDIAN_6779 = 6779; public static final int PILIAR = 6780; public static final int SHAYDA = 6781; + public static final int HANS_6784 = 6784; public static final int HOSA = 6785; public static final int HELLRAT_BEHEMOTH = 6793; public static final int MONKEY_ARCHER_6794 = 6794; @@ -7265,6 +7265,7 @@ public final class NpcID public static final int GNOCCI_THE_COOK_7972 = 7972; public static final int DOLL = 7975; public static final int ARSEN_THE_THIEF = 7976; + public static final int HANS_7979 = 7979; public static final int YUSUF = 7981; public static final int YUSUF_7982 = 7982; public static final int FRANCOIS = 7983; @@ -7837,6 +7838,14 @@ public final class NpcID public static final int TAYLOR = 8629; public static final int VEOS_8630 = 8630; public static final int SEAMAN_MORRIS = 8631; + public static final int DUKE_HORACIO_8633 = 8633; public static final int ALCHEMICAL_HYDRA_8634 = 8634; + public static final int LUMBRIDGE_GUIDE_8635 = 8635; + public static final int KING_ROALD_8636 = 8636; + public static final int ELLAMARIA_8637 = 8637; + public static final int WISE_OLD_MAN_8638 = 8638; + public static final int GNOME_CHILD_8640 = 8640; + public static final int RANTZ_8641 = 8641; + public static final int DODGY_GEEZER = 8644; /* This file is automatically generated. Do not edit. */ } From 6b8419ca729f91235318aa7595e862fcdbdbb29b Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 28 Feb 2019 11:33:37 +0000 Subject: [PATCH 160/304] Update Scripts to 2019-02-28-rev177 --- .../scripts/ChatboxInputWidgetBuilder.hash | 2 +- .../scripts/ChatboxInputWidgetBuilder.rs2asm | 2 +- .../src/main/scripts/CommandScript.hash | 2 +- .../src/main/scripts/CommandScript.rs2asm | 275 +++++++++--------- .../src/main/scripts/PrivateMessage.hash | 2 +- .../src/main/scripts/PrivateMessage.rs2asm | 169 +++++------ 6 files changed, 220 insertions(+), 232 deletions(-) diff --git a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.hash b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.hash index 31eec732bf..5551428674 100644 --- a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.hash +++ b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.hash @@ -1 +1 @@ -30FB61D1C8600C402F57F493B09BDA050FD8381E9BAA5D13BB1BC95372FBA5D5 \ No newline at end of file +19C3968C5E9D273E590A159140E658839878F48D00283DDFDADE81D86092C03E \ No newline at end of file diff --git a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm index 21ca38aa88..d20bcecbe7 100644 --- a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm @@ -42,7 +42,7 @@ LABEL23: sstore 2 load_int 0 istore 3 - get_varc 203 + get_varbit 8119 load_int 1 if_icmpeq LABEL40 jump LABEL99 diff --git a/runelite-client/src/main/scripts/CommandScript.hash b/runelite-client/src/main/scripts/CommandScript.hash index 6a13a6985e..f305fd2eb9 100644 --- a/runelite-client/src/main/scripts/CommandScript.hash +++ b/runelite-client/src/main/scripts/CommandScript.hash @@ -1 +1 @@ -C42CD26AA6484029ACED50325EF8157741A9641BA28218315551B3762CE903A6 \ No newline at end of file +59179DCB8961986539D1E5197DB9AAA6E99EA4FFC565BFAC768B55DE79DA0BCF \ No newline at end of file diff --git a/runelite-client/src/main/scripts/CommandScript.rs2asm b/runelite-client/src/main/scripts/CommandScript.rs2asm index df1e10e0d4..8d3de30e5f 100644 --- a/runelite-client/src/main/scripts/CommandScript.rs2asm +++ b/runelite-client/src/main/scripts/CommandScript.rs2asm @@ -15,21 +15,18 @@ LABEL9: return LABEL10: - get_varc 203 + get_varbit 8119 load_int 0 - if_icmpeq LABEL22 - get_varc 203 - load_int -1 - if_icmpeq LABEL22 + if_icmpeq LABEL19 load_int -1 load_int 162 invoke 1701 load_int 0 - if_icmpeq LABEL22 - jump LABEL23 -LABEL22: + if_icmpeq LABEL19 + jump LABEL20 +LABEL19: return -LABEL23: +LABEL20: get_varc_string 1 string_length istore 2 @@ -39,167 +36,167 @@ LABEL23: istore 4 invoke 1972 load_int 1 - if_icmpeq LABEL34 - jump LABEL40 -LABEL34: + if_icmpeq LABEL31 + jump LABEL37 +LABEL31: get_varc 41 load_int 4 - if_icmpeq LABEL38 - jump LABEL40 -LABEL38: + if_icmpeq LABEL35 + jump LABEL37 +LABEL35: load_int 1 istore 4 -LABEL40: +LABEL37: get_rights load_int 0 - if_icmpgt LABEL44 - jump LABEL46 -LABEL44: + if_icmpgt LABEL41 + jump LABEL43 +LABEL41: load_int 1 istore 3 -LABEL46: +LABEL43: iload 3 load_int 1 - if_icmpeq LABEL50 - jump LABEL61 -LABEL50: + if_icmpeq LABEL47 + jump LABEL58 +LABEL47: load_string "`" iload 1 string_indexof load_int -1 - if_icmpne LABEL56 - jump LABEL61 -LABEL56: + if_icmpne LABEL53 + jump LABEL58 +LABEL53: iload 2 load_int 0 - if_icmpeq LABEL60 - jump LABEL61 -LABEL60: + if_icmpeq LABEL57 + jump LABEL58 +LABEL57: return -LABEL61: +LABEL58: iload 0 load_int 84 - if_icmpeq LABEL65 - jump LABEL182 -LABEL65: + if_icmpeq LABEL62 + jump LABEL179 +LABEL62: invoke 1984 iload 2 load_int 0 - if_icmpgt LABEL70 - jump LABEL181 -LABEL70: + if_icmpgt LABEL67 + jump LABEL178 +LABEL67: get_varc_string 1 load_string "/" load_int 0 string_indexof_from load_int 0 - if_icmpeq LABEL80 + if_icmpeq LABEL77 iload 4 load_int 1 - if_icmpeq LABEL80 - jump LABEL115 -LABEL80: + if_icmpeq LABEL77 + jump LABEL112 +LABEL77: get_clanchatcount load_int 0 - if_icmpgt LABEL84 - jump LABEL111 -LABEL84: + if_icmpgt LABEL81 + jump LABEL108 +LABEL81: iload 2 load_int 1 - if_icmple LABEL88 - jump LABEL93 -LABEL88: + if_icmple LABEL85 + jump LABEL90 +LABEL85: iload 4 load_int 0 - if_icmpeq LABEL92 - jump LABEL93 -LABEL92: + if_icmpeq LABEL89 + jump LABEL90 +LABEL89: return -LABEL93: +LABEL90: get_varbit 4394 load_int 1 - if_icmpeq LABEL97 - jump LABEL99 -LABEL97: + if_icmpeq LABEL94 + jump LABEL96 +LABEL94: part_clanchat - jump LABEL110 -LABEL99: + jump LABEL107 +LABEL96: iload 4 load_int 1 - if_icmpeq LABEL103 - jump LABEL107 -LABEL103: + if_icmpeq LABEL100 + jump LABEL104 +LABEL100: load_string "/" get_varc_string 1 concat_string put_varc_string 1 -LABEL107: +LABEL104: get_varc_string 1 load_int 2 invoke 96 -LABEL110: - jump LABEL114 -LABEL111: +LABEL107: + jump LABEL111 +LABEL108: get_varc_string 1 load_int 0 invoke 96 -LABEL114: - jump LABEL177 -LABEL115: +LABEL111: + jump LABEL174 +LABEL112: get_varc_string 1 load_string "::" load_int 0 string_indexof_from load_int 0 - if_icmpeq LABEL122 - jump LABEL174 -LABEL122: + if_icmpeq LABEL119 + jump LABEL171 +LABEL119: iload 2 load_int 2 - if_icmpgt LABEL126 - jump LABEL170 -LABEL126: + if_icmpgt LABEL123 + jump LABEL167 +LABEL123: get_varc_string 1 load_string "::toggleroof" load_int 0 string_indexof_from load_int 0 - if_icmpeq LABEL133 - jump LABEL147 -LABEL133: + if_icmpeq LABEL130 + jump LABEL144 +LABEL130: get_hideroofs load_int 1 - if_icmpeq LABEL137 - jump LABEL142 -LABEL137: + if_icmpeq LABEL134 + jump LABEL139 +LABEL134: load_int 0 set_hideroofs load_string "Roofs will only be removed selectively." send_game_message - jump LABEL146 -LABEL142: + jump LABEL143 +LABEL139: load_int 1 set_hideroofs load_string "Roofs are now all hidden." send_game_message -LABEL146: - jump LABEL169 -LABEL147: +LABEL143: + jump LABEL166 +LABEL144: get_varc_string 1 load_string "::bank" load_int 0 string_indexof_from load_int 0 - if_icmpeq LABEL154 + if_icmpeq LABEL151 load_string "runeliteCommand" ; load callback name runelite_callback ; invoke callback - jump LABEL158 -LABEL154: + jump LABEL155 +LABEL151: load_string "Hey, everyone, I just tried to do something very silly!" load_int 0 invoke 96 - jump LABEL169 -LABEL158: + jump LABEL166 +LABEL155: get_varc_string 1 invoke 224 put_varc_string 1 @@ -211,82 +208,82 @@ LABEL158: iload 2 string_substring run_command -LABEL169: - jump LABEL173 +LABEL166: + jump LABEL170 +LABEL167: + get_varc_string 1 + load_int 0 + invoke 96 LABEL170: + jump LABEL174 +LABEL171: get_varc_string 1 load_int 0 invoke 96 -LABEL173: - jump LABEL177 LABEL174: - get_varc_string 1 - load_int 0 - invoke 96 -LABEL177: get_varc_string 1 invoke 77 load_string "" put_varc_string 1 -LABEL181: - jump LABEL250 -LABEL182: +LABEL178: + jump LABEL247 +LABEL179: iload 0 load_int 104 - if_icmpeq LABEL186 - jump LABEL192 -LABEL186: + if_icmpeq LABEL183 + jump LABEL189 +LABEL183: iload 3 load_int 1 - if_icmpeq LABEL190 - jump LABEL191 -LABEL190: + if_icmpeq LABEL187 + jump LABEL188 +LABEL187: invoke 75 -LABEL191: - jump LABEL250 -LABEL192: +LABEL188: + jump LABEL247 +LABEL189: iload 0 load_int 105 - if_icmpeq LABEL196 - jump LABEL202 -LABEL196: + if_icmpeq LABEL193 + jump LABEL199 +LABEL193: iload 3 load_int 1 - if_icmpeq LABEL200 - jump LABEL201 -LABEL200: + if_icmpeq LABEL197 + jump LABEL198 +LABEL197: invoke 76 -LABEL201: - jump LABEL250 -LABEL202: +LABEL198: + jump LABEL247 +LABEL199: iload 0 load_int 80 - if_icmpeq LABEL206 - jump LABEL244 -LABEL206: + if_icmpeq LABEL203 + jump LABEL241 +LABEL203: get_varc_string string_length load_int 0 - if_icmpgt LABEL211 - jump LABEL231 -LABEL211: + if_icmpgt LABEL208 + jump LABEL228 +LABEL208: get_varc_string is_friend load_int 1 - if_icmpeq LABEL216 - jump LABEL219 -LABEL216: + if_icmpeq LABEL213 + jump LABEL216 +LABEL213: get_varc_string invoke 107 return -LABEL219: +LABEL216: get_varc 60 get_gamecycle - if_icmpgt LABEL223 - jump LABEL224 -LABEL223: + if_icmpgt LABEL220 + jump LABEL221 +LABEL220: return -LABEL224: +LABEL221: get_gamecycle load_int 50 iadd @@ -294,14 +291,14 @@ LABEL224: load_string "That player was not found on your Friends list." send_game_message return -LABEL231: +LABEL228: get_varc 60 get_gamecycle - if_icmpgt LABEL235 - jump LABEL236 -LABEL235: + if_icmpgt LABEL232 + jump LABEL233 +LABEL232: return -LABEL236: +LABEL233: get_gamecycle load_int 50 iadd @@ -309,8 +306,8 @@ LABEL236: load_string "You haven't received any messages to which you can reply." send_game_message return - jump LABEL250 -LABEL244: + jump LABEL247 +LABEL241: get_varc_string 1 load_int 0 iload 0 @@ -320,8 +317,8 @@ LABEL244: load_int 0 ; load_string "blockChatInput" ; runelite_callback ; - if_icmpeq LABEL250 ; don't add to input varcstr + if_icmpeq LABEL247 ; don't add to input varcstr put_varc_string 1 -LABEL250: +LABEL247: invoke 223 return diff --git a/runelite-client/src/main/scripts/PrivateMessage.hash b/runelite-client/src/main/scripts/PrivateMessage.hash index 5f3c129619..ced7907d51 100644 --- a/runelite-client/src/main/scripts/PrivateMessage.hash +++ b/runelite-client/src/main/scripts/PrivateMessage.hash @@ -1 +1 @@ -3DC9C314EBA5630A8237016DDAC99272696B37650E8671DD42DAEE9363F2D006 \ No newline at end of file +E9554C6591670564DEB0697E84125A1AAC2DECEFA00852CC564BC13B30E64AC8 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/PrivateMessage.rs2asm b/runelite-client/src/main/scripts/PrivateMessage.rs2asm index bc8bb34d0f..ed817dea14 100644 --- a/runelite-client/src/main/scripts/PrivateMessage.rs2asm +++ b/runelite-client/src/main/scripts/PrivateMessage.rs2asm @@ -22,7 +22,7 @@ LABEL7: iload 1 load_int 0 if_icmpgt LABEL18 - jump LABEL193 + jump LABEL184 LABEL18: get_varc 5 switch @@ -32,19 +32,19 @@ LABEL18: 4: LABEL23 5: LABEL23 6: LABEL44 - 7: LABEL110 - 8: LABEL114 - 9: LABEL120 - 10: LABEL123 - 11: LABEL185 - 12: LABEL142 - 13: LABEL160 - 15: LABEL120 - 16: LABEL190 - jump LABEL192 + 7: LABEL107 + 8: LABEL111 + 9: LABEL117 + 10: LABEL120 + 11: LABEL176 + 12: LABEL136 + 13: LABEL154 + 15: LABEL117 + 16: LABEL181 + jump LABEL183 LABEL21: return - jump LABEL192 + jump LABEL183 LABEL23: get_ignorecount load_int 0 @@ -72,7 +72,7 @@ LABEL41: get_varc_string 22 remove_ignore LABEL43: - jump LABEL192 + jump LABEL183 LABEL44: get_friendcount load_int 0 @@ -81,7 +81,7 @@ LABEL44: LABEL48: load_string "Unable to complete action - system busy." send_game_message - jump LABEL109 + jump LABEL106 LABEL51: get_varc 5 load_int 2 @@ -90,7 +90,7 @@ LABEL51: LABEL55: get_varc_string 22 add_friend - jump LABEL109 + jump LABEL106 LABEL58: get_varc 5 load_int 3 @@ -99,33 +99,30 @@ LABEL58: LABEL62: get_varc_string 22 remove_friend - jump LABEL109 + jump LABEL106 LABEL65: get_varc 5 load_int 6 if_icmpeq LABEL69 - jump LABEL109 + jump LABEL106 LABEL69: - get_varc 203 + get_varbit 8119 load_int 0 - if_icmpeq LABEL76 - get_varc 203 - load_int -1 - if_icmpeq LABEL76 - jump LABEL82 -LABEL76: + if_icmpeq LABEL73 + jump LABEL79 +LABEL73: load_int 1 load_int 1 invoke 299 load_string "You must set a name before you can chat." send_game_message return -LABEL82: +LABEL79: 5005 load_int 2 - if_icmpeq LABEL86 - jump LABEL97 -LABEL86: + if_icmpeq LABEL83 + jump LABEL94 +LABEL83: 5000 load_int 1 5016 @@ -137,105 +134,99 @@ LABEL86: invoke 84 iload 0 invoke 89 -LABEL97: +LABEL94: get_varbit 4394 load_int 1 - if_icmpeq LABEL101 - jump LABEL104 -LABEL101: + if_icmpeq LABEL98 + jump LABEL101 +LABEL98: get_varc_string 23 remove_friend - jump LABEL107 -LABEL104: + jump LABEL104 +LABEL101: get_varc_string 23 get_varc_string 22 load_string "privateMessage" ; load event name load_int 0 ; whether or not to skip - runelite_callback ; invoke callback + runelite_callback ; invoke callback load_int 1 - if_icmpeq LABEL107 ; if skipped, do not message + if_icmpeq LABEL104 ; if skipped, do not message privmsg -LABEL107: +LABEL104: get_gamecycle put_varc 61 -LABEL109: - jump LABEL192 -LABEL110: +LABEL106: + jump LABEL183 +LABEL107: get_varc_string 22 invoke 212 numeric_input - jump LABEL192 -LABEL114: + jump LABEL183 +LABEL111: get_varc_string 22 string_remove_html put_varc_string 128 get_varc_string 22 string_input_1 - jump LABEL192 -LABEL120: + jump LABEL183 +LABEL117: get_varc_string 22 string_input_2 - jump LABEL192 -LABEL123: - get_varc 203 + jump LABEL183 +LABEL120: + get_varbit 8119 load_int 0 - if_icmpeq LABEL130 - get_varc 203 - load_int -1 - if_icmpeq LABEL130 - jump LABEL136 -LABEL130: + if_icmpeq LABEL124 + jump LABEL130 +LABEL124: load_int 1 load_int 1 invoke 299 load_string "You must set a name before you can chat." send_game_message return -LABEL136: +LABEL130: get_varc_string 22 string_remove_html put_varc_string 129 get_varc_string 22 join_clanchat - jump LABEL192 -LABEL142: + jump LABEL183 +LABEL136: iload 1 load_int 10 - if_icmpgt LABEL146 - jump LABEL152 -LABEL146: + if_icmpgt LABEL140 + jump LABEL146 +LABEL140: get_varc_string 22 load_int 0 load_int 9 string_substring sstore 0 - jump LABEL154 -LABEL152: + jump LABEL148 +LABEL146: get_varc_string 22 sstore 0 -LABEL154: +LABEL148: sload 0 tolowercase 5021 invoke 553 invoke 84 - jump LABEL192 -LABEL160: - get_varc 203 + jump LABEL183 +LABEL154: + get_varbit 8119 load_int 0 - if_icmpeq LABEL167 - get_varc 203 - load_int -1 - if_icmpeq LABEL167 - jump LABEL173 -LABEL167: + if_icmpeq LABEL158 + jump LABEL164 +LABEL158: load_int 1 load_int 1 invoke 299 load_string "You must set a name before you can chat." send_game_message return -LABEL173: +LABEL164: get_varc_string 22 load_int 0 put_varc 62 @@ -247,33 +238,33 @@ LABEL173: load_string "I1" load_int 10616845 widget_put_render_listener_widget - jump LABEL192 -LABEL185: + jump LABEL183 +LABEL176: load_int 0 load_int 1 invoke 299 return - jump LABEL192 -LABEL190: + jump LABEL183 +LABEL181: get_varc_string 22 invoke 2061 -LABEL192: - jump LABEL199 -LABEL193: +LABEL183: + jump LABEL190 +LABEL184: get_varc 5 switch - 16: LABEL198 - 7: LABEL196 - 8: LABEL196 - 9: LABEL196 - 15: LABEL196 - jump LABEL199 -LABEL196: + 16: LABEL189 + 7: LABEL187 + 8: LABEL187 + 9: LABEL187 + 15: LABEL187 + jump LABEL190 +LABEL187: return - jump LABEL199 -LABEL198: + jump LABEL190 +LABEL189: return -LABEL199: +LABEL190: load_int 1 load_int 1 invoke 299 From bb31c2e556feaec05c38000f896e3af1ebe497a4 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 28 Feb 2019 12:47:56 +0000 Subject: [PATCH 161/304] [maven-release-plugin] prepare release runelite-parent-1.5.14 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 9ad16f216c..084c5c2339 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index f6d5cc5ffa..ec2777a955 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 072a7e4767..3ddf77f125 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 910cacdbd6..a8973e142a 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index d1217f0ced..2688345f38 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 Web Service diff --git a/pom.xml b/pom.xml index a5187a029c..70b07055c5 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.14 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index df42e1e53a..269c8d8833 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 490f2eb372..d802b05b02 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index f9b875d6fa..1ef7268072 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index e026f85423..b7333277fb 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 8b90c2bec0..e25e0e685b 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 57ce1ecb31..a9ead25860 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 4986a1d5fa..890d48f146 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14-SNAPSHOT + 1.5.14 net.runelite.rs From ce2fcd42d4eb4d1afab75693591450eaf7d91af2 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 28 Feb 2019 12:48:07 +0000 Subject: [PATCH 162/304] [maven-release-plugin] prepare for next development iteration --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 084c5c2339..1c35833312 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index ec2777a955..d7599a0ee1 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 3ddf77f125..5a32517d5a 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index a8973e142a..2b7aeb8c46 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 2688345f38..d300806562 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index 70b07055c5..50feb34d19 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.14 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 269c8d8833..600e4a4504 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index d802b05b02..1cdf3f73fa 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 1ef7268072..eb2899e7fa 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index b7333277fb..001c3ef6e0 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index e25e0e685b..0f25c82dae 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index a9ead25860..8252408774 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 890d48f146..fe7235a473 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.14 + 1.5.15-SNAPSHOT net.runelite.rs From 2922a8b5f82f739561ea409818049f0310015e9e Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Thu, 28 Feb 2019 15:27:25 -0800 Subject: [PATCH 163/304] worldpoint: Fix plane value in toLocalInstance Fixes runelite/runelite#7985 Fixes runelite/runelite#8045 --- .../src/main/java/net/runelite/api/coords/WorldPoint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index a0a23e6674..2ddf7e4198 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -211,7 +211,7 @@ public class WorldPoint // find instance chunks using the template point. there might be more than one. List worldPoints = new ArrayList<>(); - final int z = client.getPlane(); + final int z = worldPoint.getPlane(); int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks(); for (int x = 0; x < instanceTemplateChunks[z].length; ++x) { From b053bd1a9c41800065822f91660b58e5021c97a7 Mon Sep 17 00:00:00 2001 From: piebandit <48078984+piebandit@users.noreply.github.com> Date: Thu, 28 Feb 2019 15:37:37 -0800 Subject: [PATCH 164/304] Add Compost, Bastion and Battlemage potions to Herblore skill calc (#8031) --- .../skillcalculator/skill_herblore.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json index f546d5947b..c25cb8beda 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json @@ -60,6 +60,12 @@ "name": "Harralander", "xp": 6.3 }, + { + "level": 21, + "icon": 6472, + "name": "Compost Potion (3)", + "xp": 60 + }, { "level": 22, "icon": 127, @@ -282,6 +288,18 @@ "name": "Antidote++ (3)", "xp": 177.5 }, + { + "level": 80, + "icon": 22464, + "name": "Bastion Potion (3)", + "xp": 155 + }, + { + "level": 80, + "icon": 22452, + "name": "Battlemage Potion (3)", + "xp": 155 + }, { "level": 81, "icon": 6687, From e2c81da46e0e84d4d3f69d72e3a2fa76c3be518f Mon Sep 17 00:00:00 2001 From: Shaun Dreclin Date: Thu, 28 Feb 2019 19:22:16 -0500 Subject: [PATCH 165/304] daily task indicator: Fix plugin not checking tasks when first enabled --- .../dailytaskindicators/DailyTasksPlugin.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksPlugin.java index e44df4796a..04d6a460a3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksPlugin.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2018, Infinitay - * Copyright (c) 2018, Shaun Dreclin + * Copyright (c) 2018-2019, Shaun Dreclin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -86,10 +86,15 @@ public class DailyTasksPlugin extends Plugin } @Override - protected void shutDown() throws Exception + public void startUp() + { + loggingIn = true; + } + + @Override + public void shutDown() { lastReset = 0L; - loggingIn = false; } @Subscribe @@ -108,7 +113,6 @@ public class DailyTasksPlugin extends Plugin boolean dailyReset = !loggingIn && currentTime - lastReset > ONE_DAY; if ((dailyReset || loggingIn) - && client.getGameState() == GameState.LOGGED_IN && client.getVar(VarClientInt.MEMBERSHIP_STATUS) == 1) { // Round down to the nearest day From 3925e1fa5064ff7e06f57ece9e1ebe59fc5c5984 Mon Sep 17 00:00:00 2001 From: Brennan Williams Date: Fri, 1 Mar 2019 09:10:06 +0100 Subject: [PATCH 166/304] Add Hydra shortcut pipes to agility plugin (#8052) Fixes #8041 --- .../src/main/java/net/runelite/client/game/AgilityShortcut.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java index c376bd34f1..6261f1aabe 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java +++ b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java @@ -191,6 +191,8 @@ public enum AgilityShortcut KALPHITE_WALL(86, "Crevice", new WorldPoint(3214, 9508, 0), CREVICE_16465), BRIMHAVEN_DUNGEON_VINE_EAST(87, "Vine", new WorldPoint(2672, 9582, 0), VINE_26880, VINE_26882), BRIMHAVEN_DUNGEON_VINE_WEST(87, "Vine", new WorldPoint(2606, 9584, 0), VINE_26880, VINE_26882), + MOUNT_KARUULM_PIPE_SOUTH(88, "Pipe", new WorldPoint(1316, 10214, 0), MYSTERIOUS_PIPE), + MOUNT_KARUULM_PIPE_NORTH(88, "Pipe", new WorldPoint(1346, 10231, 0), MYSTERIOUS_PIPE), REVENANT_CAVES_CHAMBER_JUMP(89, "Jump", new WorldPoint(3240, 10144, 0), PILLAR_31561); /** From 3a2a35d307bec1e983d6b7288f7c102ee27990c6 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Fri, 1 Mar 2019 18:54:57 +0100 Subject: [PATCH 167/304] Make GPU plugin DPI aware on Java 9+ Signed-off-by: Tomas Slusny --- .../client/plugins/gpu/GpuPlugin.java | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index 93d8a522d9..7c0054ac66 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -37,7 +37,9 @@ import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLProfile; import java.awt.Canvas; import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.Image; +import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; import java.nio.ByteBuffer; @@ -46,6 +48,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.util.function.Function; import javax.inject.Inject; +import jogamp.nativewindow.SurfaceScaleUtils; import jogamp.nativewindow.jawt.x11.X11JAWTWindow; import jogamp.newt.awt.NewtFactoryAWT; import lombok.extern.slf4j.Slf4j; @@ -71,18 +74,7 @@ import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginInstantiationException; import net.runelite.client.plugins.PluginManager; -import static net.runelite.client.plugins.gpu.GLUtil.glDeleteBuffer; -import static net.runelite.client.plugins.gpu.GLUtil.glDeleteFrameBuffer; -import static net.runelite.client.plugins.gpu.GLUtil.glDeleteRenderbuffers; -import static net.runelite.client.plugins.gpu.GLUtil.glDeleteTexture; -import static net.runelite.client.plugins.gpu.GLUtil.glDeleteVertexArrays; -import static net.runelite.client.plugins.gpu.GLUtil.glGenBuffers; -import static net.runelite.client.plugins.gpu.GLUtil.glGetInteger; -import static net.runelite.client.plugins.gpu.GLUtil.glGenFrameBuffer; -import static net.runelite.client.plugins.gpu.GLUtil.glGenRenderbuffer; -import static net.runelite.client.plugins.gpu.GLUtil.glGenTexture; -import static net.runelite.client.plugins.gpu.GLUtil.glGenVertexArrays; -import static net.runelite.client.plugins.gpu.GLUtil.inputStreamToString; +import static net.runelite.client.plugins.gpu.GLUtil.*; import net.runelite.client.plugins.gpu.config.AntiAliasingMode; import net.runelite.client.plugins.gpu.template.Template; import net.runelite.client.ui.DrawManager; @@ -1021,7 +1013,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks renderWidthOff = (int) Math.floor(scaleFactorX * (renderWidthOff )) - padding; } - gl.glViewport(renderWidthOff, renderCanvasHeight - renderViewportHeight - renderHeightOff, renderViewportWidth, renderViewportHeight); + glDpiAwareViewport(renderWidthOff, renderCanvasHeight - renderViewportHeight - renderHeightOff, renderViewportWidth, renderViewportHeight); gl.glUseProgram(glProgram); @@ -1154,11 +1146,11 @@ public class GpuPlugin extends Plugin implements DrawCallbacks if (client.isStretchedEnabled()) { Dimension dim = client.getStretchedDimensions(); - gl.glViewport(0, 0, dim.width, dim.height); + glDpiAwareViewport(0, 0, dim.width, dim.height); } else { - gl.glViewport(0, 0, canvasWidth, canvasHeight); + glDpiAwareViewport(0, 0, canvasWidth, canvasHeight); } // Use the texture bound in the first pass @@ -1453,4 +1445,18 @@ public class GpuPlugin extends Plugin implements DrawCallbacks } } + private int getScaledValue(final double scale, final int value) + { + return SurfaceScaleUtils.scale(value, (float) scale); + } + + private void glDpiAwareViewport(final int x, final int y, final int width, final int height) + { + final AffineTransform t = ((Graphics2D) canvas.getGraphics()).getTransform(); + gl.glViewport( + getScaledValue(t.getScaleX(), x), + getScaledValue(t.getScaleY(), y), + getScaledValue(t.getScaleX(), width), + getScaledValue(t.getScaleY(), height)); + } } From 9d717137107f7bc8d8c74bfe44a15be9b8cf5a70 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 1 Mar 2019 21:41:51 -0500 Subject: [PATCH 168/304] Move session events from api to client --- .../main/java/net/runelite/client/account/SessionManager.java | 4 ++-- .../main/java/net/runelite/client}/events/SessionClose.java | 2 +- .../main/java/net/runelite/client}/events/SessionOpen.java | 2 +- .../main/java/net/runelite/client/plugins/PluginManager.java | 4 ++-- .../net/runelite/client/plugins/account/AccountPlugin.java | 4 ++-- .../client/plugins/defaultworld/DefaultWorldPlugin.java | 2 +- .../client/plugins/grandexchange/GrandExchangePlugin.java | 4 ++-- .../main/java/net/runelite/client/plugins/info/InfoPanel.java | 4 ++-- .../client/plugins/loginscreen/LoginScreenPlugin.java | 2 +- .../client/plugins/loottracker/LootTrackerPlugin.java | 4 ++-- .../java/net/runelite/client/plugins/notes/NotesPlugin.java | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) rename {runelite-api/src/main/java/net/runelite/api => runelite-client/src/main/java/net/runelite/client}/events/SessionClose.java (97%) rename {runelite-api/src/main/java/net/runelite/api => runelite-client/src/main/java/net/runelite/client}/events/SessionOpen.java (97%) diff --git a/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java b/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java index 63f6b9b479..1f17207c6e 100644 --- a/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java +++ b/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java @@ -36,8 +36,8 @@ import javax.inject.Inject; import javax.inject.Singleton; import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import net.runelite.api.events.SessionClose; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.client.RuneLite; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.EventBus; diff --git a/runelite-api/src/main/java/net/runelite/api/events/SessionClose.java b/runelite-client/src/main/java/net/runelite/client/events/SessionClose.java similarity index 97% rename from runelite-api/src/main/java/net/runelite/api/events/SessionClose.java rename to runelite-client/src/main/java/net/runelite/client/events/SessionClose.java index 7075607291..e8a2f227cb 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SessionClose.java +++ b/runelite-client/src/main/java/net/runelite/client/events/SessionClose.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.api.events; +package net.runelite.client.events; import lombok.Data; diff --git a/runelite-api/src/main/java/net/runelite/api/events/SessionOpen.java b/runelite-client/src/main/java/net/runelite/client/events/SessionOpen.java similarity index 97% rename from runelite-api/src/main/java/net/runelite/api/events/SessionOpen.java rename to runelite-client/src/main/java/net/runelite/client/events/SessionOpen.java index 7ff930470b..971ba7cb2e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SessionOpen.java +++ b/runelite-client/src/main/java/net/runelite/client/events/SessionOpen.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.api.events; +package net.runelite.client.events; import lombok.Data; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java index caa116835e..73d6bf32e4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java @@ -57,8 +57,8 @@ import javax.inject.Singleton; import javax.swing.SwingUtilities; import lombok.Setter; import lombok.extern.slf4j.Slf4j; -import net.runelite.api.events.SessionClose; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.client.RuneLite; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java index 0bef99bac0..2b82c9e211 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java @@ -29,8 +29,8 @@ import java.util.concurrent.ScheduledExecutorService; import javax.inject.Inject; import javax.swing.JOptionPane; import lombok.extern.slf4j.Slf4j; -import net.runelite.api.events.SessionClose; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.client.account.AccountSession; import net.runelite.client.account.SessionManager; import net.runelite.client.eventbus.Subscribe; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java index c371a13c08..d68791d289 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java @@ -31,7 +31,7 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionOpen; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index 5a59ede074..5c81aca1b4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -57,8 +57,8 @@ import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.GrandExchangeOfferChanged; import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.SessionClose; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java index 203b688b4e..f9dc12f4e7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java @@ -45,8 +45,8 @@ import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.event.HyperlinkEvent; import net.runelite.api.Client; -import net.runelite.api.events.SessionClose; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.client.RuneLiteProperties; import net.runelite.client.account.SessionManager; import net.runelite.client.config.ConfigManager; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java index 279251e1c9..4da52e1492 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java @@ -36,7 +36,7 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionOpen; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.input.KeyListener; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 055c2cc3f4..4390da8a47 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -55,8 +55,8 @@ import net.runelite.api.SpriteID; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; -import net.runelite.api.events.SessionClose; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.WidgetID; import net.runelite.client.account.AccountSession; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java index fe0f7e65d3..0b23ac8eb2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java @@ -27,7 +27,7 @@ package net.runelite.client.plugins.notes; import com.google.inject.Provides; import java.awt.image.BufferedImage; import javax.inject.Inject; -import net.runelite.api.events.SessionOpen; +import net.runelite.client.events.SessionOpen; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; From b6ab78b5012bc1ff1b57eb3534bbd49e08423f01 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 1 Mar 2019 22:28:56 -0500 Subject: [PATCH 169/304] api: add changed varp index to VarbitChanged event --- .../main/java/net/runelite/api/events/VarbitChanged.java | 7 ++++++- .../runelite/client/plugins/devtools/DevToolsPlugin.java | 4 +++- .../src/main/java/net/runelite/mixins/RSClientMixin.java | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java index 5a6d6adc2d..9680e54ac4 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java @@ -29,9 +29,14 @@ package net.runelite.api.events; import lombok.Data; /** - * An event where a varbit has changed. + * An event when a varbit or varplayer has changed. */ @Data public class VarbitChanged { + /** + * Index in the varp array that was changed. + * For varplayer, this is the varplayer id. + */ + private int index = -1; } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java index 5aae397d0f..3730a878b9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java @@ -238,7 +238,9 @@ public class DevToolsPlugin extends Plugin int value = Integer.parseInt(args[1]); client.setVarpValue(client.getVarps(), varp, value); client.addChatMessage(ChatMessageType.SERVER, "", "Set VarPlayer " + varp + " to " + value, null); - eventBus.post(new VarbitChanged()); // fake event + VarbitChanged varbitChanged = new VarbitChanged(); + varbitChanged.setIndex(varp); + eventBus.post(varbitChanged); // fake event break; } case "getvarb": diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 5638409b51..1a2e05aaa9 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1013,6 +1013,7 @@ public abstract class RSClientMixin implements RSClient public static void settingsChanged(int idx) { VarbitChanged varbitChanged = new VarbitChanged(); + varbitChanged.setIndex(idx); client.getCallbacks().post(varbitChanged); } From 1675a7e0a18e6a079b9a2ef0dd96c85668b46444 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sun, 17 Feb 2019 19:26:56 -0800 Subject: [PATCH 170/304] worldpoint: Add static fromRegion method --- .../main/java/net/runelite/api/coords/WorldPoint.java | 11 +++++++++++ .../plugins/groundmarkers/GroundMarkerPlugin.java | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index a0a23e6674..e1ab0b0cac 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -326,4 +326,15 @@ public class WorldPoint { return ((x >> 6) << 8) | (y >> 6); } + + /** + * Converts the passed region ID and coordinates to a world coordinate + */ + public static WorldPoint fromRegion(int regionId, int regionX, int regionY, int plane) + { + return new WorldPoint( + ((regionId >>> 8) << 6) + regionX, + ((regionId & 0xff) << 6) + regionY, + plane); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 2cb7ebf1c2..db848c30f5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -163,12 +163,7 @@ public class GroundMarkerPlugin extends Plugin int regionY = point.getRegionY(); int z = point.getZ(); - // world point of the tile marker - return new WorldPoint( - ((regionId >>> 8) << 6) + regionX, - ((regionId & 0xff) << 6) + regionY, - z - ); + return WorldPoint.fromRegion(regionId, regionX, regionY, z); }) .flatMap(wp -> WorldPoint.toLocalInstance(client, wp).stream()) .collect(Collectors.toList()); From 39bbf2f259517ce5760210231a9fb9308bccd688 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Mon, 18 Feb 2019 19:11:24 -0800 Subject: [PATCH 171/304] worldpoint: Add getRegionX() and getRegionY() --- .../net/runelite/api/coords/WorldPoint.java | 21 +++++++++++++++++++ .../groundmarkers/GroundMarkerPlugin.java | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index e1ab0b0cac..a6db435a2b 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -337,4 +337,25 @@ public class WorldPoint ((regionId & 0xff) << 6) + regionY, plane); } + + /** + * Gets the X-axis coordinate of the region coordinate + */ + public int getRegionX() + { + return getRegionOffset(x); + } + + /** + * Gets the Y-axis coordinate of the region coordinate + */ + public int getRegionY() + { + return getRegionOffset(y); + } + + private static int getRegionOffset(final int position) + { + return position & 0x3f; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index db848c30f5..71a21e1c7f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -249,7 +249,7 @@ public class GroundMarkerPlugin extends Plugin WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint); int regionId = worldPoint.getRegionID(); - GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getX() & 0x3f, worldPoint.getY() & 0x3f, client.getPlane()); + GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane()); log.debug("Updating point: {} - {}", point, worldPoint); List points = new ArrayList<>(getPoints(regionId)); From 285926924b8d29f7116a4bcf69b503618470d4a3 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sat, 16 Feb 2019 23:35:46 -0800 Subject: [PATCH 172/304] ground markers plugin: Clean up legacy code This includes various code quality improvements such as stronger access control, enforcing newlines at EOF, naming magic numbers and strings, and utilizing higher efficiency methods and class constructors. --- .../groundmarkers/GroundMarkerConfig.java | 1 - .../GroundMarkerInputListener.java | 2 +- .../groundmarkers/GroundMarkerOverlay.java | 6 +++-- .../groundmarkers/GroundMarkerPlugin.java | 26 ++++++++++--------- .../groundmarkers/GroundMarkerPoint.java | 5 ++-- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java index d77f3ab9f5..394ffcf81b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java @@ -23,7 +23,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package net.runelite.client.plugins.groundmarkers; import java.awt.Color; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java index 3b87dd1802..a097d47d29 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java @@ -64,4 +64,4 @@ public class GroundMarkerInputListener implements KeyListener plugin.setHotKeyPressed(false); } } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java index ccd6fd7483..d2b64a81d0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java @@ -42,6 +42,8 @@ import net.runelite.client.ui.overlay.OverlayUtil; public class GroundMarkerOverlay extends Overlay { + private static final int MAX_DRAW_DISTANCE = 32; + private final Client client; private final GroundMarkerConfig config; private final GroundMarkerPlugin plugin; @@ -78,7 +80,7 @@ public class GroundMarkerOverlay extends Overlay { WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - if (point.distanceTo(playerLocation) >= 32) + if (point.distanceTo(playerLocation) >= MAX_DRAW_DISTANCE) { return; } @@ -97,4 +99,4 @@ public class GroundMarkerOverlay extends Overlay OverlayUtil.renderPolygon(graphics, poly, config.markerColor()); } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 71a21e1c7f..a6978c32ae 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -69,8 +69,9 @@ public class GroundMarkerPlugin extends Plugin private static final String CONFIG_GROUP = "groundMarker"; private static final String MARK = "Mark tile"; private static final String WALK_HERE = "Walk here"; + private static final String REGION_PREFIX = "region_"; - private static final Gson gson = new Gson(); + private static final Gson GSON = new Gson(); @Getter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE) @@ -101,24 +102,26 @@ public class GroundMarkerPlugin extends Plugin { if (points == null || points.isEmpty()) { - configManager.unsetConfiguration(CONFIG_GROUP, "region_" + regionId); + configManager.unsetConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); return; } - String json = gson.toJson(points); - configManager.setConfiguration(CONFIG_GROUP, "region_" + regionId, json); + String json = GSON.toJson(points); + configManager.setConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId, json); } private Collection getPoints(int regionId) { - String json = configManager.getConfiguration(CONFIG_GROUP, "region_" + regionId); + String json = configManager.getConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); if (Strings.isNullOrEmpty(json)) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } - return gson.fromJson(json, new TypeToken>() - { - }.getType()); + return GSON.fromJson(json, new GroundMarkerListTypeToken().getType()); + } + + private static class GroundMarkerListTypeToken extends TypeToken> + { } @Provides @@ -238,8 +241,7 @@ public class GroundMarkerPlugin extends Plugin keyManager.unregisterKeyListener(inputListener); } - - protected void markTile(LocalPoint localPoint) + private void markTile(LocalPoint localPoint) { if (localPoint == null) { @@ -266,4 +268,4 @@ public class GroundMarkerPlugin extends Plugin loadPoints(); } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java index b31db32222..396a2217cb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java @@ -23,16 +23,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package net.runelite.client.plugins.groundmarkers; import lombok.Value; @Value -public class GroundMarkerPoint +class GroundMarkerPoint { private int regionId; private int regionX; private int regionY; private int z; -} \ No newline at end of file +} From 36fdb620fc3a0a6d2ccc98c1cdb39978ef2d8192 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sun, 17 Feb 2019 19:43:49 -0800 Subject: [PATCH 173/304] ground markers: Fix startup and shutdown bug When logging in to the game with the plugin disabled, enabling it will not cause points to be filled, as the game state trigger will not be reached. This commit properly loads points on plugin startup and clears them on shutdown. --- .../client/plugins/groundmarkers/GroundMarkerPlugin.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index a6978c32ae..37d4f1829f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -135,6 +135,12 @@ public class GroundMarkerPlugin extends Plugin points.clear(); int[] regions = client.getMapRegions(); + + if (regions == null) + { + return; + } + for (int regionId : regions) { // load points for region @@ -232,6 +238,7 @@ public class GroundMarkerPlugin extends Plugin { overlayManager.add(overlay); keyManager.registerKeyListener(inputListener); + loadPoints(); } @Override @@ -239,6 +246,7 @@ public class GroundMarkerPlugin extends Plugin { overlayManager.remove(overlay); keyManager.unregisterKeyListener(inputListener); + points.clear(); } private void markTile(LocalPoint localPoint) From ad65a9aad912c3b812abd688ee39a3675b3b49ba Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sun, 17 Feb 2019 19:28:16 -0800 Subject: [PATCH 174/304] ground markers: Allow different colored markers This adds a color indicator per marker, saved to config, allowing multiple markers to be different colors. In addition, a configuration option is added to switch between per-tile color display or current configured color display. (that is, new or existing behavior) This change will set a color in config for old markers with null colors when those markers are loaded. Fixes runelite/runelite#3395 --- .../groundmarkers/ColorTileMarker.java | 45 ++++++++ .../groundmarkers/GroundMarkerConfig.java | 10 ++ .../groundmarkers/GroundMarkerOverlay.java | 16 +-- .../groundmarkers/GroundMarkerPlugin.java | 107 +++++++++++++----- .../groundmarkers/GroundMarkerPoint.java | 5 + 5 files changed, 149 insertions(+), 34 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java new file mode 100644 index 0000000000..8f45e9489a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.groundmarkers; + +import java.awt.Color; +import lombok.Value; +import net.runelite.api.coords.WorldPoint; + +/** + * Used to denote marked tiles and their colors. + * Note: This is not used for serialization of ground markers; see {@link GroundMarkerPoint} + */ +@Value +class ColorTileMarker +{ + private WorldPoint worldPoint; + private Color color; + + boolean sameTile(final ColorTileMarker other) + { + return worldPoint.equals(other.getWorldPoint()); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java index 394ffcf81b..ba8cb98e14 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java @@ -44,4 +44,14 @@ public interface GroundMarkerConfig extends Config { return Color.YELLOW; } + + @ConfigItem( + keyName = "rememberTileColors", + name = "Remember color per tile", + description = "Color tiles using the color from time of placement" + ) + default boolean rememberTileColors() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java index d2b64a81d0..153fe67154 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java @@ -25,10 +25,11 @@ */ package net.runelite.client.plugins.groundmarkers; +import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Polygon; -import java.util.List; +import java.util.Collection; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.Perspective; @@ -62,21 +63,22 @@ public class GroundMarkerOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - List points = plugin.getPoints(); - for (WorldPoint point : points) + final Collection points = plugin.getPoints(); + for (final ColorTileMarker point : points) { - if (point.getPlane() != client.getPlane()) + if (point.getWorldPoint().getPlane() != client.getPlane()) { continue; } - drawTile(graphics, point); + final Color tileColor = config.rememberTileColors() ? point.getColor() : config.markerColor(); + drawTile(graphics, point.getWorldPoint(), tileColor); } return null; } - private void drawTile(Graphics2D graphics, WorldPoint point) + private void drawTile(Graphics2D graphics, WorldPoint point, Color color) { WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); @@ -97,6 +99,6 @@ public class GroundMarkerOverlay extends Overlay return; } - OverlayUtil.renderPolygon(graphics, poly, config.markerColor()); + OverlayUtil.renderPolygon(graphics, poly, color); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 37d4f1829f..4aa613af7c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -29,11 +29,12 @@ import com.google.common.base.Strings; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.google.inject.Provides; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import javax.inject.Inject; import lombok.AccessLevel; @@ -78,11 +79,14 @@ public class GroundMarkerPlugin extends Plugin private boolean hotKeyPressed; @Getter(AccessLevel.PACKAGE) - private final List points = new ArrayList<>(); + private final Set points = new HashSet<>(); @Inject private Client client; + @Inject + private GroundMarkerConfig config; + @Inject private GroundMarkerInputListener inputListener; @@ -98,6 +102,11 @@ public class GroundMarkerPlugin extends Plugin @Inject private KeyManager keyManager; + private void saveColorTileMarkers(int regionId, Collection points) + { + savePoints(regionId, translateFromColorTileMarker(points)); + } + private void savePoints(int regionId, Collection points) { if (points == null || points.isEmpty()) @@ -117,7 +126,25 @@ public class GroundMarkerPlugin extends Plugin { return Collections.emptyList(); } - return GSON.fromJson(json, new GroundMarkerListTypeToken().getType()); + + Collection configPoints = GSON.fromJson(json, new GroundMarkerListTypeToken().getType()); + + if (configPoints.stream().anyMatch(point -> point.getColor() == null)) + { + log.debug("Adding color to old ground marker(s) of region " + regionId); + configPoints = configPoints.stream() + .map(point -> + { + if (point.getColor() != null) + { + return point; + } + return new GroundMarkerPoint(point.getRegionId(), point.getRegionX(), point.getRegionY(), point.getZ(), config.markerColor()); + }) + .collect(Collectors.toSet()); + savePoints(regionId, configPoints); + } + return configPoints; } private static class GroundMarkerListTypeToken extends TypeToken> @@ -145,37 +172,58 @@ public class GroundMarkerPlugin extends Plugin { // load points for region log.debug("Loading points for region {}", regionId); - Collection regionPoints = getPoints(regionId); - Collection worldPoints = translateToWorld(regionPoints); - points.addAll(worldPoints); + final Collection configPoints = getPoints(regionId); + final Collection colorTileMarkers = translateToColorTileMarker(configPoints); + points.addAll(colorTileMarkers); } } /** - * Translate a collection of ground marker points to world points, accounting for instances + * Translate a collection of ground marker points to color tile markers, accounting for instances * - * @param points - * @return + * @param points {@link GroundMarkerPoint}s to be converted to {@link ColorTileMarker}s + * @return A collection of color tile markers, converted from the passed ground marker points, accounting for local + * instance points. See {@link WorldPoint#toLocalInstance(Client, WorldPoint)} */ - private Collection translateToWorld(Collection points) + private Collection translateToColorTileMarker(Collection points) { - if (points.isEmpty()) + if (points == null || points.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); + } + + return points.stream() + .map(point -> new ColorTileMarker( + WorldPoint.fromRegion(point.getRegionId(), point.getRegionX(), point.getRegionY(), point.getZ()), + point.getColor())) + .flatMap(colorTile -> + { + final Collection localWorldPoints = WorldPoint.toLocalInstance(client, colorTile.getWorldPoint()); + return localWorldPoints.stream().map(wp -> new ColorTileMarker(wp, colorTile.getColor())); + }) + .collect(Collectors.toSet()); + } + + /** + * Translate a collection of color tile markers to a set of ground marker points + * + * @param points {@link ColorTileMarker}s to be converted to {@link GroundMarkerPoint}s + * @return A set of ground marker points, converted from the passed color tile markers + */ + private static Set translateFromColorTileMarker(Collection points) + { + if (points == null || points.isEmpty()) + { + return Collections.emptySet(); } return points.stream() .map(point -> { - int regionId = point.getRegionId(); - int regionX = point.getRegionX(); - int regionY = point.getRegionY(); - int z = point.getZ(); - - return WorldPoint.fromRegion(regionId, regionX, regionY, z); + final WorldPoint worldPoint = point.getWorldPoint(); + return new GroundMarkerPoint(worldPoint.getRegionID(), worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane(), point.getColor()); }) - .flatMap(wp -> WorldPoint.toLocalInstance(client, wp).stream()) - .collect(Collectors.toList()); + .collect(Collectors.toSet()); } @Subscribe @@ -256,23 +304,28 @@ public class GroundMarkerPlugin extends Plugin return; } - WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint); - - int regionId = worldPoint.getRegionID(); - GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane()); + final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint); + final ColorTileMarker point = new ColorTileMarker(worldPoint, config.markerColor()); log.debug("Updating point: {} - {}", point, worldPoint); - List points = new ArrayList<>(getPoints(regionId)); if (points.contains(point)) { points.remove(point); } else { - points.add(point); + // Remove any points on the same tile but are of a different color + points.removeIf(p -> p.sameTile(point)); + + // Add point back only if we are remembering tile colors, otherwise simply remove it + if (config.rememberTileColors()) + { + points.add(point); + } } - savePoints(regionId, points); + final int regionId = worldPoint.getRegionID(); + saveColorTileMarkers(regionId, points); loadPoints(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java index 396a2217cb..ca3aaadb6d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java @@ -25,8 +25,12 @@ */ package net.runelite.client.plugins.groundmarkers; +import java.awt.Color; import lombok.Value; +/** + * Used for serialization of ground marker points. + */ @Value class GroundMarkerPoint { @@ -34,4 +38,5 @@ class GroundMarkerPoint private int regionX; private int regionY; private int z; + private Color color; } From a4977abbf2cca1cd98d976d3ceeab9fb5e07b8ba Mon Sep 17 00:00:00 2001 From: Sebastiaan Vanspauwen Date: Sat, 2 Mar 2019 13:22:01 +0100 Subject: [PATCH 175/304] Clanchat: added onClanChanged event to count players already in scene --- .../plugins/clanchat/ClanChatPlugin.java | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index c73b731268..2b99092397 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -39,6 +39,7 @@ import net.runelite.api.Player; import net.runelite.api.SpriteID; import net.runelite.api.VarClientStr; import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.ClanChanged; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; @@ -197,11 +198,7 @@ public class ClanChatPlugin extends Plugin if (event.getPlayer().isClanMember()) { clanMembers.add(event.getPlayer()); - - if (clanMemberCounter == null) - { - addClanCounter(); - } + addClanCounter(); } } @@ -214,6 +211,31 @@ public class ClanChatPlugin extends Plugin } } + @Subscribe + public void onClanChanged(ClanChanged event) + { + if (event.isJoined()) + { + clientThread.invokeLater(() -> + { + for (Player player : client.getPlayers()) + { + if (player.isClanMember() && !clanMembers.contains(player)) + { + clanMembers.add(player); + } + } + + addClanCounter(); + }); + } + else + { + clanMembers.clear(); + removeClanCounter(); + } + } + int getClanAmount() { return clanMembers.size(); @@ -309,7 +331,7 @@ public class ClanChatPlugin extends Plugin private void addClanCounter() { - if (!config.showClanCounter() || clanMemberCounter != null ) + if (!config.showClanCounter() || clanMemberCounter != null || clanMembers.isEmpty()) { return; } From 7e026946525fb1c025677bddf660c19862e984d2 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sat, 2 Mar 2019 09:27:54 -0800 Subject: [PATCH 176/304] ground markers: Fix marking non-marked tiles This fixes the bug introduced in runelite/runelite#5890 where attempting to mark a non-marked tile while having the "Remember color per tile" config disabled would prevent new tiles from being marked. Instead, it properly ensures that unmarking tiles with that config disabled will not re-mark it with an updated color, causing a second unmark to be needed. --- .../client/plugins/groundmarkers/GroundMarkerPlugin.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 4aa613af7c..01952103c4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -314,11 +314,10 @@ public class GroundMarkerPlugin extends Plugin } else { - // Remove any points on the same tile but are of a different color - points.removeIf(p -> p.sameTile(point)); - - // Add point back only if we are remembering tile colors, otherwise simply remove it - if (config.rememberTileColors()) + // Remove any points on the same tile but are of a different color. + // Add a new point if no tile was removed, or if remembering tile colors is enabled, which means the marked + // tile was previously of a different color than the new tile marking. + if (!points.removeIf(p -> p.sameTile(point)) || config.rememberTileColors()) { points.add(point); } From 6dec25aee44db83d221b439d55ab43ee420866ed Mon Sep 17 00:00:00 2001 From: Shaun Dreclin Date: Thu, 28 Feb 2019 20:37:17 -0500 Subject: [PATCH 177/304] api: Add EnumID class --- .../main/java/net/runelite/api/EnumID.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 runelite-api/src/main/java/net/runelite/api/EnumID.java diff --git a/runelite-api/src/main/java/net/runelite/api/EnumID.java b/runelite-api/src/main/java/net/runelite/api/EnumID.java new file mode 100644 index 0000000000..0b2d477a84 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/EnumID.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019, Shaun Dreclin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api; + +/** + * Utility class used for mapping enum IDs. + *

+ * Note: This class is not complete and may be missing mapped IDs. + */ +public final class EnumID +{ + public static final int MUSIC_TRACK_NAMES = 812; + public static final int MUSIC_TRACK_IDS = 819; +} From 923c3bcd2620fa6082ebc38328037dc47382cef6 Mon Sep 17 00:00:00 2001 From: Shaun Dreclin Date: Wed, 27 Feb 2019 21:25:15 -0500 Subject: [PATCH 178/304] api: Add getKeys() to EnumComposition --- .../src/main/java/net/runelite/api/EnumComposition.java | 2 ++ runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java | 1 + 2 files changed, 3 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/EnumComposition.java b/runelite-api/src/main/java/net/runelite/api/EnumComposition.java index 7bbfaa1693..00f8c30814 100644 --- a/runelite-api/src/main/java/net/runelite/api/EnumComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/EnumComposition.java @@ -26,6 +26,8 @@ package net.runelite.api; public interface EnumComposition { + int[] getKeys(); + int[] getIntVals(); String[] getStringVals(); diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java b/runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java index d1a5273e5b..afad5c131e 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSEnum.java @@ -30,6 +30,7 @@ import net.runelite.mapping.Import; public interface RSEnum extends EnumComposition, RSCacheableNode { @Import("keys") + @Override int[] getKeys(); @Import("intVals") From cc210a30355e6456109528ed3511d688b6efb662 Mon Sep 17 00:00:00 2001 From: Shaun Dreclin Date: Mon, 25 Feb 2019 21:20:41 -0500 Subject: [PATCH 179/304] api: Add unlocked music tracks to VarPlayer --- .../main/java/net/runelite/api/VarPlayer.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java index c3183074b0..ed2f25e74e 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java +++ b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java @@ -134,7 +134,30 @@ public enum VarPlayer * Slayer unlock bitfields */ SLAYER_UNLOCK_1(1076), - SLAYER_UNLOCK_2(1344); + SLAYER_UNLOCK_2(1344), + + /** + * Music track unlock bitfields + */ + MUSIC_TRACKS_UNLOCKED_1(20), + MUSIC_TRACKS_UNLOCKED_2(21), + MUSIC_TRACKS_UNLOCKED_3(22), + MUSIC_TRACKS_UNLOCKED_4(23), + MUSIC_TRACKS_UNLOCKED_5(24), + MUSIC_TRACKS_UNLOCKED_6(25), + MUSIC_TRACKS_UNLOCKED_7(298), + MUSIC_TRACKS_UNLOCKED_8(311), + MUSIC_TRACKS_UNLOCKED_9(346), + MUSIC_TRACKS_UNLOCKED_10(414), + MUSIC_TRACKS_UNLOCKED_11(464), + MUSIC_TRACKS_UNLOCKED_12(598), + MUSIC_TRACKS_UNLOCKED_13(662), + MUSIC_TRACKS_UNLOCKED_14(721), + MUSIC_TRACKS_UNLOCKED_15(906), + MUSIC_TRACKS_UNLOCKED_16(1009), + MUSIC_TRACKS_UNLOCKED_17(1338), + MUSIC_TRACKS_UNLOCKED_18(1681), + MUSIC_TRACKS_UNLOCKED_19(2065); private final int id; } From f6e5ef1f3d13d40713ca28ade53d3b9781fb8bbf Mon Sep 17 00:00:00 2001 From: Shaun Dreclin Date: Thu, 28 Feb 2019 19:01:43 -0500 Subject: [PATCH 180/304] client: Add Music Track Indicator plugin --- .../musicindicator/MusicIndicatorPlugin.java | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/musicindicator/MusicIndicatorPlugin.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/musicindicator/MusicIndicatorPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/musicindicator/MusicIndicatorPlugin.java new file mode 100644 index 0000000000..ecef015bd7 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/musicindicator/MusicIndicatorPlugin.java @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2019, Shaun Dreclin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.musicindicator; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.inject.Inject; +import net.runelite.api.ChatMessageType; +import net.runelite.api.Client; +import net.runelite.api.EnumComposition; +import net.runelite.api.EnumID; +import net.runelite.api.VarPlayer; +import net.runelite.api.events.GameStateChanged; +import net.runelite.api.events.GameTick; +import net.runelite.api.events.VarbitChanged; +import net.runelite.client.chat.ChatColorType; +import net.runelite.client.chat.ChatMessageBuilder; +import net.runelite.client.chat.ChatMessageManager; +import net.runelite.client.chat.QueuedMessage; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; + +@PluginDescriptor( + name = "Music Track Indicator", + description = "Show chat notifications when unlocking music tracks" +) +public class MusicIndicatorPlugin extends Plugin +{ + private static final List MUSIC_TRACK_VARPS = ImmutableList.of( + VarPlayer.MUSIC_TRACKS_UNLOCKED_1, VarPlayer.MUSIC_TRACKS_UNLOCKED_2, VarPlayer.MUSIC_TRACKS_UNLOCKED_3, + VarPlayer.MUSIC_TRACKS_UNLOCKED_4, VarPlayer.MUSIC_TRACKS_UNLOCKED_5, VarPlayer.MUSIC_TRACKS_UNLOCKED_6, + VarPlayer.MUSIC_TRACKS_UNLOCKED_7, VarPlayer.MUSIC_TRACKS_UNLOCKED_8, VarPlayer.MUSIC_TRACKS_UNLOCKED_9, + VarPlayer.MUSIC_TRACKS_UNLOCKED_10, VarPlayer.MUSIC_TRACKS_UNLOCKED_11, VarPlayer.MUSIC_TRACKS_UNLOCKED_12, + VarPlayer.MUSIC_TRACKS_UNLOCKED_13, VarPlayer.MUSIC_TRACKS_UNLOCKED_14, VarPlayer.MUSIC_TRACKS_UNLOCKED_15, + VarPlayer.MUSIC_TRACKS_UNLOCKED_16, VarPlayer.MUSIC_TRACKS_UNLOCKED_17, VarPlayer.MUSIC_TRACKS_UNLOCKED_18, + VarPlayer.MUSIC_TRACKS_UNLOCKED_19 + ); + + private static final Map VARP_INDEX_TO_VARPLAYER = MUSIC_TRACK_VARPS.stream() + .collect(Collectors.collectingAndThen(Collectors.toMap(VarPlayer::getId, Function.identity()), + ImmutableMap::copyOf)); + + @Inject + private Client client; + + @Inject + private ChatMessageManager chatMessageManager; + + // Mapping of relevant varps to their values, used to compare against new values + private final Map musicTrackVarpValues = new HashMap<>(); + + private boolean loggingIn; + + @Override + public void startUp() + { + loggingIn = true; + } + + @Override + public void shutDown() + { + musicTrackVarpValues.clear(); + } + + @Subscribe + public void onGameStateChanged(GameStateChanged event) + { + switch (event.getGameState()) + { + case LOGGING_IN: + case CONNECTION_LOST: + case HOPPING: + musicTrackVarpValues.clear(); + loggingIn = true; + } + } + + @Subscribe + public void onGameTick(GameTick event) + { + if (!loggingIn) + { + return; + } + + loggingIn = false; + + for (VarPlayer musicTrackVarp : MUSIC_TRACK_VARPS) + { + int value = client.getVar(musicTrackVarp); + musicTrackVarpValues.put(musicTrackVarp, value); + } + } + + @Subscribe + public void onVarbitChanged(VarbitChanged event) + { + int idx = event.getIndex(); + + VarPlayer varPlayer = VARP_INDEX_TO_VARPLAYER.get(idx); + if (varPlayer == null) + { + return; + } + + // Old varplayer values have not been initialized yet + if (musicTrackVarpValues.isEmpty()) + { + return; + } + + assert musicTrackVarpValues.containsKey(varPlayer); + + int newValue = client.getVar(varPlayer); + int oldValue = musicTrackVarpValues.put(varPlayer, newValue); + int musicTracksUnlocked = ~oldValue & newValue; + + if (musicTracksUnlocked == 0) + { + return; + } + + final EnumComposition names = client.getEnum(EnumID.MUSIC_TRACK_NAMES); + final int varpId = MUSIC_TRACK_VARPS.indexOf(varPlayer) + 1; + + for (int bit = 0; bit < Integer.SIZE; ++bit) + { + if ((musicTracksUnlocked & (1 << bit)) == 0) + { + continue; + } + + int musicTrackId = getTrackId(varpId, bit); + String musicTrackName = names.getStringValue(musicTrackId); + + sendChatMessage("You have unlocked a new music track: " + musicTrackName + "."); + } + } + + /** + * Get the id for a track identified by the given varp and a bit index + * @param variableId + * @param bit + * @return + */ + private int getTrackId(int variableId, int bit) + { + // values are packed into a coordgrid + int packed = (variableId << 14) | bit; + EnumComposition ids = client.getEnum(EnumID.MUSIC_TRACK_IDS); + for (int key : ids.getKeys()) + { + int value = ids.getIntValue(key); + if (value == packed) + { + return key; + } + } + return -1; + } + + private void sendChatMessage(String chatMessage) + { + final String message = new ChatMessageBuilder() + .append(ChatColorType.HIGHLIGHT) + .append(chatMessage) + .build(); + + chatMessageManager.queue( + QueuedMessage.builder() + .type(ChatMessageType.GAME) + .runeLiteFormattedMessage(message) + .build()); + } +} From 9b0bb2b732427454984284004a1cf814bf09babb Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 2 Mar 2019 18:25:29 -0500 Subject: [PATCH 181/304] runescape-api: make RSNameableContainer a generic type --- .../main/java/net/runelite/mixins/RSClientMixin.java | 11 ++++------- .../java/net/runelite/rs/api/RSClanMemberManager.java | 2 +- .../java/net/runelite/rs/api/RSFriendContainer.java | 2 +- .../java/net/runelite/rs/api/RSIgnoreContainer.java | 2 +- .../java/net/runelite/rs/api/RSNameableContainer.java | 4 ++-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 1a2e05aaa9..7cfef3985c 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -77,9 +77,9 @@ import net.runelite.api.events.BoostedLevelChanged; import net.runelite.api.events.CanvasSizeChanged; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ClanChanged; +import net.runelite.api.events.ClientTick; import net.runelite.api.events.DraggingWidgetChanged; import net.runelite.api.events.ExperienceChanged; -import net.runelite.api.events.ClientTick; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GrandExchangeOfferChanged; import net.runelite.api.events.MenuEntryAdded; @@ -120,7 +120,6 @@ import net.runelite.rs.api.RSItem; import net.runelite.rs.api.RSItemContainer; import net.runelite.rs.api.RSNPC; import net.runelite.rs.api.RSName; -import net.runelite.rs.api.RSNameable; import net.runelite.rs.api.RSPlayer; import net.runelite.rs.api.RSSpritePixels; import net.runelite.rs.api.RSWidget; @@ -725,7 +724,7 @@ public abstract class RSClientMixin implements RSClient public ClanMember[] getClanMembers() { final RSClanMemberManager clanMemberManager = getClanMemberManager(); - return clanMemberManager != null ? (ClanMember[]) getClanMemberManager().getNameables() : null; + return clanMemberManager != null ? getClanMemberManager().getNameables() : null; } @Inject @@ -744,8 +743,7 @@ public abstract class RSClientMixin implements RSClient return null; } - RSNameable[] nameables = friendContainer.getNameables(); - return (Friend[]) nameables; + return friendContainer.getNameables(); } @Inject @@ -783,8 +781,7 @@ public abstract class RSClientMixin implements RSClient return null; } - RSNameable[] nameables = ignoreContainer.getNameables(); - return (Ignore[]) nameables; + return ignoreContainer.getNameables(); } @Inject diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClanMemberManager.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClanMemberManager.java index 1247b940d5..2f2cd6781a 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClanMemberManager.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClanMemberManager.java @@ -24,7 +24,7 @@ */ package net.runelite.rs.api; -public interface RSClanMemberManager extends RSNameableContainer +public interface RSClanMemberManager extends RSNameableContainer { } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSFriendContainer.java b/runescape-api/src/main/java/net/runelite/rs/api/RSFriendContainer.java index 165730c323..2b3793f478 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSFriendContainer.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSFriendContainer.java @@ -24,6 +24,6 @@ */ package net.runelite.rs.api; -public interface RSFriendContainer extends RSNameableContainer +public interface RSFriendContainer extends RSNameableContainer { } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSIgnoreContainer.java b/runescape-api/src/main/java/net/runelite/rs/api/RSIgnoreContainer.java index 350a3b083e..74fb4d5f37 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSIgnoreContainer.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSIgnoreContainer.java @@ -24,6 +24,6 @@ */ package net.runelite.rs.api; -public interface RSIgnoreContainer extends RSNameableContainer +public interface RSIgnoreContainer extends RSNameableContainer { } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java b/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java index 4c0fe5c77a..18494e5a79 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java @@ -26,13 +26,13 @@ package net.runelite.rs.api; import net.runelite.mapping.Import; -public interface RSNameableContainer +public interface RSNameableContainer { @Import("count") int getCount(); @Import("nameables") - RSNameable[] getNameables(); + T[] getNameables(); @Import("isMember") boolean isMember(RSName var1); From ff43e3954a6e40d32af7168b23c05236fd93114c Mon Sep 17 00:00:00 2001 From: Chives Date: Sat, 2 Mar 2019 15:59:59 -0800 Subject: [PATCH 182/304] Remove Monkey Madness I requirement from Kourend Diary. Creating the tablet does not require quest completion. --- .../achievementdiary/diaries/KourendDiaryRequirement.java | 1 - 1 file changed, 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java index 951ce3a48b..182b288a3b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java @@ -128,7 +128,6 @@ public class KourendDiaryRequirement extends GenericDiaryRequirement new SkillRequirement(Skill.MAGIC, 90), new SkillRequirement(Skill.MINING, 38), new SkillRequirement(Skill.CRAFTING, 38), - new QuestRequirement(Quest.MONKEY_MADNESS_I), new FavourRequirement(Favour.ARCEUUS, 100)); add("Create your own Battlestaff from scratch within the Farming Guild.", new SkillRequirement(Skill.FARMING, 85), From 616b604adf76c3c2f10242e7e2c79cf75a4e13ec Mon Sep 17 00:00:00 2001 From: Shaun Dreclin Date: Sat, 2 Mar 2019 22:25:50 -0500 Subject: [PATCH 183/304] rogues den: Update plugin to use ItemContainerChanged event --- .../plugins/roguesden/RoguesDenPlugin.java | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenPlugin.java index b7e8b682b0..9a3908f7d3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Shaun Dreclin + * Copyright (c) 2018-2019, Shaun Dreclin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,7 +24,6 @@ */ package net.runelite.client.plugins.roguesden; -import java.time.temporal.ChronoUnit; import java.util.HashMap; import javax.inject.Inject; import lombok.AccessLevel; @@ -33,8 +32,7 @@ import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.InventoryID; import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import static net.runelite.api.ItemID.MYSTIC_JEWEL; +import net.runelite.api.ItemID; import net.runelite.api.Tile; import net.runelite.api.TileObject; import net.runelite.api.events.GameObjectChanged; @@ -44,10 +42,10 @@ import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GroundObjectChanged; import net.runelite.api.events.GroundObjectDespawned; import net.runelite.api.events.GroundObjectSpawned; +import net.runelite.api.events.ItemContainerChanged; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.task.Schedule; import net.runelite.client.ui.overlay.OverlayManager; @PluginDescriptor( @@ -90,29 +88,24 @@ public class RoguesDenPlugin extends Plugin hasGem = false; } - @Schedule(period = 600, unit = ChronoUnit.MILLIS) - public void checkGem() + @Subscribe + public void onItemContainerChanged(ItemContainerChanged event) { - hasGem = hasGem(); - } - - private boolean hasGem() - { - ItemContainer container = client.getItemContainer(InventoryID.INVENTORY); - if (container == null) + if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)) { - return false; + return; } - for (Item item : container.getItems()) + for (Item item : event.getItemContainer().getItems()) { - if (item.getId() == MYSTIC_JEWEL) + if (item.getId() == ItemID.MYSTIC_JEWEL) { - return true; + hasGem = true; + return; } } - return false; + hasGem = false; } @Subscribe From ed764bd3bed049a41749423941c0ac23d0b6de12 Mon Sep 17 00:00:00 2001 From: chivesrs Date: Sun, 3 Mar 2019 01:36:18 -0800 Subject: [PATCH 184/304] Update CheckStyle XML dtd link to one that exists (#8079) --- checkstyle.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/checkstyle.xml b/checkstyle.xml index aa3bf946e4..e8669a742c 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -23,8 +23,9 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + From efa141cf862c4b8e747a3f66b0f4d53ceee864ef Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 3 Mar 2019 11:04:14 +0100 Subject: [PATCH 185/304] Update suppressions.xml dtd link to one that exists Signed-off-by: Tomas Slusny --- suppressions.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/suppressions.xml b/suppressions.xml index 5c940d0c48..7a6d858208 100644 --- a/suppressions.xml +++ b/suppressions.xml @@ -24,9 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> + "-//Checkstyle//DTD SuppressionFilter Configuration 1.1//EN" + "https://checkstyle.org/dtds/suppressions_1_1.dtd"> - - + + From 615a9db968fa268293fa14f634aa3347074976a3 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 3 Mar 2019 14:28:33 -0500 Subject: [PATCH 186/304] xptracker: remove unused exception --- .../client/plugins/xptracker/XpInfoBox.java | 3 +-- .../client/plugins/xptracker/XpPanel.java | 16 ++++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java index f5987290eb..512be6d12e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java @@ -28,7 +28,6 @@ package net.runelite.client.plugins.xptracker; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; @@ -95,7 +94,7 @@ class XpInfoBox extends JPanel private boolean paused = false; - XpInfoBox(XpTrackerPlugin xpTrackerPlugin, XpTrackerConfig xpTrackerConfig, Client client, JPanel panel, Skill skill, SkillIconManager iconManager) throws IOException + XpInfoBox(XpTrackerPlugin xpTrackerPlugin, XpTrackerConfig xpTrackerConfig, Client client, JPanel panel, Skill skill, SkillIconManager iconManager) { this.xpTrackerConfig = xpTrackerConfig; this.panel = panel; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java index e98f4da4f7..4a92d91cfa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java @@ -27,7 +27,6 @@ package net.runelite.client.plugins.xptracker; import java.awt.BorderLayout; import java.awt.GridLayout; -import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.swing.BoxLayout; @@ -129,20 +128,13 @@ class XpPanel extends PluginPanel layoutPanel.add(overallPanel); layoutPanel.add(infoBoxPanel); - try + for (Skill skill : Skill.values()) { - for (Skill skill : Skill.values()) + if (skill == Skill.OVERALL) { - if (skill == Skill.OVERALL) - { - break; - } - infoBoxes.put(skill, new XpInfoBox(xpTrackerPlugin, xpTrackerConfig, client, infoBoxPanel, skill, iconManager)); + break; } - } - catch (IOException e) - { - log.warn(null, e); + infoBoxes.put(skill, new XpInfoBox(xpTrackerPlugin, xpTrackerConfig, client, infoBoxPanel, skill, iconManager)); } errorPanel.setContent("Exp trackers", "You have not gained experience yet."); From 319ccb68e4bc099cf394df499d94f5657e3480ef Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 3 Mar 2019 13:29:52 -0500 Subject: [PATCH 187/304] xptracker: use tracked overall xpstate to calculate total xp --- .../client/plugins/xptracker/XpPanel.java | 9 ++- .../plugins/xptracker/XpSnapshotTotal.java | 39 ------------- .../client/plugins/xptracker/XpState.java | 26 +++------ .../plugins/xptracker/XpStateTotal.java | 55 ------------------- .../plugins/xptracker/XpTrackerPlugin.java | 21 ++++--- 5 files changed, 27 insertions(+), 123 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpSnapshotTotal.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateTotal.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java index 4a92d91cfa..c7bf7c3876 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java @@ -185,7 +185,7 @@ class XpPanel extends PluginPanel } } - void updateTotal(XpSnapshotTotal xpSnapshotTotal) + void updateTotal(XpSnapshotSingle xpSnapshotTotal) { // if player has gained exp and hasn't switched displays yet, hide error panel and show overall info if (xpSnapshotTotal.getXpGainedInSession() > 0 && !overallPanel.isVisible()) @@ -193,11 +193,16 @@ class XpPanel extends PluginPanel overallPanel.setVisible(true); remove(errorPanel); } + else if (xpSnapshotTotal.getXpGainedInSession() == 0 && overallPanel.isVisible()) + { + overallPanel.setVisible(false); + add(errorPanel); + } SwingUtilities.invokeLater(() -> rebuildAsync(xpSnapshotTotal)); } - private void rebuildAsync(XpSnapshotTotal xpSnapshotTotal) + private void rebuildAsync(XpSnapshotSingle xpSnapshotTotal) { overallExpGained.setText(XpInfoBox.htmlLabel("Gained: ", xpSnapshotTotal.getXpGainedInSession())); overallExpHour.setText(XpInfoBox.htmlLabel("Per hour: ", xpSnapshotTotal.getXpPerHour())); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpSnapshotTotal.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpSnapshotTotal.java deleted file mode 100644 index 72fcdd93d5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpSnapshotTotal.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Levi - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.xptracker; - -import lombok.Value; - -@Value -class XpSnapshotTotal -{ - private final int xpGainedInSession; - private final int xpPerHour; - - static XpSnapshotTotal zero() - { - return new XpSnapshotTotal(0, 0); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java index a0ebb02341..b12decc9c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java @@ -40,7 +40,6 @@ class XpState { private static final double DEFAULT_XP_MODIFIER = 4.0; private static final double SHARED_XP_MODIFIER = DEFAULT_XP_MODIFIER / 3.0; - private final XpStateTotal xpTotal = new XpStateTotal(); private final Map xpSkills = new EnumMap<>(Skill.class); private NPC interactedNPC; @@ -49,7 +48,6 @@ class XpState */ void reset() { - xpTotal.reset(); xpSkills.clear(); } @@ -62,21 +60,6 @@ class XpState { xpSkills.remove(skill); xpSkills.put(skill, new XpStateSingle(skill, currentXp)); - recalculateTotal(); - } - - /** - * Calculates the total skill changes observed in this session or since the last reset - */ - void recalculateTotal() - { - xpTotal.reset(); - - for (XpStateSingle state : xpSkills.values()) - { - xpTotal.addXpGainedInSession(state.getXpGained()); - xpTotal.addXpPerHour(state.getXpHr()); - } } /** @@ -213,6 +196,11 @@ class XpState xpSkills.put(skill, new XpStateSingle(skill, currentXp)); } + boolean isInitialized(Skill skill) + { + return xpSkills.containsKey(skill); + } + @NonNull XpStateSingle getSkill(Skill skill) { @@ -237,8 +225,8 @@ class XpState * @return An immutable snapshot of total information for this session since first login or last reset */ @NonNull - XpSnapshotTotal getTotalSnapshot() + XpSnapshotSingle getTotalSnapshot() { - return xpTotal.snapshot(); + return getSkill(Skill.OVERALL).snapshot(); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateTotal.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateTotal.java deleted file mode 100644 index ad9492981c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateTotal.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Levi - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.xptracker; - -import lombok.Data; - -@Data -class XpStateTotal -{ - private int xpGainedInSession = 0; - private int xpPerHour = 0; - - void reset() - { - xpGainedInSession = 0; - xpPerHour = 0; - } - - void addXpGainedInSession(int skillXpGainedInSession) - { - xpGainedInSession += skillXpGainedInSession; - } - - void addXpPerHour(int skillXpGainedPerHour) - { - xpPerHour += skillXpGainedPerHour; - } - - XpSnapshotTotal snapshot() - { - return new XpSnapshotTotal(xpGainedInSession, xpPerHour); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java index bb43ffdd7a..5930584377 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java @@ -242,7 +242,7 @@ public class XpTrackerPlugin extends Plugin { xpState.reset(); xpPanel.resetAllInfoBoxes(); - xpPanel.updateTotal(XpSnapshotTotal.zero()); + xpPanel.updateTotal(new XpSnapshotSingle.XpSnapshotSingleBuilder().build()); } /** @@ -254,7 +254,6 @@ public class XpTrackerPlugin extends Plugin { int currentXp = client.getSkillExperience(skill); xpState.resetSkill(skill, currentXp); - xpState.recalculateTotal(); xpPanel.resetSkill(skill); xpPanel.updateTotal(xpState.getTotalSnapshot()); } @@ -302,10 +301,18 @@ public class XpTrackerPlugin extends Plugin } final XpUpdateResult updateResult = xpState.updateSkill(skill, currentXp, startGoalXp, endGoalXp); - final boolean updated = XpUpdateResult.UPDATED.equals(updateResult); - xpPanel.updateSkillExperience(updated, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill)); - xpState.recalculateTotal(); - xpPanel.updateTotal(xpState.getTotalSnapshot()); + xpPanel.updateSkillExperience(updateResult == XpUpdateResult.UPDATED, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill)); + + if (skill == Skill.CONSTRUCTION && updateResult == XpUpdateResult.INITIALIZED) + { + // Construction is the last skill initialized on login, now initialize the total experience + xpState.initializeSkill(Skill.OVERALL, client.getSkillExperience(Skill.OVERALL)); + } + else if (xpState.isInitialized(Skill.OVERALL)) + { + xpState.updateSkill(Skill.OVERALL, client.getSkillExperience(Skill.OVERALL), -1, -1); + xpPanel.updateTotal(xpState.getTotalSnapshot()); + } } @Subscribe @@ -325,7 +332,6 @@ public class XpTrackerPlugin extends Plugin xpPanel.updateSkillExperience(updated, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill)); } - xpState.recalculateTotal(); xpPanel.updateTotal(xpState.getTotalSnapshot()); } @@ -498,7 +504,6 @@ public class XpTrackerPlugin extends Plugin xpPanel.updateSkillExperience(false, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill)); } - xpState.recalculateTotal(); xpPanel.updateTotal(xpState.getTotalSnapshot()); } From 188bb70417ff5def01262211208b6a1d086dbcc6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 3 Mar 2019 14:40:07 -0500 Subject: [PATCH 188/304] xptracker: use long for tracking overall xp --- .../main/java/net/runelite/api/Client.java | 7 +++ .../plugins/xptracker/XpPauseState.java | 2 +- .../plugins/xptracker/XpPauseStateSingle.java | 4 +- .../client/plugins/xptracker/XpState.java | 8 +-- .../plugins/xptracker/XpStateSingle.java | 53 ++++++++++--------- .../plugins/xptracker/XpTrackerPlugin.java | 41 ++++++++------ .../net/runelite/mixins/RSClientMixin.java | 26 ++++++--- 7 files changed, 85 insertions(+), 56 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 4c44c7e3ef..e3f29e8041 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -782,6 +782,13 @@ public interface Client extends GameEngine */ int getSkillExperience(Skill skill); + /** + * Get the total experience of the player + * + * @return + */ + long getOverallExperience(); + /** * Gets the game drawing mode. * diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseState.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseState.java index 9f57de71c3..194c890c42 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseState.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseState.java @@ -49,7 +49,7 @@ class XpPauseState return findPauseState(skill).isPaused(); } - void tickXp(Skill skill, int currentXp, int pauseAfterMinutes) + void tickXp(Skill skill, long currentXp, int pauseAfterMinutes) { final XpPauseStateSingle state = findPauseState(skill); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseStateSingle.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseStateSingle.java index d74d498bd1..9e5cc55622 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseStateSingle.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseStateSingle.java @@ -39,7 +39,7 @@ class XpPauseStateSingle @Getter private long lastChangeMillis; @Getter - private int xp; + private long xp; boolean isPaused() { @@ -66,7 +66,7 @@ class XpPauseStateSingle return pauseReasons.add(XpPauseReason.PAUSE_MANUAL); } - boolean xpChanged(int xp) + boolean xpChanged(long xp) { this.xp = xp; this.lastChangeMillis = System.currentTimeMillis(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java index b12decc9c2..d6a10df1b8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java @@ -56,7 +56,7 @@ class XpState * @param skill Skill to reset * @param currentXp Current XP to set to, if unknown set to -1 */ - void resetSkill(Skill skill, int currentXp) + void resetSkill(Skill skill, long currentXp) { xpSkills.remove(skill); xpSkills.put(skill, new XpStateSingle(skill, currentXp)); @@ -73,7 +73,7 @@ class XpState * @param goalEndXp Possible XP end goal * @return Whether or not the skill has been initialized, there was no change, or it has been updated */ - XpUpdateResult updateSkill(Skill skill, int currentXp, int goalStartXp, int goalEndXp) + XpUpdateResult updateSkill(Skill skill, long currentXp, int goalStartXp, int goalEndXp) { XpStateSingle state = getSkill(skill); @@ -91,7 +91,7 @@ class XpState } else { - int startXp = state.getStartXp(); + long startXp = state.getStartXp(); int gainedXp = state.getXpGained(); if (startXp + gainedXp > currentXp) @@ -191,7 +191,7 @@ class XpState * @param skill Skill to initialize * @param currentXp Current known XP for the skill */ - void initializeSkill(Skill skill, int currentXp) + void initializeSkill(Skill skill, long currentXp) { xpSkills.put(skill, new XpStateSingle(skill, currentXp)); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateSingle.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateSingle.java index 7f4eef8d1c..2b6c694ba1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateSingle.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateSingle.java @@ -42,7 +42,7 @@ class XpStateSingle private final Map actions = new HashMap<>(); @Getter - private final int startXp; + private final long startXp; @Getter private int xpGained = 0; @@ -60,7 +60,7 @@ class XpStateSingle return actions.get(type); } - private int getCurrentXp() + private long getCurrentXp() { return startXp + xpGained; } @@ -86,7 +86,7 @@ class XpStateSingle private int getXpRemaining() { - return endLevelExp - getCurrentXp(); + return endLevelExp - (int) getCurrentXp(); } private int getActionsRemaining() @@ -170,7 +170,7 @@ class XpStateSingle return toHourly(xpGained); } - boolean update(int currentXp, int goalStartXp, int goalEndXp) + boolean update(long currentXp, int goalStartXp, int goalEndXp) { if (startXp == -1) { @@ -178,8 +178,8 @@ class XpStateSingle return false; } - int originalXp = xpGained + startXp; - int actionExp = currentXp - originalXp; + long originalXp = xpGained + startXp; + int actionExp = (int) (currentXp - originalXp); // No experience gained if (actionExp == 0) @@ -210,28 +210,31 @@ class XpStateSingle action.setActions(action.getActions() + 1); // Calculate experience gained - xpGained = currentXp - startXp; + xpGained = (int) (currentXp - startXp); - // Determine XP goals - if (goalStartXp <= 0 || currentXp > goalEndXp) + // Determine XP goals, overall has no goals + if (skill != Skill.OVERALL) { - startLevelExp = Experience.getXpForLevel(Experience.getLevelForXp(currentXp)); - } - else - { - startLevelExp = goalStartXp; - } + if (goalStartXp <= 0 || currentXp > goalEndXp) + { + startLevelExp = Experience.getXpForLevel(Experience.getLevelForXp((int) currentXp)); + } + else + { + startLevelExp = goalStartXp; + } - if (goalEndXp <= 0 || currentXp > goalEndXp) - { - int currentLevel = Experience.getLevelForXp(currentXp); - endLevelExp = currentLevel + 1 <= Experience.MAX_VIRT_LEVEL - ? Experience.getXpForLevel(currentLevel + 1) - : Experience.MAX_SKILL_XP; - } - else - { - endLevelExp = goalEndXp; + if (goalEndXp <= 0 || currentXp > goalEndXp) + { + int currentLevel = Experience.getLevelForXp((int) currentXp); + endLevelExp = currentLevel + 1 <= Experience.MAX_VIRT_LEVEL + ? Experience.getXpForLevel(currentLevel + 1) + : Experience.MAX_SKILL_XP; + } + else + { + endLevelExp = goalEndXp; + } } return true; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java index 5930584377..c66c409a16 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java @@ -146,16 +146,6 @@ public class XpTrackerPlugin extends Plugin clientToolbar.removeNavigation(navButton); } - private long getTotalXp() - { - long total = 0; - for (Skill skill : Skill.values()) - { - total += client.getSkillExperience(skill); - } - return total; - } - @Subscribe public void onGameStateChanged(GameStateChanged event) { @@ -195,7 +185,7 @@ public class XpTrackerPlugin extends Plugin return; } - long totalXp = getTotalXp(); + long totalXp = client.getOverallExperience(); // Don't submit xptrack unless xp threshold is reached if (Math.abs(totalXp - lastXp) > XP_THRESHOLD) { @@ -229,7 +219,16 @@ public class XpTrackerPlugin extends Plugin for (Skill skill : Skill.values()) { - int currentXp = client.getSkillExperience(skill); + long currentXp; + if (skill == Skill.OVERALL) + { + currentXp = client.getOverallExperience(); + } + else + { + currentXp = client.getSkillExperience(skill); + } + xpState.initializeSkill(skill, currentXp); } } @@ -306,11 +305,11 @@ public class XpTrackerPlugin extends Plugin if (skill == Skill.CONSTRUCTION && updateResult == XpUpdateResult.INITIALIZED) { // Construction is the last skill initialized on login, now initialize the total experience - xpState.initializeSkill(Skill.OVERALL, client.getSkillExperience(Skill.OVERALL)); + xpState.initializeSkill(Skill.OVERALL, client.getOverallExperience()); } else if (xpState.isInitialized(Skill.OVERALL)) { - xpState.updateSkill(Skill.OVERALL, client.getSkillExperience(Skill.OVERALL), -1, -1); + xpState.updateSkill(Skill.OVERALL, client.getOverallExperience(), -1, -1); xpPanel.updateTotal(xpState.getTotalSnapshot()); } } @@ -341,7 +340,7 @@ public class XpTrackerPlugin extends Plugin rebuildSkills(); if (fetchXp) { - lastXp = getTotalXp(); + lastXp = client.getOverallExperience(); fetchXp = false; } } @@ -470,7 +469,17 @@ public class XpTrackerPlugin extends Plugin // Adjust unpause states for (Skill skill : Skill.values()) { - xpPauseState.tickXp(skill, client.getSkillExperience(skill), xpTrackerConfig.pauseSkillAfter()); + long skillExperience; + if (skill == Skill.OVERALL) + { + skillExperience = client.getOverallExperience(); + } + else + { + skillExperience = client.getSkillExperience(skill); + } + + xpPauseState.tickXp(skill, skillExperience, xpTrackerConfig.pauseSkillAfter()); } xpPauseState.tickLogout(xpTrackerConfig.pauseOnLogout(), !GameState.LOGIN_SCREEN.equals(client.getGameState())); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 7cfef3985c..e2dc26702e 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -504,14 +504,8 @@ public abstract class RSClientMixin implements RSClient if (skill == Skill.OVERALL) { - int totalExperience = 0; - - for (int experience : experiences) - { - totalExperience += experience; - } - - return totalExperience; + logger.debug("getSkillExperience called for {}!", skill); + return (int) getOverallExperience(); } int idx = skill.ordinal(); @@ -526,6 +520,22 @@ public abstract class RSClientMixin implements RSClient return experiences[idx]; } + @Inject + @Override + public long getOverallExperience() + { + int[] experiences = getSkillExperiences(); + + long totalExperience = 0L; + + for (int experience : experiences) + { + totalExperience += experience; + } + + return totalExperience; + } + @Inject @Override public void refreshChat() From 24003c69a7872ca0b2a7e5a5004d30141237eb79 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 2 Mar 2019 18:58:40 -0500 Subject: [PATCH 189/304] api: add method to remove MessageNodes Co-authored-by: trimbe --- .../java/net/runelite/api/ChatLineBuffer.java | 7 ++ .../mixins/RSChatLineBufferMixin.java | 72 +++++++++++++++++++ .../net/runelite/rs/api/RSCacheableNode.java | 4 ++ .../net/runelite/rs/api/RSChatLineBuffer.java | 3 + 4 files changed, 86 insertions(+) create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSChatLineBufferMixin.java diff --git a/runelite-api/src/main/java/net/runelite/api/ChatLineBuffer.java b/runelite-api/src/main/java/net/runelite/api/ChatLineBuffer.java index 22a15743f3..a1f8a7e056 100644 --- a/runelite-api/src/main/java/net/runelite/api/ChatLineBuffer.java +++ b/runelite-api/src/main/java/net/runelite/api/ChatLineBuffer.java @@ -44,4 +44,11 @@ public interface ChatLineBuffer * @return the length */ int getLength(); + + /** + * Removes a message node + * + * @param node the {@link MessageNode} to remove + */ + void removeMessageNode(MessageNode node); } \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSChatLineBufferMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSChatLineBufferMixin.java new file mode 100644 index 0000000000..6b720a26f8 --- /dev/null +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSChatLineBufferMixin.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2018, trimbe + * Copyright (c) 2018, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.mixins; + +import net.runelite.api.MessageNode; +import net.runelite.api.mixins.Inject; +import net.runelite.api.mixins.Mixin; +import net.runelite.rs.api.RSCacheableNode; +import net.runelite.rs.api.RSChatLineBuffer; + +@Mixin(RSChatLineBuffer.class) +public abstract class RSChatLineBufferMixin implements RSChatLineBuffer +{ + @Inject + @Override + public void removeMessageNode(MessageNode node) + { + MessageNode[] lines = getLines(); + final int length = getLength(); + int found = -1; + + // Find the index of the node + for (int idx = 0; idx < length; idx++) + { + if (lines[idx] == node) + { + found = idx; + break; + } + } + + if (found == -1) + { + return; + } + + // Shift down all other messages + for (int i = found; i < length - 1; i++) + { + lines[i] = lines[i + 1]; + } + lines[length - 1] = null; + setLength(length - 1); + + RSCacheableNode rsCacheableNode = (RSCacheableNode) node; + rsCacheableNode.unlink(); + rsCacheableNode.unlinkDual(); + } +} diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSCacheableNode.java b/runescape-api/src/main/java/net/runelite/rs/api/RSCacheableNode.java index f443f11425..44d7b876cc 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSCacheableNode.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSCacheableNode.java @@ -24,6 +24,10 @@ */ package net.runelite.rs.api; +import net.runelite.mapping.Import; + public interface RSCacheableNode extends RSNode { + @Import("unlinkDual") + void unlinkDual(); } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSChatLineBuffer.java b/runescape-api/src/main/java/net/runelite/rs/api/RSChatLineBuffer.java index fa2a798cdd..9aa9b35c3b 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSChatLineBuffer.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSChatLineBuffer.java @@ -39,4 +39,7 @@ public interface RSChatLineBuffer extends ChatLineBuffer @Import("length") @Override int getLength(); + + @Import("length") + void setLength(int length); } \ No newline at end of file From facf438b5086ef8c2b0a042d50d1dcdff0e7ed24 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 2 Mar 2019 18:59:05 -0500 Subject: [PATCH 190/304] api: add clan member join and leave events Co-authored-by: trimbe --- .../runelite/api/events/ClanMemberJoined.java | 36 ++++++++++ .../runelite/api/events/ClanMemberLeft.java | 36 ++++++++++ .../mixins/RSClanMemberManagerMixin.java | 58 +++++++++++++++ .../mixins/RSNameableContainerMixin.java | 72 +++++++++++++++++++ .../runelite/rs/api/RSNameableContainer.java | 13 ++++ 5 files changed, 215 insertions(+) create mode 100644 runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java create mode 100644 runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSNameableContainerMixin.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java new file mode 100644 index 0000000000..b8e50c6296 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018, trimbe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.events; + +import lombok.Value; + +@Value +public class ClanMemberJoined +{ + /** + * Name of the player who joined + */ + private String name; +} diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java new file mode 100644 index 0000000000..6eb269dd6d --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018, trimbe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.events; + +import lombok.Value; + +@Value +public class ClanMemberLeft +{ + /** + * Name of the player who left + */ + private String name; +} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java new file mode 100644 index 0000000000..b4c71dec2a --- /dev/null +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018, trimbe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.mixins; + +import net.runelite.api.events.ClanMemberJoined; +import net.runelite.api.events.ClanMemberLeft; +import net.runelite.api.mixins.Inject; +import net.runelite.api.mixins.Mixin; +import net.runelite.api.mixins.Shadow; +import net.runelite.rs.api.RSClanMemberManager; +import net.runelite.rs.api.RSClient; +import net.runelite.rs.api.RSName; +import net.runelite.rs.api.RSNameable; + +@Mixin(RSClanMemberManager.class) +public abstract class RSClanMemberManagerMixin implements RSClanMemberManager +{ + @Shadow("clientInstance") + private static RSClient client; + + @Inject + @Override + public void rl$add(RSName name, RSName prevName) + { + ClanMemberJoined event = new ClanMemberJoined(name.getName()); + client.getCallbacks().post(event); + } + + @Inject + @Override + public void rl$remove(RSNameable nameable) + { + ClanMemberLeft event = new ClanMemberLeft(nameable.getRsName().getName()); + client.getCallbacks().post(event); + } +} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableContainerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableContainerMixin.java new file mode 100644 index 0000000000..8a3a1492e0 --- /dev/null +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNameableContainerMixin.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2018, trimbe + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.mixins; + +import net.runelite.api.mixins.Inject; +import net.runelite.api.mixins.MethodHook; +import net.runelite.api.mixins.Mixin; +import net.runelite.rs.api.RSName; +import net.runelite.rs.api.RSNameable; +import net.runelite.rs.api.RSNameableContainer; + +@Mixin(RSNameableContainer.class) +public abstract class RSNameableContainerMixin implements RSNameableContainer +{ + /** + * Default implementation of rl$add + * @param name + * @param prevName + */ + @Inject + @Override + public void rl$add(RSName name, RSName prevName) + { + } + + /** + * Default implementation of rl$del + * @param nameable + */ + @Inject + @Override + public void rl$remove(RSNameable nameable) + { + } + + @Inject + @MethodHook(value = "add", end = true) + public void add(RSName name, RSName prevName) + { + rl$add(name, prevName); + } + + @Inject + @MethodHook("remove") + public void remove(RSNameable nameable) + { + rl$remove(nameable); + } +} diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java b/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java index 18494e5a79..82fb52d9d4 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java @@ -36,4 +36,17 @@ public interface RSNameableContainer @Import("isMember") boolean isMember(RSName var1); + + /** + * Method called by the container when an element is added + * @param name + * @param prevName + */ + void rl$add(RSName name, RSName prevName); + + /** + * Method called by the container when an element is removed + * @param nameable + */ + void rl$remove(RSNameable nameable); } From e5f9db4fb4f7d85309a0b8b60e2bf11e8e5dc28e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 2 Mar 2019 18:59:13 -0500 Subject: [PATCH 191/304] api: add methods to get clan owner and chat name Co-authored-by: trimbe --- .../src/main/java/net/runelite/api/Client.java | 14 ++++++++++++++ .../java/net/runelite/mixins/RSClientMixin.java | 14 ++++++++++++++ .../net/runelite/rs/api/RSClanMemberManager.java | 6 ++++++ 3 files changed, 34 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 4c44c7e3ef..fa7a54ee55 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1055,6 +1055,20 @@ public interface Client extends GameEngine */ ClanMember[] getClanMembers(); + /** + * Gets the clan owner of the currently joined clan chat + * + * @return + */ + String getClanOwner(); + + /** + * Gets the clan chat name of the currently joined clan chat + * + * @return + */ + String getClanChatName(); + /** * Gets an array of players in the friends list. * diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 7cfef3985c..9b232aa760 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -727,6 +727,20 @@ public abstract class RSClientMixin implements RSClient return clanMemberManager != null ? getClanMemberManager().getNameables() : null; } + @Inject + @Override + public String getClanOwner() + { + return getClanMemberManager().getClanOwner(); + } + + @Inject + @Override + public String getClanChatName() + { + return getClanMemberManager().getClanChatName(); + } + @Inject @Override public Friend[] getFriends() diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClanMemberManager.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClanMemberManager.java index 2f2cd6781a..36a486c28b 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClanMemberManager.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClanMemberManager.java @@ -24,7 +24,13 @@ */ package net.runelite.rs.api; +import net.runelite.mapping.Import; + public interface RSClanMemberManager extends RSNameableContainer { + @Import("clanOwner") + String getClanOwner(); + @Import("clanChatName") + String getClanChatName(); } From fdbe75a48680829ac074cfa7d25f8d2017a917e7 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 2 Mar 2019 18:59:21 -0500 Subject: [PATCH 192/304] clanchat plugin: add join/leave messages Co-authored-by: trimbe --- .../main/java/net/runelite/api/ScriptID.java | 5 + .../plugins/clanchat/ClanActivityType.java | 31 +++ .../plugins/clanchat/ClanChatConfig.java | 32 ++- .../plugins/clanchat/ClanChatPlugin.java | 188 ++++++++++++++++++ .../plugins/clanchat/ClanJoinMessage.java | 36 ++++ .../plugins/clanchat/ClanMemberActivity.java | 37 ++++ .../net/runelite/client/ui/JagexColors.java | 4 +- 7 files changed, 329 insertions(+), 4 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanActivityType.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanJoinMessage.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index 05c057a38d..6ac6aa42bb 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -45,6 +45,11 @@ public final class ScriptID */ public static final int CHATBOX_INPUT = 96; + /** + * Rebuilds the chatbox + */ + public static final int BUILD_CHATBOX = 216; + /** * Opens the Private Message chat interface * diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanActivityType.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanActivityType.java new file mode 100644 index 0000000000..86cc5e60a5 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanActivityType.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018, trimbe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.clanchat; + +enum ClanActivityType +{ + JOINED, + LEFT +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java index 6a8000391c..cfddcb84a5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.clanchat; +import net.runelite.api.ClanMemberRank; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @@ -34,7 +35,8 @@ public interface ClanChatConfig extends Config @ConfigItem( keyName = "clanChatIcons", name = "Clan Chat Icons", - description = "Show clan chat icons next to clan members." + description = "Show clan chat icons next to clan members.", + position = 1 ) default boolean clanChatIcons() { @@ -44,7 +46,8 @@ public interface ClanChatConfig extends Config @ConfigItem( keyName = "recentChats", name = "Recent Chats", - description = "Show recent clan chats." + description = "Show recent clan chats.", + position = 2 ) default boolean recentChats() { @@ -54,7 +57,8 @@ public interface ClanChatConfig extends Config @ConfigItem( keyName = "clanCounter", name = "Clan Members Counter", - description = "Show the amount of clan members near you." + description = "Show the amount of clan members near you.", + position = 3 ) default boolean showClanCounter() { @@ -78,4 +82,26 @@ public interface ClanChatConfig extends Config description = "" ) void chatsData(String str); + + @ConfigItem( + keyName = "showJoinLeave", + name = "Show Join/Leave", + description = "Adds a temporary message notifying when a member joins or leaves.", + position = 4 + ) + default boolean showJoinLeave() + { + return false; + } + + @ConfigItem( + keyName = "joinLeaveRank", + name = "Join/Leave rank", + description = "Only show join/leave messages for members at or above this rank.", + position = 5 + ) + default ClanMemberRank joinLeaveRank() + { + return ClanMemberRank.UNRANKED; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index 2b99092397..3e57a0723f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -1,5 +1,7 @@ /* * Copyright (c) 2017, Devin French + * Copyright (c) 2019, Adam + * Copyright (c) 2018, trimbe * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,19 +29,31 @@ package net.runelite.client.plugins.clanchat; import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.inject.Provides; +import java.awt.Color; import java.awt.image.BufferedImage; +import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.Deque; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import javax.inject.Inject; +import net.runelite.api.ChatLineBuffer; import net.runelite.api.ChatMessageType; import net.runelite.api.ClanMemberRank; import net.runelite.api.Client; import net.runelite.api.GameState; +import net.runelite.api.MessageNode; import net.runelite.api.Player; +import net.runelite.api.ScriptID; import net.runelite.api.SpriteID; import net.runelite.api.VarClientStr; +import net.runelite.api.Varbits; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ClanChanged; +import net.runelite.api.events.ClanMemberJoined; +import net.runelite.api.events.ClanMemberLeft; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; @@ -50,13 +64,19 @@ import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetType; import net.runelite.client.callback.ClientThread; +import net.runelite.client.chat.ChatMessageBuilder; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ClanManager; import net.runelite.client.game.SpriteManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; +import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_OPAQUE_BACKGROUND; +import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND; +import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND; +import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; +import net.runelite.client.util.ColorUtil; import net.runelite.client.util.Text; @PluginDescriptor( @@ -69,6 +89,8 @@ public class ClanChatPlugin extends Plugin private static final int MAX_CHATS = 10; private static final String CLAN_CHAT_TITLE = "Clan Chat"; private static final String RECENT_TITLE = "Recent Clan Chats"; + private static final int JOIN_LEAVE_DURATION = 20; + private static final int MESSAGE_DELAY = 10; @Inject private Client client; @@ -91,6 +113,12 @@ public class ClanChatPlugin extends Plugin private List chats = new ArrayList<>(); private List clanMembers = new ArrayList<>(); private ClanChatIndicator clanMemberCounter; + /** + * queue of temporary messages added to the client + */ + private final Deque clanJoinMessages = new ArrayDeque<>(); + private Map activityBuffer = new HashMap<>(); + private int clanJoinedTick; @Provides ClanChatConfig getConfig(ConfigManager configManager) @@ -133,6 +161,49 @@ public class ClanChatPlugin extends Plugin } } + @Subscribe + public void onClanMemberJoined(ClanMemberJoined event) + { + // clan members getting initialized isn't relevant + if (clanJoinedTick == client.getTickCount()) + { + return; + } + + if (!config.showJoinLeave() || + clanManager.getRank(event.getName()).getValue() < config.joinLeaveRank().getValue()) + { + return; + } + + // attempt to filter out world hopping joins + if (!activityBuffer.containsKey(event.getName())) + { + ClanMemberActivity joinActivity = new ClanMemberActivity(ClanActivityType.JOINED, + event.getName(), client.getTickCount()); + activityBuffer.put(event.getName(), joinActivity); + } + else + { + activityBuffer.remove(event.getName()); + } + } + + @Subscribe + public void onClanMemberLeft(ClanMemberLeft event) + { + if (!config.showJoinLeave() || + clanManager.getRank(event.getName()).getValue() < config.joinLeaveRank().getValue()) + { + return; + } + + ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT, + event.getName(), client.getTickCount()); + + activityBuffer.put(event.getName(), leaveActivity); + } + @Subscribe public void onGameTick(GameTick gameTick) { @@ -157,6 +228,112 @@ public class ClanChatPlugin extends Plugin loadClanChats(); } } + + if (!config.showJoinLeave()) + { + return; + } + + timeoutClanMessages(); + + addClanActivityMessages(); + } + + private void timeoutClanMessages() + { + if (clanJoinMessages.isEmpty()) + { + return; + } + + boolean removed = false; + + for (Iterator it = clanJoinMessages.iterator(); it.hasNext(); ) + { + ClanJoinMessage clanJoinMessage = it.next(); + MessageNode messageNode = clanJoinMessage.getMessageNode(); + final int createdTick = clanJoinMessage.getTick(); + + if (client.getTickCount() > createdTick + JOIN_LEAVE_DURATION) + { + it.remove(); + + // If this message has been reused since, it will get a different id + if (clanJoinMessage.getGetMessageId() == messageNode.getId()) + { + ChatLineBuffer ccInfoBuffer = client.getChatLineMap().get(ChatMessageType.CLANCHAT_INFO.getType()); + if (ccInfoBuffer != null) + { + ccInfoBuffer.removeMessageNode(messageNode); + removed = true; + } + } + } + else + { + // Everything else in the deque is newer + break; + } + } + + if (removed) + { + clientThread.invoke(() -> client.runScript(ScriptID.BUILD_CHATBOX)); + } + } + + private void addClanActivityMessages() + { + Iterator activityIt = activityBuffer.values().iterator(); + + while (activityIt.hasNext()) + { + ClanMemberActivity activity = activityIt.next(); + + if (activity.getTick() < client.getTickCount() - MESSAGE_DELAY) + { + activityIt.remove(); + addActivityMessage(activity.getMember(), activity.getActivityType()); + } + } + } + + private void addActivityMessage(String memberName, ClanActivityType activityType) + { + final String activityMessage = activityType == ClanActivityType.JOINED ? " has joined." : " has left."; + final ClanMemberRank rank = clanManager.getRank(memberName); + String rankTag = ""; + Color textColor = CHAT_CLAN_TEXT_OPAQUE_BACKGROUND; + Color channelColor = CHAT_CLAN_NAME_OPAQUE_BACKGROUND; + + if (client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1) + { + textColor = CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND; + channelColor = CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND; + } + + if (rank != null && rank != ClanMemberRank.UNRANKED) + { + int iconNumber = clanManager.getIconNumber(rank); + rankTag = " "; + } + + ChatMessageBuilder message = new ChatMessageBuilder(); + String messageString = message + .append("[") + .append(ColorUtil.wrapWithColorTag(client.getClanChatName(), channelColor) + rankTag) + .append("] ") + .append(ColorUtil.wrapWithColorTag(memberName + activityMessage, textColor)) + .build(); + + client.addChatMessage(ChatMessageType.CLANCHAT_INFO, "", messageString, ""); + + final ChatLineBuffer chatLineBuffer = client.getChatLineMap().get(ChatMessageType.CLANCHAT_INFO.getType()); + final MessageNode[] lines = chatLineBuffer.getLines(); + final MessageNode line = lines[0]; + + ClanJoinMessage clanJoinMessage = new ClanJoinMessage(line, line.getId(), client.getTickCount()); + clanJoinMessages.addLast(clanJoinMessage); } @Subscribe @@ -190,6 +367,13 @@ public class ClanChatPlugin extends Plugin clanMembers.clear(); removeClanCounter(); } + + if (state.getGameState() == GameState.LOGIN_SCREEN + || state.getGameState() == GameState.HOPPING + || state.getGameState() == GameState.CONNECTION_LOST) + { + clanJoinMessages.clear(); + } } @Subscribe @@ -216,6 +400,8 @@ public class ClanChatPlugin extends Plugin { if (event.isJoined()) { + clanJoinedTick = client.getTickCount(); + clientThread.invokeLater(() -> { for (Player player : client.getPlayers()) @@ -234,6 +420,8 @@ public class ClanChatPlugin extends Plugin clanMembers.clear(); removeClanCounter(); } + + activityBuffer.clear(); } int getClanAmount() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanJoinMessage.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanJoinMessage.java new file mode 100644 index 0000000000..8ac0b0069b --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanJoinMessage.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.clanchat; + +import lombok.Value; +import net.runelite.api.MessageNode; + +@Value +class ClanJoinMessage +{ + private final MessageNode messageNode; + private final int getMessageId; + private final int tick; +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java new file mode 100644 index 0000000000..f739437b15 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018, trimbe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.clanchat; + +import lombok.AllArgsConstructor; +import lombok.Value; + +@Value +@AllArgsConstructor +class ClanMemberActivity +{ + private ClanActivityType activityType; + private String member; + private Integer tick; +} diff --git a/runelite-client/src/main/java/net/runelite/client/ui/JagexColors.java b/runelite-client/src/main/java/net/runelite/client/ui/JagexColors.java index 7e2faadfad..ac5fbeed6f 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/JagexColors.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/JagexColors.java @@ -37,6 +37,7 @@ public class JagexColors public static final Color CHAT_PUBLIC_TEXT_OPAQUE_BACKGROUND = Color.BLUE; public static final Color CHAT_PRIVATE_MESSAGE_TEXT_OPAQUE_BACKGROUND = Color.CYAN; public static final Color CHAT_CLAN_TEXT_OPAQUE_BACKGROUND = new Color(127, 0, 0); + public static final Color CHAT_CLAN_NAME_OPAQUE_BACKGROUND = Color.BLUE; public static final Color CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND = Color.BLACK; public static final Color CHAT_TYPED_TEXT_OPAQUE_BACKGROUND = Color.BLUE; @@ -45,7 +46,8 @@ public class JagexColors */ public static final Color CHAT_PUBLIC_TEXT_TRANSPARENT_BACKGROUND = new Color(144, 144, 255); public static final Color CHAT_PRIVATE_MESSAGE_TEXT_TRANSPARENT_BACKGROUND = Color.CYAN; - public static final Color CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND = new Color(127, 0, 0); + public static final Color CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND = new Color(239, 80, 80); + public static final Color CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND = new Color(144, 112, 255); public static final Color CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND = Color.WHITE; public static final Color CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND = new Color(144, 144, 255); From 2d66f86ca077bdcf678bc82318c4e1022a40c8c8 Mon Sep 17 00:00:00 2001 From: Chives Date: Sun, 3 Mar 2019 17:09:36 -0800 Subject: [PATCH 193/304] Replace assert keyword with JUnit assert functions --- .../runelite/client/util/ColorUtilTest.java | 14 +- .../runelite/client/util/ImageUtilTest.java | 134 +++++++++--------- 2 files changed, 76 insertions(+), 72 deletions(-) diff --git a/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java b/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java index 3697dac28c..43134d4f3f 100644 --- a/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java +++ b/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java @@ -28,6 +28,8 @@ import java.awt.Color; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.junit.Test; public class ColorUtilTest @@ -102,10 +104,10 @@ public class ColorUtilTest { for (Color color : COLOR_HEXSTRING_MAP.keySet()) { - assert(!ColorUtil.isFullyTransparent(color)); + assertFalse(ColorUtil.isFullyTransparent(color)); } - assert(ColorUtil.isFullyTransparent(new Color(0, 0, 0, 0))); - assert(!ColorUtil.isFullyTransparent(new Color(0, 0, 0, 1))); + assertTrue(ColorUtil.isFullyTransparent(new Color(0, 0, 0, 0))); + assertFalse(ColorUtil.isFullyTransparent(new Color(0, 0, 0, 1))); } @Test @@ -113,9 +115,9 @@ public class ColorUtilTest { for (Color color : COLOR_HEXSTRING_MAP.keySet()) { - assert(ColorUtil.isNotFullyTransparent(color)); + assertTrue(ColorUtil.isNotFullyTransparent(color)); } - assert(!ColorUtil.isNotFullyTransparent(new Color(0, 0, 0, 0))); - assert(ColorUtil.isNotFullyTransparent(new Color(0, 0, 0, 1))); + assertFalse(ColorUtil.isNotFullyTransparent(new Color(0, 0, 0, 0))); + assertTrue(ColorUtil.isNotFullyTransparent(new Color(0, 0, 0, 1))); } } diff --git a/runelite-client/src/test/java/net/runelite/client/util/ImageUtilTest.java b/runelite-client/src/test/java/net/runelite/client/util/ImageUtilTest.java index a5d64b6a43..917914d4cf 100644 --- a/runelite-client/src/test/java/net/runelite/client/util/ImageUtilTest.java +++ b/runelite-client/src/test/java/net/runelite/client/util/ImageUtilTest.java @@ -39,6 +39,8 @@ import java.util.function.Predicate; import javax.annotation.Nonnull; import org.apache.commons.lang3.ArrayUtils; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.junit.Test; public class ImageUtilTest @@ -79,50 +81,50 @@ public class ImageUtilTest public void grayscaleOffset() { // grayscaleOffset(BufferedImage image, int offset) - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(BLACK), -255))); - assert(bufferedImagesEqual(oneByOne(new Color(50, 50, 50)), ImageUtil.grayscaleOffset(oneByOne(BLACK), 50))); - assert(bufferedImagesEqual(oneByOne(GRAY), ImageUtil.grayscaleOffset(oneByOne(BLACK), 128))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(GRAY), -255))); - assert(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(BLACK), 255))); - assert(bufferedImagesEqual(oneByOne(new Color(200, 200, 200)), ImageUtil.grayscaleOffset(oneByOne(WHITE), -55))); - assert(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(WHITE), 55))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(BLACK), -255))); + assertTrue(bufferedImagesEqual(oneByOne(new Color(50, 50, 50)), ImageUtil.grayscaleOffset(oneByOne(BLACK), 50))); + assertTrue(bufferedImagesEqual(oneByOne(GRAY), ImageUtil.grayscaleOffset(oneByOne(BLACK), 128))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(GRAY), -255))); + assertTrue(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(BLACK), 255))); + assertTrue(bufferedImagesEqual(oneByOne(new Color(200, 200, 200)), ImageUtil.grayscaleOffset(oneByOne(WHITE), -55))); + assertTrue(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(WHITE), 55))); // grayscaleOffset(BufferedImage image, float percentage) - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(BLACK), 0f))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(BLACK), 1f))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(BLACK), 2f))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(GRAY), 0f))); - assert(bufferedImagesEqual(oneByOne(GRAY), ImageUtil.grayscaleOffset(oneByOne(GRAY), 1f))); - assert(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(GRAY), 2f))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(WHITE), 0f))); - assert(bufferedImagesEqual(oneByOne(GRAY), ImageUtil.grayscaleOffset(oneByOne(WHITE), 0.503f))); // grayscaleOffset does Math.floor - assert(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(WHITE), 1f))); - assert(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(WHITE), 2f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(BLACK), 0f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(BLACK), 1f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(BLACK), 2f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(GRAY), 0f))); + assertTrue(bufferedImagesEqual(oneByOne(GRAY), ImageUtil.grayscaleOffset(oneByOne(GRAY), 1f))); + assertTrue(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(GRAY), 2f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.grayscaleOffset(oneByOne(WHITE), 0f))); + assertTrue(bufferedImagesEqual(oneByOne(GRAY), ImageUtil.grayscaleOffset(oneByOne(WHITE), 0.503f))); // grayscaleOffset does Math.floor + assertTrue(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(WHITE), 1f))); + assertTrue(bufferedImagesEqual(oneByOne(WHITE), ImageUtil.grayscaleOffset(oneByOne(WHITE), 2f))); } @Test public void alphaOffset() { // alphaOffset(BufferedImage image, int offset) - assert(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), -255))); - assert(bufferedImagesEqual(oneByOne(new Color(0, 0, 0, 50)), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 50))); - assert(bufferedImagesEqual(oneByOne(BLACK_HALF_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 128))); - assert(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_HALF_TRANSPARENT), -255))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 255))); - assert(bufferedImagesEqual(oneByOne(new Color(0, 0, 0, 200)), ImageUtil.alphaOffset(oneByOne(BLACK), -55))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK), 255))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), -255))); + assertTrue(bufferedImagesEqual(oneByOne(new Color(0, 0, 0, 50)), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 50))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_HALF_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 128))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_HALF_TRANSPARENT), -255))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 255))); + assertTrue(bufferedImagesEqual(oneByOne(new Color(0, 0, 0, 200)), ImageUtil.alphaOffset(oneByOne(BLACK), -55))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK), 255))); // alphaOffset(BufferedImage image, float offset) - assert(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 0f))); - assert(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 1f))); - assert(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 2f))); - assert(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_HALF_TRANSPARENT), 0f))); - assert(bufferedImagesEqual(oneByOne(BLACK_HALF_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_HALF_TRANSPARENT), 1f))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK_HALF_TRANSPARENT), 2f))); - assert(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK), 0f))); - assert(bufferedImagesEqual(oneByOne(BLACK_HALF_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK), 0.503f))); // opacityOffset does Math.floor - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK), 1f))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK), 2f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 0f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 1f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_TRANSPARENT), 2f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_HALF_TRANSPARENT), 0f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_HALF_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK_HALF_TRANSPARENT), 1f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK_HALF_TRANSPARENT), 2f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK), 0f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_HALF_TRANSPARENT), ImageUtil.alphaOffset(oneByOne(BLACK), 0.503f))); // opacityOffset does Math.floor + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK), 1f))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.alphaOffset(oneByOne(BLACK), 2f))); } @Test @@ -143,15 +145,15 @@ public class ImageUtilTest for (BufferedImage image : grayscaleColors) { - assert(isGrayscale(image)); + assertTrue(isGrayscale(image)); } for (BufferedImage image : nonGrayscaleColors) { - assert(!isGrayscale(image)); + assertFalse(isGrayscale(image)); } for (BufferedImage image : ArrayUtils.addAll(grayscaleColors, nonGrayscaleColors)) { - assert(isGrayscale(ImageUtil.grayscaleImage(image))); + assertTrue(isGrayscale(ImageUtil.grayscaleImage(image))); } } @@ -190,24 +192,24 @@ public class ImageUtilTest }; for (BufferedImage image : assertSameAfterResize) { - assert(bufferedImagesEqual(image, ImageUtil.resizeImage(image, image.getWidth(), image.getHeight()))); + assertTrue(bufferedImagesEqual(image, ImageUtil.resizeImage(image, image.getWidth(), image.getHeight()))); } } @Test public void resizeCanvas() { - assert(bufferedImagesEqual(centeredPixel(BLACK), ImageUtil.resizeCanvas(oneByOne(BLACK), 3, 3))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.resizeCanvas(oneByOne(BLACK), 1, 1))); - assert(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.resizeCanvas(centeredPixel(BLACK), 1, 1))); + assertTrue(bufferedImagesEqual(centeredPixel(BLACK), ImageUtil.resizeCanvas(oneByOne(BLACK), 3, 3))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.resizeCanvas(oneByOne(BLACK), 1, 1))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK), ImageUtil.resizeCanvas(centeredPixel(BLACK), 1, 1))); BufferedImage expected = new BufferedImage(2, 1, BufferedImage.TYPE_INT_ARGB); expected.setRGB(1, 0, BLACK.getRGB()); - assert(bufferedImagesEqual(expected, ImageUtil.resizeCanvas(oneByOne(BLACK), 2, 1))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.resizeCanvas(oneByOne(BLACK), 2, 1))); expected = new BufferedImage(1, 2, BufferedImage.TYPE_INT_ARGB); expected.setRGB(0, 1, BLACK.getRGB()); - assert(bufferedImagesEqual(expected, ImageUtil.resizeCanvas(oneByOne(BLACK), 1, 2))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.resizeCanvas(oneByOne(BLACK), 1, 2))); } @Test @@ -216,10 +218,10 @@ public class ImageUtilTest // TODO: Test more than 90° rotations // Evenly-sized images (2x2) - assert(bufferedImagesEqual(BLACK_PIXEL_TOP_RIGHT, ImageUtil.rotateImage(BLACK_PIXEL_TOP_LEFT, Math.PI / 2))); - assert(bufferedImagesEqual(BLACK_PIXEL_BOTTOM_RIGHT, ImageUtil.rotateImage(BLACK_PIXEL_TOP_LEFT, Math.PI))); - assert(bufferedImagesEqual(BLACK_PIXEL_BOTTOM_LEFT, ImageUtil.rotateImage(BLACK_PIXEL_TOP_LEFT, Math.PI * 3 / 2))); - assert(bufferedImagesEqual(BLACK_PIXEL_TOP_LEFT, ImageUtil.rotateImage(BLACK_PIXEL_TOP_LEFT, Math.PI * 2))); + assertTrue(bufferedImagesEqual(BLACK_PIXEL_TOP_RIGHT, ImageUtil.rotateImage(BLACK_PIXEL_TOP_LEFT, Math.PI / 2))); + assertTrue(bufferedImagesEqual(BLACK_PIXEL_BOTTOM_RIGHT, ImageUtil.rotateImage(BLACK_PIXEL_TOP_LEFT, Math.PI))); + assertTrue(bufferedImagesEqual(BLACK_PIXEL_BOTTOM_LEFT, ImageUtil.rotateImage(BLACK_PIXEL_TOP_LEFT, Math.PI * 3 / 2))); + assertTrue(bufferedImagesEqual(BLACK_PIXEL_TOP_LEFT, ImageUtil.rotateImage(BLACK_PIXEL_TOP_LEFT, Math.PI * 2))); // Unevenly-sized images (2x1); when rotated 90° become (2x2) images final BufferedImage twoByOneLeft = new BufferedImage(2, 1, BufferedImage.TYPE_INT_ARGB); @@ -232,33 +234,33 @@ public class ImageUtilTest oneByTwoBottom.setRGB(0, 0, new Color(0, 0, 0, 127).getRGB()); oneByTwoBottom.setRGB(0, 1, BLACK.getRGB()); - assert(bufferedImagesEqual(oneByTwoTop, ImageUtil.rotateImage(twoByOneLeft, Math.PI / 2))); - assert(bufferedImagesEqual(twoByTwoRight, ImageUtil.rotateImage(twoByOneLeft, Math.PI))); - assert(bufferedImagesEqual(oneByTwoBottom, ImageUtil.rotateImage(twoByOneLeft, Math.PI * 3 / 2))); - assert(bufferedImagesEqual(twoByOneLeft, ImageUtil.rotateImage(twoByOneLeft, Math.PI * 2))); + assertTrue(bufferedImagesEqual(oneByTwoTop, ImageUtil.rotateImage(twoByOneLeft, Math.PI / 2))); + assertTrue(bufferedImagesEqual(twoByTwoRight, ImageUtil.rotateImage(twoByOneLeft, Math.PI))); + assertTrue(bufferedImagesEqual(oneByTwoBottom, ImageUtil.rotateImage(twoByOneLeft, Math.PI * 3 / 2))); + assertTrue(bufferedImagesEqual(twoByOneLeft, ImageUtil.rotateImage(twoByOneLeft, Math.PI * 2))); } @Test public void flipImage() { - assert(bufferedImagesEqual(BLACK_PIXEL_TOP_LEFT, ImageUtil.flipImage(BLACK_PIXEL_TOP_LEFT, false, false))); - assert(bufferedImagesEqual(BLACK_PIXEL_TOP_RIGHT, ImageUtil.flipImage(BLACK_PIXEL_TOP_LEFT, true, false))); - assert(bufferedImagesEqual(BLACK_PIXEL_BOTTOM_LEFT, ImageUtil.flipImage(BLACK_PIXEL_TOP_LEFT, false, true))); - assert(bufferedImagesEqual(BLACK_PIXEL_BOTTOM_RIGHT, ImageUtil.flipImage(BLACK_PIXEL_TOP_LEFT, true, true))); + assertTrue(bufferedImagesEqual(BLACK_PIXEL_TOP_LEFT, ImageUtil.flipImage(BLACK_PIXEL_TOP_LEFT, false, false))); + assertTrue(bufferedImagesEqual(BLACK_PIXEL_TOP_RIGHT, ImageUtil.flipImage(BLACK_PIXEL_TOP_LEFT, true, false))); + assertTrue(bufferedImagesEqual(BLACK_PIXEL_BOTTOM_LEFT, ImageUtil.flipImage(BLACK_PIXEL_TOP_LEFT, false, true))); + assertTrue(bufferedImagesEqual(BLACK_PIXEL_BOTTOM_RIGHT, ImageUtil.flipImage(BLACK_PIXEL_TOP_LEFT, true, true))); } @Test public void fillImage() { // fillImage(BufferedImage image, Color color) - assert(bufferedImagesEqual(centeredPixel(GRAY), ImageUtil.fillImage(centeredPixel(BLACK), GRAY))); - assert(bufferedImagesEqual(solidColor(3, 3, GREEN), ImageUtil.fillImage(solidColor(3, 3, BLACK), GREEN))); - assert(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.fillImage(oneByOne(BLACK_TRANSPARENT), WHITE))); + assertTrue(bufferedImagesEqual(centeredPixel(GRAY), ImageUtil.fillImage(centeredPixel(BLACK), GRAY))); + assertTrue(bufferedImagesEqual(solidColor(3, 3, GREEN), ImageUtil.fillImage(solidColor(3, 3, BLACK), GREEN))); + assertTrue(bufferedImagesEqual(oneByOne(BLACK_TRANSPARENT), ImageUtil.fillImage(oneByOne(BLACK_TRANSPARENT), WHITE))); // fillImage(BufferedImage image, Color color, Predicate fillCondition) BufferedImage expected = solidColor(CORNER_SIZE, CORNER_SIZE, WHITE); expected.setRGB(0, 0, new Color(0, true).getRGB()); - assert(bufferedImagesEqual(expected, ImageUtil.fillImage(BLACK_PIXEL_TOP_LEFT, WHITE, ColorUtil::isFullyTransparent))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.fillImage(BLACK_PIXEL_TOP_LEFT, WHITE, ColorUtil::isFullyTransparent))); } @Test @@ -277,13 +279,13 @@ public class ImageUtilTest expected.setRGB(x, y, BLACK.getRGB()); } } - assert(bufferedImagesEqual(expected, ImageUtil.outlineImage(centeredPixel(BLACK), BLACK))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.outlineImage(centeredPixel(BLACK), BLACK))); expected.setRGB(1, 1, WHITE.getRGB()); - assert(bufferedImagesEqual(expected, ImageUtil.outlineImage(centeredPixel(WHITE), BLACK))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.outlineImage(centeredPixel(WHITE), BLACK))); expected = solidColor(CORNER_SIZE, CORNER_SIZE, WHITE); expected.setRGB(0, 0, BLACK.getRGB()); expected.setRGB(1, 1, new Color(0, true).getRGB()); - assert(bufferedImagesEqual(expected, ImageUtil.outlineImage(BLACK_PIXEL_TOP_LEFT, WHITE))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.outlineImage(BLACK_PIXEL_TOP_LEFT, WHITE))); // outlineImage(BufferedImage image, Color color, Predicate fillCondition) BufferedImage test = new BufferedImage(CORNER_SIZE, CORNER_SIZE, BufferedImage.TYPE_INT_ARGB); @@ -291,13 +293,13 @@ public class ImageUtilTest test.setRGB(1, 0, GRAY.getRGB()); expected = test; expected.setRGB(0, 1, BLUE.getRGB()); - assert(bufferedImagesEqual(expected, ImageUtil.outlineImage(test, BLUE, (color -> color.equals(BLACK))))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.outlineImage(test, BLUE, (color -> color.equals(BLACK))))); // outlineImage(BufferedImage image, Color color, Boolean outlineCorners) expected = solidColor(CORNER_SIZE, CORNER_SIZE, WHITE); expected.setRGB(0, 0, BLACK.getRGB()); - assert(bufferedImagesEqual(expected, ImageUtil.outlineImage(BLACK_PIXEL_TOP_LEFT, WHITE, true))); - assert(bufferedImagesEqual(solidColor(3, 3, BLACK), ImageUtil.outlineImage(centeredPixel(BLACK), BLACK, true))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.outlineImage(BLACK_PIXEL_TOP_LEFT, WHITE, true))); + assertTrue(bufferedImagesEqual(solidColor(3, 3, BLACK), ImageUtil.outlineImage(centeredPixel(BLACK), BLACK, true))); // outlineImage(BufferedImage image, Color color, Predicate fillCondition, Boolean outlineCorners) test = new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB); @@ -317,7 +319,7 @@ public class ImageUtilTest expected.setRGB(2, 4, RED.getRGB()); expected.setRGB(3, 4, RED.getRGB()); Predicate testPredicate = (color -> ColorUtil.isNotFullyTransparent(color) && color.getRed() > 75 && color.getGreen() > 75 && color.getBlue() > 75); - assert(bufferedImagesEqual(expected, ImageUtil.outlineImage(test, RED, testPredicate, true))); + assertTrue(bufferedImagesEqual(expected, ImageUtil.outlineImage(test, RED, testPredicate, true))); } /** From e9597e85d8aabc0e056d0abc4531fdc9961be712 Mon Sep 17 00:00:00 2001 From: trimbe Date: Sun, 3 Mar 2019 19:15:35 -0500 Subject: [PATCH 194/304] mixins: use a ClanMember for ClanMemberJoined/Left --- .../runelite/api/events/ClanMemberJoined.java | 5 +++-- .../runelite/api/events/ClanMemberLeft.java | 5 +++-- .../mixins/RSClanMemberManagerMixin.java | 21 +++++++++++++++---- .../runelite/rs/api/RSNameableContainer.java | 3 +++ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java index b8e50c6296..ff2a373c4b 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberJoined.java @@ -25,12 +25,13 @@ package net.runelite.api.events; import lombok.Value; +import net.runelite.api.ClanMember; @Value public class ClanMemberJoined { /** - * Name of the player who joined + * The ClanMember that joined */ - private String name; + private ClanMember member; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java index 6eb269dd6d..24bc58f960 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ClanMemberLeft.java @@ -25,12 +25,13 @@ package net.runelite.api.events; import lombok.Value; +import net.runelite.api.ClanMember; @Value public class ClanMemberLeft { /** - * Name of the player who left + * The ClanMember that left */ - private String name; + private ClanMember member; } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java index b4c71dec2a..25e01ce1ca 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClanMemberManagerMixin.java @@ -24,6 +24,7 @@ */ package net.runelite.mixins; +import net.runelite.api.ClanMember; import net.runelite.api.events.ClanMemberJoined; import net.runelite.api.events.ClanMemberLeft; import net.runelite.api.mixins.Inject; @@ -44,15 +45,27 @@ public abstract class RSClanMemberManagerMixin implements RSClanMemberManager @Override public void rl$add(RSName name, RSName prevName) { - ClanMemberJoined event = new ClanMemberJoined(name.getName()); - client.getCallbacks().post(event); + ClanMember member = findByName(name); + if (member == null) + { + return; + } + + ClanMemberJoined event = new ClanMemberJoined(member); + client.getCallbacks().postDeferred(event); } @Inject @Override public void rl$remove(RSNameable nameable) { - ClanMemberLeft event = new ClanMemberLeft(nameable.getRsName().getName()); - client.getCallbacks().post(event); + ClanMember member = findByName(nameable.getRsName()); + if (member == null) + { + return; + } + + ClanMemberLeft event = new ClanMemberLeft(member); + client.getCallbacks().postDeferred(event); } } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java b/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java index 82fb52d9d4..33f2070048 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSNameableContainer.java @@ -37,6 +37,9 @@ public interface RSNameableContainer @Import("isMember") boolean isMember(RSName var1); + @Import("findByName") + T findByName(RSName name); + /** * Method called by the container when an element is added * @param name From bb770a72b06c6e8b3d671ed7d3d479d9fe4efbc2 Mon Sep 17 00:00:00 2001 From: trimbe Date: Sun, 3 Mar 2019 19:18:03 -0500 Subject: [PATCH 195/304] clanchat: retrieve rank from ClanMember rather than ClanManager Ranks would be cached at the time of join/leave which was incorrect. Using the rank from ClanMember will always be correct and won't require the user to have spoken recently to cache their rank. --- .../plugins/clanchat/ClanChatPlugin.java | 25 +++++++++++-------- .../plugins/clanchat/ClanMemberActivity.java | 3 ++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index 3e57a0723f..d1f744180b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -41,6 +41,7 @@ import java.util.Map; import javax.inject.Inject; import net.runelite.api.ChatLineBuffer; import net.runelite.api.ChatMessageType; +import net.runelite.api.ClanMember; import net.runelite.api.ClanMemberRank; import net.runelite.api.Client; import net.runelite.api.GameState; @@ -170,38 +171,40 @@ public class ClanChatPlugin extends Plugin return; } + ClanMember member = event.getMember(); if (!config.showJoinLeave() || - clanManager.getRank(event.getName()).getValue() < config.joinLeaveRank().getValue()) + member.getRank().getValue() < config.joinLeaveRank().getValue()) { return; } // attempt to filter out world hopping joins - if (!activityBuffer.containsKey(event.getName())) + if (!activityBuffer.containsKey(member.getUsername())) { ClanMemberActivity joinActivity = new ClanMemberActivity(ClanActivityType.JOINED, - event.getName(), client.getTickCount()); - activityBuffer.put(event.getName(), joinActivity); + member, client.getTickCount()); + activityBuffer.put(member.getUsername(), joinActivity); } else { - activityBuffer.remove(event.getName()); + activityBuffer.remove(member.getUsername()); } } @Subscribe public void onClanMemberLeft(ClanMemberLeft event) { + ClanMember member = event.getMember(); if (!config.showJoinLeave() || - clanManager.getRank(event.getName()).getValue() < config.joinLeaveRank().getValue()) + member.getRank().getValue() < config.joinLeaveRank().getValue()) { return; } ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT, - event.getName(), client.getTickCount()); + member, client.getTickCount()); - activityBuffer.put(event.getName(), leaveActivity); + activityBuffer.put(member.getUsername(), leaveActivity); } @Subscribe @@ -298,10 +301,10 @@ public class ClanChatPlugin extends Plugin } } - private void addActivityMessage(String memberName, ClanActivityType activityType) + private void addActivityMessage(ClanMember member, ClanActivityType activityType) { final String activityMessage = activityType == ClanActivityType.JOINED ? " has joined." : " has left."; - final ClanMemberRank rank = clanManager.getRank(memberName); + final ClanMemberRank rank = member.getRank(); String rankTag = ""; Color textColor = CHAT_CLAN_TEXT_OPAQUE_BACKGROUND; Color channelColor = CHAT_CLAN_NAME_OPAQUE_BACKGROUND; @@ -323,7 +326,7 @@ public class ClanChatPlugin extends Plugin .append("[") .append(ColorUtil.wrapWithColorTag(client.getClanChatName(), channelColor) + rankTag) .append("] ") - .append(ColorUtil.wrapWithColorTag(memberName + activityMessage, textColor)) + .append(ColorUtil.wrapWithColorTag(member.getUsername() + activityMessage, textColor)) .build(); client.addChatMessage(ChatMessageType.CLANCHAT_INFO, "", messageString, ""); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java index f739437b15..1cea036a95 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java @@ -26,12 +26,13 @@ package net.runelite.client.plugins.clanchat; import lombok.AllArgsConstructor; import lombok.Value; +import net.runelite.api.ClanMember; @Value @AllArgsConstructor class ClanMemberActivity { private ClanActivityType activityType; - private String member; + private ClanMember member; private Integer tick; } From 9919cf5a76038d4355a4d3a30ddf2af1a3676e73 Mon Sep 17 00:00:00 2001 From: trimbe Date: Sun, 3 Mar 2019 20:52:37 -0500 Subject: [PATCH 196/304] clanchat: respect rank icon config for join/leave messages --- .../net/runelite/client/plugins/clanchat/ClanChatPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index 3e57a0723f..be4172bc4a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -312,7 +312,7 @@ public class ClanChatPlugin extends Plugin channelColor = CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND; } - if (rank != null && rank != ClanMemberRank.UNRANKED) + if (config.clanChatIcons() && rank != null && rank != ClanMemberRank.UNRANKED) { int iconNumber = clanManager.getIconNumber(rank); rankTag = " "; From acb840cffb2e5b6e723810cb2220a73ed2f76c7f Mon Sep 17 00:00:00 2001 From: TheStonedTurtle <29030969+TheStonedTurtle@users.noreply.github.com> Date: Fri, 14 Dec 2018 08:39:37 -0800 Subject: [PATCH 197/304] clanchat plugin: add CC rank icons to oublic and private messages --- .../plugins/clanchat/ClanChatConfig.java | 22 ++++++++ .../plugins/clanchat/ClanChatPlugin.java | 50 +++++++++++++++---- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java index cfddcb84a5..5fdd7996be 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java @@ -104,4 +104,26 @@ public interface ClanChatConfig extends Config { return ClanMemberRank.UNRANKED; } + + @ConfigItem( + keyName = "privateMessageIcons", + name = "Private Message Icons", + description = "Add clan chat rank icons to private messages received from clan mates.", + position = 6 + ) + default boolean privateMessageIcons() + { + return false; + } + + @ConfigItem( + keyName = "publicChatIcons", + name = "Public Chat Icons", + description = "Add clan chat rank icons to public chat messages from clan mates.", + position = 7 + ) + default boolean publicChatIcons() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index 3e57a0723f..ef1f27e3cf 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -353,10 +353,38 @@ public class ClanChatPlugin extends Plugin return; } - if (chatMessage.getType() == ChatMessageType.CLANCHAT && client.getClanChatCount() > 0) + if (client.getClanChatCount() <= 0) { - insertClanRankIcon(chatMessage); + return; } + + switch (chatMessage.getType()) + { + case PRIVATE_MESSAGE_RECEIVED: + case PRIVATE_MESSAGE_RECEIVED_MOD: + if (!config.privateMessageIcons()) + { + return; + } + break; + case PUBLIC: + case PUBLIC_MOD: + if (!config.publicChatIcons()) + { + return; + } + break; + case CLANCHAT: + if (!config.clanChatIcons()) + { + return; + } + break; + default: + return; + } + + insertClanRankIcon(chatMessage); } @Subscribe @@ -431,18 +459,22 @@ public class ClanChatPlugin extends Plugin private void insertClanRankIcon(final ChatMessage message) { - if (!config.clanChatIcons()) - { - return; - } - final ClanMemberRank rank = clanManager.getRank(message.getName()); if (rank != null && rank != ClanMemberRank.UNRANKED) { int iconNumber = clanManager.getIconNumber(rank); - message.getMessageNode() - .setSender(message.getMessageNode().getSender() + " "); + final String img = ""; + if (message.getType() == ChatMessageType.CLANCHAT) + { + message.getMessageNode() + .setSender(message.getMessageNode().getSender() + " " + img); + } + else + { + message.getMessageNode() + .setName(img + message.getMessageNode().getName()); + } client.refreshChat(); } } From e6d0e5e29c21d3bd774e007c38fc33e523a46118 Mon Sep 17 00:00:00 2001 From: SebastiaanVanspauwen <43320258+SebastiaanVanspauwen@users.noreply.github.com> Date: Mon, 4 Mar 2019 11:01:07 +0100 Subject: [PATCH 198/304] Clanchat: clear counter on login/connection lost instead of loading (#8068) --- .../net/runelite/client/plugins/clanchat/ClanChatPlugin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index dd9e50aad7..bf3ffd9932 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -393,7 +393,9 @@ public class ClanChatPlugin extends Plugin @Subscribe public void onGameStateChanged(GameStateChanged state) { - if (state.getGameState() == GameState.LOADING) + GameState gameState = state.getGameState(); + + if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING) { clanMembers.clear(); removeClanCounter(); From 9838ae7e0f445b46f8e4f1505889b596b11a65e3 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 18 Feb 2019 00:23:58 +0100 Subject: [PATCH 199/304] Fix SpringBootWebApplication auto-configuration annotation The exclude is supposed to be on SpringBootApplication annotation, otherwise IntelliJ Spring plugin errors, and also SpringBootApplication already contains EnableAutoConfiguration. Signed-off-by: Tomas Slusny --- .../net/runelite/http/service/SpringBootWebApplication.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java b/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java index bfdac0a254..d0103d89f8 100644 --- a/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java +++ b/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java @@ -44,7 +44,6 @@ import org.slf4j.ILoggerFactory; import org.slf4j.impl.StaticLoggerBinder; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; @@ -58,9 +57,8 @@ import org.sql2o.Sql2o; import org.sql2o.converters.Converter; import org.sql2o.quirks.NoQuirks; -@SpringBootApplication +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) @EnableScheduling -@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class}) @Slf4j public class SpringBootWebApplication extends SpringBootServletInitializer { From 52a862c43b329b84f64013071f138c695cb8d329 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 18 Feb 2019 00:26:34 +0100 Subject: [PATCH 200/304] Migrate SpringBootWebApplicationTest to spring profiles - Instead of replacing configuration with dev configuration on classpath, create dev profile and use that - Move common properties to application.yaml Signed-off-by: Tomas Slusny --- .../src/main/resources/application.yaml | 29 +++++++++++++++++-- .../service/SpringBootWebApplicationTest.java | 7 ++--- .../{dev.yaml => application-dev.yaml} | 14 +++++++-- .../src/test/resources/application.yaml | 22 -------------- 4 files changed, 41 insertions(+), 31 deletions(-) rename http-service/src/test/resources/{dev.yaml => application-dev.yaml} (63%) diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml index 9aa02c58ac..271b190a90 100644 --- a/http-service/src/main/resources/application.yaml +++ b/http-service/src/main/resources/application.yaml @@ -5,8 +5,33 @@ datasource: jndiName: java:comp/env/jdbc/runelite-cache2 runelite-tracker: jndiName: java:comp/env/jdbc/runelite-tracker + # By default Spring tries to register the datasource as an MXBean, -# so if multiple apis are delpoyed on one web container with +# so if multiple apis are deployed on one web container with # shared datasource it tries to register it multiples times and # fails when starting the 2nd api -spring.jmx.enabled: false \ No newline at end of file +spring.jmx.enabled: false + +# Google OAuth client +oauth: + client-id: + client-secret: + +# Minio client storage for cache +minio: + endpoint: http://localhost:9000 + accesskey: AM54M27O4WZK65N6F8IP + secretkey: /PZCxzmsJzwCHYlogcymuprniGCaaLUOET2n6yMP + bucket: runelite + +# Redis client for temporary data storage +redis: + pool.size: 10 + host: http://localhost:6379 + +# Twitter client for feed +runelite: + twitter: + consumerkey: + secretkey: + listid: 968949795153948673 \ No newline at end of file diff --git a/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java b/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java index d2d488e1e6..6adcc0f6f0 100644 --- a/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java +++ b/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java @@ -34,10 +34,9 @@ public class SpringBootWebApplicationTest @Ignore public void run() throws InterruptedException { - String[] args = new String[]{ - "--spring.config.location=classpath:/application.yaml,classpath:/dev.yaml" - }; - SpringApplication.run(SpringBootWebApplication.class, args); + System.setProperty("spring.profiles.active", "dev"); + SpringApplication.run(SpringBootWebApplication.class); + for (;;) { Thread.sleep(100L); diff --git a/http-service/src/test/resources/dev.yaml b/http-service/src/test/resources/application-dev.yaml similarity index 63% rename from http-service/src/test/resources/dev.yaml rename to http-service/src/test/resources/application-dev.yaml index e4967ccee4..b8c5fb91d1 100644 --- a/http-service/src/test/resources/dev.yaml +++ b/http-service/src/test/resources/application-dev.yaml @@ -1,19 +1,27 @@ +# Enable debug logging +debug: true +logging.level.net.runelite: DEBUG + +# Development data sources datasource: runelite: + jndiName: driverClassName: com.mysql.jdbc.Driver type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource - url: jdbc:mysql://192.168.1.2/runelite + url: jdbc:mysql://localhost:3306/runelite username: runelite password: runelite runelite-cache: + jndiName: driverClassName: com.mysql.jdbc.Driver type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource - url: jdbc:mysql://192.168.1.2/cache + url: jdbc:mysql://localhost:3306/runelite-cache username: runelite password: runelite runelite-tracker: + jndiName: driverClassName: com.mysql.jdbc.Driver type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource - url: jdbc:mysql://192.168.1.2/xptracker + url: jdbc:mysql://localhost:3306/runelite-tracker username: runelite password: runelite diff --git a/http-service/src/test/resources/application.yaml b/http-service/src/test/resources/application.yaml index 128e64d8ef..3811b12bf0 100644 --- a/http-service/src/test/resources/application.yaml +++ b/http-service/src/test/resources/application.yaml @@ -1,25 +1,3 @@ -oauth: - client-id: moo - client-secret: cow - -minio: - endpoint: http://10.96.22.171:9000 - accesskey: AM54M27O4WZK65N6F8IP - secretkey: /PZCxzmsJzwCHYlogcymuprniGCaaLUOET2n6yMP - bucket: runelite - -runelite: - twitter: - consumerkey: moo - secretkey: cow - listid: 968949795153948673 - -logging: - level: - net: - runelite: - DEBUG - datasource: runelite: driverClassName: org.h2.Driver From f91412b33e4cda2430ab3072aaa25e0a6b3e24a8 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 18 Feb 2019 09:07:15 +0000 Subject: [PATCH 201/304] Migrate Spring unit tests to spring profiles Instead of replacing configuration with test configuration on classpath, create test profile and use that. Signed-off-by: Tomas Slusny --- .../runelite/http/service/config/ConfigControllerTest.java | 2 ++ .../http/service/loottracker/LootTrackerControllerTest.java | 2 ++ .../resources/{application.yaml => application-test.yaml} | 4 ++++ 3 files changed, 8 insertions(+) rename http-service/src/test/resources/{application.yaml => application-test.yaml} (82%) diff --git a/http-service/src/test/java/net/runelite/http/service/config/ConfigControllerTest.java b/http-service/src/test/java/net/runelite/http/service/config/ConfigControllerTest.java index 5ba857ef0a..b91029bec2 100644 --- a/http-service/src/test/java/net/runelite/http/service/config/ConfigControllerTest.java +++ b/http-service/src/test/java/net/runelite/http/service/config/ConfigControllerTest.java @@ -43,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; @@ -51,6 +52,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @WebMvcTest(ConfigController.class) @Slf4j +@ActiveProfiles("test") public class ConfigControllerTest { @Autowired diff --git a/http-service/src/test/java/net/runelite/http/service/loottracker/LootTrackerControllerTest.java b/http-service/src/test/java/net/runelite/http/service/loottracker/LootTrackerControllerTest.java index e708de0c29..9151838016 100644 --- a/http-service/src/test/java/net/runelite/http/service/loottracker/LootTrackerControllerTest.java +++ b/http-service/src/test/java/net/runelite/http/service/loottracker/LootTrackerControllerTest.java @@ -49,6 +49,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; @@ -57,6 +58,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @WebMvcTest(LootTrackerController.class) @Slf4j +@ActiveProfiles("test") public class LootTrackerControllerTest { @Autowired diff --git a/http-service/src/test/resources/application.yaml b/http-service/src/test/resources/application-test.yaml similarity index 82% rename from http-service/src/test/resources/application.yaml rename to http-service/src/test/resources/application-test.yaml index 3811b12bf0..0532963ade 100644 --- a/http-service/src/test/resources/application.yaml +++ b/http-service/src/test/resources/application-test.yaml @@ -1,13 +1,17 @@ +# Use in-memory database for tests datasource: runelite: + jndiName: driverClassName: org.h2.Driver type: org.h2.jdbcx.JdbcDataSource url: jdbc:h2:mem:runelite runelite-cache: + jndiName: driverClassName: org.h2.Driver type: org.h2.jdbcx.JdbcDataSource url: jdbc:h2:mem:cache runelite-tracker: + jndiName: driverClassName: org.h2.Driver type: org.h2.jdbcx.JdbcDataSource url: jdbc:h2:mem:xptracker From 2427f61f3714215d73df1abb0fb19c0974191cb6 Mon Sep 17 00:00:00 2001 From: chivesrs Date: Mon, 4 Mar 2019 14:56:04 -0500 Subject: [PATCH 202/304] Enable checkstyle on test sources --- .../http/service/hiscore/HiscoreTestService.java | 1 - pom.xml | 1 + .../client/game/ItemVariationMappingTest.java | 3 ++- .../plugins/bankvalue/BankCalculationTest.java | 6 +----- .../combatlevel/CombatLevelPluginTest.java | 3 ++- .../client/plugins/hiscore/HiscorePanelTest.java | 5 +++-- .../timetracking/clocks/ClockPanelTest.java | 1 - .../ui/overlay/components/TextComponentTest.java | 3 +-- .../net/runelite/client/util/ColorUtilTest.java | 15 ++++++++++----- .../net/runelite/client/util/ImageUtilTest.java | 2 +- 10 files changed, 21 insertions(+), 19 deletions(-) diff --git a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreTestService.java b/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreTestService.java index 654d0792ee..bdd59b077a 100644 --- a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreTestService.java +++ b/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreTestService.java @@ -26,7 +26,6 @@ package net.runelite.http.service.hiscore; import java.io.IOException; -import java.util.concurrent.ExecutionException; import net.runelite.http.api.hiscore.HiscoreResult; import okhttp3.HttpUrl; diff --git a/pom.xml b/pom.xml index 50feb34d19..3478e151d6 100644 --- a/pom.xml +++ b/pom.xml @@ -219,6 +219,7 @@ checkstyle.xml ${project.build.sourceDirectory} + true diff --git a/runelite-client/src/test/java/net/runelite/client/game/ItemVariationMappingTest.java b/runelite-client/src/test/java/net/runelite/client/game/ItemVariationMappingTest.java index 831aef746d..ba67d6b9c2 100644 --- a/runelite-client/src/test/java/net/runelite/client/game/ItemVariationMappingTest.java +++ b/runelite-client/src/test/java/net/runelite/client/game/ItemVariationMappingTest.java @@ -342,7 +342,8 @@ public class ItemVariationMappingTest @Test public void testMappedNames() { - ITEMS_MAP.forEach((key, value) -> { + ITEMS_MAP.forEach((key, value) -> + { assertEquals(value, (Integer) ItemVariationMapping.map(key)); }); } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/bankvalue/BankCalculationTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/bankvalue/BankCalculationTest.java index 06e4bdd1ac..1e57823ab4 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/bankvalue/BankCalculationTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/bankvalue/BankCalculationTest.java @@ -35,15 +35,11 @@ import net.runelite.api.Item; import net.runelite.api.ItemComposition; import net.runelite.api.ItemContainer; import net.runelite.api.ItemID; -import net.runelite.api.queries.BankItemQuery; -import net.runelite.api.widgets.WidgetItem; import net.runelite.client.game.ItemManager; -import net.runelite.client.util.QueryRunner; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.any; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -116,4 +112,4 @@ public class BankCalculationTest long value = bankCalculation.getHaPrice(); assertTrue(value > Integer.MAX_VALUE); } -} \ No newline at end of file +} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelPluginTest.java index 16400b651d..3c1ff06f0c 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelPluginTest.java @@ -64,7 +64,8 @@ public class CombatLevelPluginTest when(client.getLocalPlayer()).thenReturn(player); } - private HashMap getBaseValues() { + private HashMap getBaseValues() + { int attackLevel = client.getRealSkillLevel(Skill.ATTACK); int strengthLevel = client.getRealSkillLevel(Skill.STRENGTH); int defenceLevel = client.getRealSkillLevel(Skill.DEFENCE); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java index 84925b2d84..c814cbd6a7 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java @@ -31,7 +31,8 @@ public class HiscorePanelTest @Test public void testConstructor() { - new HiscorePanel(new HiscoreConfig() {}); + new HiscorePanel(new HiscoreConfig() + { + }); } - } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/clocks/ClockPanelTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/clocks/ClockPanelTest.java index 8e80c3e5c7..09849de72b 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/clocks/ClockPanelTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/clocks/ClockPanelTest.java @@ -25,7 +25,6 @@ package net.runelite.client.plugins.timetracking.clocks; import java.time.format.DateTimeParseException; -import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; diff --git a/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TextComponentTest.java b/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TextComponentTest.java index 71049e0976..067205bd3b 100644 --- a/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TextComponentTest.java +++ b/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TextComponentTest.java @@ -27,7 +27,6 @@ package net.runelite.client.ui.overlay.components; import java.awt.Color; import java.awt.FontMetrics; import java.awt.Graphics2D; -import java.awt.Point; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -85,4 +84,4 @@ public class TextComponentTest verify(graphics, atLeastOnce()).setColor(Color.BLUE); verify(graphics, atLeastOnce()).setColor(Color.GREEN); } -} \ No newline at end of file +} diff --git a/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java b/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java index 43134d4f3f..0399a3634b 100644 --- a/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java +++ b/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java @@ -49,7 +49,8 @@ public class ColorUtilTest @Test public void colorTag() { - COLOR_HEXSTRING_MAP.forEach((color, hex) -> { + COLOR_HEXSTRING_MAP.forEach((color, hex) -> + { assertEquals("", ColorUtil.colorTag(color)); }); } @@ -57,7 +58,8 @@ public class ColorUtilTest @Test public void prependColorTag() { - COLOR_HEXSTRING_MAP.forEach((color, hex) -> { + COLOR_HEXSTRING_MAP.forEach((color, hex) -> + { assertEquals("test", ColorUtil.prependColorTag("test", color)); assertEquals("", ColorUtil.prependColorTag("", color)); }); @@ -68,7 +70,8 @@ public class ColorUtilTest @Test public void wrapWithColorTag() { - COLOR_HEXSTRING_MAP.forEach((color, hex) -> { + COLOR_HEXSTRING_MAP.forEach((color, hex) -> + { assertEquals("test", ColorUtil.wrapWithColorTag("test", color)); assertEquals("", ColorUtil.wrapWithColorTag("", color)); }); @@ -77,7 +80,8 @@ public class ColorUtilTest @Test public void toHexColor() { - COLOR_HEXSTRING_MAP.forEach((color, hex) -> { + COLOR_HEXSTRING_MAP.forEach((color, hex) -> + { assertEquals("#" + hex, ColorUtil.toHexColor(color)); }); } @@ -94,7 +98,8 @@ public class ColorUtilTest @Test public void colorToHexCode() { - COLOR_HEXSTRING_MAP.forEach((color, hex) -> { + COLOR_HEXSTRING_MAP.forEach((color, hex) -> + { assertEquals(hex, ColorUtil.colorToHexCode(color)); }); } diff --git a/runelite-client/src/test/java/net/runelite/client/util/ImageUtilTest.java b/runelite-client/src/test/java/net/runelite/client/util/ImageUtilTest.java index 917914d4cf..829e90368b 100644 --- a/runelite-client/src/test/java/net/runelite/client/util/ImageUtilTest.java +++ b/runelite-client/src/test/java/net/runelite/client/util/ImageUtilTest.java @@ -304,7 +304,7 @@ public class ImageUtilTest // outlineImage(BufferedImage image, Color color, Predicate fillCondition, Boolean outlineCorners) test = new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB); test.setRGB(2, 2, BLACK.getRGB()); - test.setRGB(1,2, new Color(50, 50, 50).getRGB()); + test.setRGB(1, 2, new Color(50, 50, 50).getRGB()); test.setRGB(3, 2, new Color(100, 100, 100).getRGB()); test.setRGB(2, 3, new Color(150, 150, 150).getRGB()); expected = test; From d9e354992338febc89506e032d95315e4f3a7e63 Mon Sep 17 00:00:00 2001 From: trimbe Date: Mon, 4 Mar 2019 21:27:39 -0500 Subject: [PATCH 203/304] clanchat: remove activity in buffer in ClanMemberLeft as well --- .../client/plugins/clanchat/ClanChatPlugin.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index bf3ffd9932..6140fb1a2c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -201,10 +201,16 @@ public class ClanChatPlugin extends Plugin return; } - ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT, - member, client.getTickCount()); - - activityBuffer.put(member.getUsername(), leaveActivity); + if (!activityBuffer.containsKey(member.getUsername())) + { + ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT, + member, client.getTickCount()); + activityBuffer.put(member.getUsername(), leaveActivity); + } + else + { + activityBuffer.remove(member.getUsername()); + } } @Subscribe From ab4c2e51b8ced6656c386447c3ade9189e0049a7 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 5 Mar 2019 08:55:00 +0100 Subject: [PATCH 204/304] Remove unnecessary .get() on OkHttp request GET is default method for OkHttp request builder, no need to explicitely define it. Signed-off-by: Tomas Slusny --- .../net/runelite/http/api/loottracker/LootTrackerClient.java | 1 - 1 file changed, 1 deletion(-) diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java index ac967af886..0d9ec845b3 100644 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java +++ b/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java @@ -90,7 +90,6 @@ public class LootTrackerClient Request request = new Request.Builder() .header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString()) - .get() .url(url) .build(); From c3c090e76e01a9cd4276122578eb7f12c6e1fe1a Mon Sep 17 00:00:00 2001 From: WoneTooPhree Date: Tue, 5 Mar 2019 14:20:07 +0100 Subject: [PATCH 205/304] Move Tai Bwo Wannai Emote location closer to STASH --- .../runelite/client/plugins/cluescrolls/clues/EmoteClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java index d3123ce2da..80b97e6c24 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java @@ -76,7 +76,7 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu new EmoteClue("Show your anger towards the Statue of Saradomin in Ellamaria's garden. Beware of double agents! Equip a zamorak godsword.", BY_THE_BEAR_CAGE_IN_VARROCK_PALACE_GARDENS, new WorldPoint(3230, 3478, 0), ANGRY, item(ZAMORAK_GODSWORD)), new EmoteClue("Show your anger at the Wise old man. Beware of double agents! Equip an abyssal whip, a legend's cape and some spined chaps.", BEHIND_MISS_SCHISM_IN_DRAYNOR_VILLAGE, new WorldPoint(3088, 3254, 0), ANGRY, any("Abyssal whip", item(ABYSSAL_WHIP), item(VOLCANIC_ABYSSAL_WHIP), item(FROZEN_ABYSSAL_WHIP)), item(CAPE_OF_LEGENDS), item(SPINED_CHAPS)), new EmoteClue("Beckon in the Digsite, near the eastern winch. Bow before you talk to me. Equip a green gnome hat, snakeskin boots and an iron pickaxe.", DIGSITE, new WorldPoint(3370, 3425, 0), BECKON, BOW, item(GREEN_HAT), item(SNAKESKIN_BOOTS), item(IRON_PICKAXE)), - new EmoteClue("Beckon in Tai Bwo Wannai. Clap before you talk to me. Equip green dragonhide chaps, a ring of dueling and a mithril medium helmet.", SOUTH_OF_THE_SHRINE_IN_TAI_BWO_WANNAI_VILLAGE, new WorldPoint(2784, 3065, 0), BECKON, CLAP, item(GREEN_DHIDE_CHAPS), any("Ring of dueling", item(RING_OF_DUELING1), item(RING_OF_DUELING2), item(RING_OF_DUELING3), item(RING_OF_DUELING4), item(RING_OF_DUELING5), item(RING_OF_DUELING6), item(RING_OF_DUELING7), item(RING_OF_DUELING8)), item(MITHRIL_MED_HELM)), + new EmoteClue("Beckon in Tai Bwo Wannai. Clap before you talk to me. Equip green dragonhide chaps, a ring of dueling and a mithril medium helmet.", SOUTH_OF_THE_SHRINE_IN_TAI_BWO_WANNAI_VILLAGE, new WorldPoint(2803, 3073, 0), BECKON, CLAP, item(GREEN_DHIDE_CHAPS), any("Ring of dueling", item(RING_OF_DUELING1), item(RING_OF_DUELING2), item(RING_OF_DUELING3), item(RING_OF_DUELING4), item(RING_OF_DUELING5), item(RING_OF_DUELING6), item(RING_OF_DUELING7), item(RING_OF_DUELING8)), item(MITHRIL_MED_HELM)), new EmoteClue("Beckon in the combat ring of Shayzien. Show your anger before you talk to me. Equip an adamant platebody, adamant full helm and adamant platelegs.", WEST_OF_THE_SHAYZIEN_COMBAT_RING, new WorldPoint(1545, 3594, 0), BECKON, ANGRY, item(ADAMANT_PLATELEGS), item(ADAMANT_PLATEBODY), item(ADAMANT_FULL_HELM)), new EmoteClue("Bow near Lord Iorwerth. Beware of double agents! Equip a new imbued crystal bow.", TENT_IN_LORD_IORWERTHS_ENCAMPMENT, new WorldPoint(2205, 3252, 0), BOW, any("Imbued crystal bow", item(NEW_CRYSTAL_BOW_I), item(CRYSTAL_BOW_FULL_I), item(CRYSTAL_BOW_910_I), item(CRYSTAL_BOW_810_I), item(CRYSTAL_BOW_710_I), item(CRYSTAL_BOW_610_I), item(CRYSTAL_BOW_510_I), item(CRYSTAL_BOW_410_I), item(CRYSTAL_BOW_310_I), item(CRYSTAL_BOW_210_I), item(CRYSTAL_BOW_110_I))), new EmoteClue("Bow outside the entrance to the Legends' Guild. Equip iron platelegs, an emerald amulet and an oak longbow.", OUTSIDE_THE_LEGENDS_GUILD_GATES, new WorldPoint(2729, 3349, 0), BOW, item(IRON_PLATELEGS), item(OAK_LONGBOW), item(EMERALD_AMULET)), From 046bdcc3e348b925d1bf88b3c62ab4e17ae0636f Mon Sep 17 00:00:00 2001 From: Lotto Date: Tue, 5 Mar 2019 18:57:30 +0100 Subject: [PATCH 206/304] http-service: fix twitter feed links not working with newer theme When using Twitter's new theme, https://twitter.com/statuses/[tweet_id] style links don't redirect to the tweet in question. Urls before this change: https://twitter.com/statuses/1102962117509087234 After this change: https://twitter.com/OldSchoolRS/status/1102962117509087234 --- .../net/runelite/http/service/feed/twitter/TwitterService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/feed/twitter/TwitterService.java b/http-service/src/main/java/net/runelite/http/service/feed/twitter/TwitterService.java index 230fd2d974..3ac032dc63 100644 --- a/http-service/src/main/java/net/runelite/http/service/feed/twitter/TwitterService.java +++ b/http-service/src/main/java/net/runelite/http/service/feed/twitter/TwitterService.java @@ -124,7 +124,7 @@ public class TwitterService i.getUser().getProfileImageUrl(), i.getUser().getScreenName(), i.getText().replace("\n\n", " ").replaceAll("\n", " "), - "https://twitter.com/statuses/" + i.getId(), + "https://twitter.com/" + i.getUser().getScreenName() + "/status/" + i.getId(), getTimestampFromSnowflake(i.getId()))); } From 13154625cf380127def1d56fdf79fc4980616bb5 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 4 Mar 2019 21:28:24 +0100 Subject: [PATCH 207/304] clanchat: Update clan members set on join/leave events Signed-off-by: Tomas Slusny --- .../plugins/clanchat/ClanChatPlugin.java | 55 ++++++++++++++----- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index 6140fb1a2c..7c2e073ec2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -165,13 +165,29 @@ public class ClanChatPlugin extends Plugin @Subscribe public void onClanMemberJoined(ClanMemberJoined event) { + final ClanMember member = event.getMember(); + + if (member.getWorld() == client.getWorld()) + { + final String memberName = Text.toJagexName(member.getUsername()); + + for (final Player player : client.getPlayers()) + { + if (player != null && memberName.equals(Text.toJagexName(player.getName()))) + { + clanMembers.add(player); + addClanCounter(); + break; + } + } + } + // clan members getting initialized isn't relevant if (clanJoinedTick == client.getTickCount()) { return; } - ClanMember member = event.getMember(); if (!config.showJoinLeave() || member.getRank().getValue() < config.joinLeaveRank().getValue()) { @@ -194,7 +210,29 @@ public class ClanChatPlugin extends Plugin @Subscribe public void onClanMemberLeft(ClanMemberLeft event) { - ClanMember member = event.getMember(); + final ClanMember member = event.getMember(); + + if (member.getWorld() == client.getWorld()) + { + final String memberName = Text.toJagexName(member.getUsername()); + final Iterator each = clanMembers.iterator(); + + while (each.hasNext()) + { + if (memberName.equals(Text.toJagexName(each.next().getName()))) + { + each.remove(); + + if (clanMembers.isEmpty()) + { + removeClanCounter(); + } + + break; + } + } + } + if (!config.showJoinLeave() || member.getRank().getValue() < config.joinLeaveRank().getValue()) { @@ -440,19 +478,6 @@ public class ClanChatPlugin extends Plugin if (event.isJoined()) { clanJoinedTick = client.getTickCount(); - - clientThread.invokeLater(() -> - { - for (Player player : client.getPlayers()) - { - if (player.isClanMember() && !clanMembers.contains(player)) - { - clanMembers.add(player); - } - } - - addClanCounter(); - }); } else { From 66bce610db7148466cc3012d0dbe93968253c053 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Mar 2019 14:53:45 -0500 Subject: [PATCH 208/304] Revert "Merge pull request #8070 from Nightfirecat/fix-ground-markers-bug" This reverts commit b6cd739e61bc9084c172294aaf3eb8ebeaf6f241, reversing changes made to 5bf4b37d1733d19ce339374b138b5e5c9eeaef26. --- .../client/plugins/groundmarkers/GroundMarkerPlugin.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 01952103c4..4aa613af7c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -314,10 +314,11 @@ public class GroundMarkerPlugin extends Plugin } else { - // Remove any points on the same tile but are of a different color. - // Add a new point if no tile was removed, or if remembering tile colors is enabled, which means the marked - // tile was previously of a different color than the new tile marking. - if (!points.removeIf(p -> p.sameTile(point)) || config.rememberTileColors()) + // Remove any points on the same tile but are of a different color + points.removeIf(p -> p.sameTile(point)); + + // Add point back only if we are remembering tile colors, otherwise simply remove it + if (config.rememberTileColors()) { points.add(point); } From 33988a72e1ece243ef24d5441b7d6f80420a950d Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Mar 2019 14:53:59 -0500 Subject: [PATCH 209/304] Revert "Merge pull request #5890 from Nightfirecat/colored-ground-markers" This reverts commit 72b3e4560dbf4d11bbc714066f758f0b336dccb0, reversing changes made to 5a5de3d33f102cc76c105e7c8293e988f7351cec. --- .../net/runelite/api/coords/WorldPoint.java | 32 ---- .../groundmarkers/ColorTileMarker.java | 45 ------ .../groundmarkers/GroundMarkerConfig.java | 11 +- .../GroundMarkerInputListener.java | 2 +- .../groundmarkers/GroundMarkerOverlay.java | 22 ++- .../groundmarkers/GroundMarkerPlugin.java | 142 ++++++------------ .../groundmarkers/GroundMarkerPoint.java | 10 +- 7 files changed, 56 insertions(+), 208 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index bbacd1914a..2ddf7e4198 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -326,36 +326,4 @@ public class WorldPoint { return ((x >> 6) << 8) | (y >> 6); } - - /** - * Converts the passed region ID and coordinates to a world coordinate - */ - public static WorldPoint fromRegion(int regionId, int regionX, int regionY, int plane) - { - return new WorldPoint( - ((regionId >>> 8) << 6) + regionX, - ((regionId & 0xff) << 6) + regionY, - plane); - } - - /** - * Gets the X-axis coordinate of the region coordinate - */ - public int getRegionX() - { - return getRegionOffset(x); - } - - /** - * Gets the Y-axis coordinate of the region coordinate - */ - public int getRegionY() - { - return getRegionOffset(y); - } - - private static int getRegionOffset(final int position) - { - return position & 0x3f; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java deleted file mode 100644 index 8f45e9489a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2019, Jordan Atwood - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.groundmarkers; - -import java.awt.Color; -import lombok.Value; -import net.runelite.api.coords.WorldPoint; - -/** - * Used to denote marked tiles and their colors. - * Note: This is not used for serialization of ground markers; see {@link GroundMarkerPoint} - */ -@Value -class ColorTileMarker -{ - private WorldPoint worldPoint; - private Color color; - - boolean sameTile(final ColorTileMarker other) - { - return worldPoint.equals(other.getWorldPoint()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java index ba8cb98e14..d77f3ab9f5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java @@ -23,6 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + package net.runelite.client.plugins.groundmarkers; import java.awt.Color; @@ -44,14 +45,4 @@ public interface GroundMarkerConfig extends Config { return Color.YELLOW; } - - @ConfigItem( - keyName = "rememberTileColors", - name = "Remember color per tile", - description = "Color tiles using the color from time of placement" - ) - default boolean rememberTileColors() - { - return false; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java index a097d47d29..3b87dd1802 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java @@ -64,4 +64,4 @@ public class GroundMarkerInputListener implements KeyListener plugin.setHotKeyPressed(false); } } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java index 153fe67154..ccd6fd7483 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java @@ -25,11 +25,10 @@ */ package net.runelite.client.plugins.groundmarkers; -import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Polygon; -import java.util.Collection; +import java.util.List; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.Perspective; @@ -43,8 +42,6 @@ import net.runelite.client.ui.overlay.OverlayUtil; public class GroundMarkerOverlay extends Overlay { - private static final int MAX_DRAW_DISTANCE = 32; - private final Client client; private final GroundMarkerConfig config; private final GroundMarkerPlugin plugin; @@ -63,26 +60,25 @@ public class GroundMarkerOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - final Collection points = plugin.getPoints(); - for (final ColorTileMarker point : points) + List points = plugin.getPoints(); + for (WorldPoint point : points) { - if (point.getWorldPoint().getPlane() != client.getPlane()) + if (point.getPlane() != client.getPlane()) { continue; } - final Color tileColor = config.rememberTileColors() ? point.getColor() : config.markerColor(); - drawTile(graphics, point.getWorldPoint(), tileColor); + drawTile(graphics, point); } return null; } - private void drawTile(Graphics2D graphics, WorldPoint point, Color color) + private void drawTile(Graphics2D graphics, WorldPoint point) { WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - if (point.distanceTo(playerLocation) >= MAX_DRAW_DISTANCE) + if (point.distanceTo(playerLocation) >= 32) { return; } @@ -99,6 +95,6 @@ public class GroundMarkerOverlay extends Overlay return; } - OverlayUtil.renderPolygon(graphics, poly, color); + OverlayUtil.renderPolygon(graphics, poly, config.markerColor()); } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 4aa613af7c..2cb7ebf1c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -29,12 +29,11 @@ import com.google.common.base.Strings; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.google.inject.Provides; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.List; -import java.util.Set; import java.util.stream.Collectors; import javax.inject.Inject; import lombok.AccessLevel; @@ -70,23 +69,19 @@ public class GroundMarkerPlugin extends Plugin private static final String CONFIG_GROUP = "groundMarker"; private static final String MARK = "Mark tile"; private static final String WALK_HERE = "Walk here"; - private static final String REGION_PREFIX = "region_"; - private static final Gson GSON = new Gson(); + private static final Gson gson = new Gson(); @Getter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE) private boolean hotKeyPressed; @Getter(AccessLevel.PACKAGE) - private final Set points = new HashSet<>(); + private final List points = new ArrayList<>(); @Inject private Client client; - @Inject - private GroundMarkerConfig config; - @Inject private GroundMarkerInputListener inputListener; @@ -102,53 +97,28 @@ public class GroundMarkerPlugin extends Plugin @Inject private KeyManager keyManager; - private void saveColorTileMarkers(int regionId, Collection points) - { - savePoints(regionId, translateFromColorTileMarker(points)); - } - private void savePoints(int regionId, Collection points) { if (points == null || points.isEmpty()) { - configManager.unsetConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); + configManager.unsetConfiguration(CONFIG_GROUP, "region_" + regionId); return; } - String json = GSON.toJson(points); - configManager.setConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId, json); + String json = gson.toJson(points); + configManager.setConfiguration(CONFIG_GROUP, "region_" + regionId, json); } private Collection getPoints(int regionId) { - String json = configManager.getConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); + String json = configManager.getConfiguration(CONFIG_GROUP, "region_" + regionId); if (Strings.isNullOrEmpty(json)) { - return Collections.emptyList(); + return Collections.EMPTY_LIST; } - - Collection configPoints = GSON.fromJson(json, new GroundMarkerListTypeToken().getType()); - - if (configPoints.stream().anyMatch(point -> point.getColor() == null)) + return gson.fromJson(json, new TypeToken>() { - log.debug("Adding color to old ground marker(s) of region " + regionId); - configPoints = configPoints.stream() - .map(point -> - { - if (point.getColor() != null) - { - return point; - } - return new GroundMarkerPoint(point.getRegionId(), point.getRegionX(), point.getRegionY(), point.getZ(), config.markerColor()); - }) - .collect(Collectors.toSet()); - savePoints(regionId, configPoints); - } - return configPoints; - } - - private static class GroundMarkerListTypeToken extends TypeToken> - { + }.getType()); } @Provides @@ -162,68 +132,46 @@ public class GroundMarkerPlugin extends Plugin points.clear(); int[] regions = client.getMapRegions(); - - if (regions == null) - { - return; - } - for (int regionId : regions) { // load points for region log.debug("Loading points for region {}", regionId); - final Collection configPoints = getPoints(regionId); - final Collection colorTileMarkers = translateToColorTileMarker(configPoints); - points.addAll(colorTileMarkers); + Collection regionPoints = getPoints(regionId); + Collection worldPoints = translateToWorld(regionPoints); + points.addAll(worldPoints); } } /** - * Translate a collection of ground marker points to color tile markers, accounting for instances + * Translate a collection of ground marker points to world points, accounting for instances * - * @param points {@link GroundMarkerPoint}s to be converted to {@link ColorTileMarker}s - * @return A collection of color tile markers, converted from the passed ground marker points, accounting for local - * instance points. See {@link WorldPoint#toLocalInstance(Client, WorldPoint)} + * @param points + * @return */ - private Collection translateToColorTileMarker(Collection points) + private Collection translateToWorld(Collection points) { - if (points == null || points.isEmpty()) + if (points.isEmpty()) { - return Collections.emptyList(); - } - - return points.stream() - .map(point -> new ColorTileMarker( - WorldPoint.fromRegion(point.getRegionId(), point.getRegionX(), point.getRegionY(), point.getZ()), - point.getColor())) - .flatMap(colorTile -> - { - final Collection localWorldPoints = WorldPoint.toLocalInstance(client, colorTile.getWorldPoint()); - return localWorldPoints.stream().map(wp -> new ColorTileMarker(wp, colorTile.getColor())); - }) - .collect(Collectors.toSet()); - } - - /** - * Translate a collection of color tile markers to a set of ground marker points - * - * @param points {@link ColorTileMarker}s to be converted to {@link GroundMarkerPoint}s - * @return A set of ground marker points, converted from the passed color tile markers - */ - private static Set translateFromColorTileMarker(Collection points) - { - if (points == null || points.isEmpty()) - { - return Collections.emptySet(); + return Collections.EMPTY_LIST; } return points.stream() .map(point -> { - final WorldPoint worldPoint = point.getWorldPoint(); - return new GroundMarkerPoint(worldPoint.getRegionID(), worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane(), point.getColor()); + int regionId = point.getRegionId(); + int regionX = point.getRegionX(); + int regionY = point.getRegionY(); + int z = point.getZ(); + + // world point of the tile marker + return new WorldPoint( + ((regionId >>> 8) << 6) + regionX, + ((regionId & 0xff) << 6) + regionY, + z + ); }) - .collect(Collectors.toSet()); + .flatMap(wp -> WorldPoint.toLocalInstance(client, wp).stream()) + .collect(Collectors.toList()); } @Subscribe @@ -286,7 +234,6 @@ public class GroundMarkerPlugin extends Plugin { overlayManager.add(overlay); keyManager.registerKeyListener(inputListener); - loadPoints(); } @Override @@ -294,39 +241,34 @@ public class GroundMarkerPlugin extends Plugin { overlayManager.remove(overlay); keyManager.unregisterKeyListener(inputListener); - points.clear(); } - private void markTile(LocalPoint localPoint) + + protected void markTile(LocalPoint localPoint) { if (localPoint == null) { return; } - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint); - final ColorTileMarker point = new ColorTileMarker(worldPoint, config.markerColor()); + WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint); + + int regionId = worldPoint.getRegionID(); + GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getX() & 0x3f, worldPoint.getY() & 0x3f, client.getPlane()); log.debug("Updating point: {} - {}", point, worldPoint); + List points = new ArrayList<>(getPoints(regionId)); if (points.contains(point)) { points.remove(point); } else { - // Remove any points on the same tile but are of a different color - points.removeIf(p -> p.sameTile(point)); - - // Add point back only if we are remembering tile colors, otherwise simply remove it - if (config.rememberTileColors()) - { - points.add(point); - } + points.add(point); } - final int regionId = worldPoint.getRegionID(); - saveColorTileMarkers(regionId, points); + savePoints(regionId, points); loadPoints(); } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java index ca3aaadb6d..b31db32222 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java @@ -23,20 +23,16 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + package net.runelite.client.plugins.groundmarkers; -import java.awt.Color; import lombok.Value; -/** - * Used for serialization of ground marker points. - */ @Value -class GroundMarkerPoint +public class GroundMarkerPoint { private int regionId; private int regionX; private int regionY; private int z; - private Color color; -} +} \ No newline at end of file From c74ce60987a719819e93acb2f5fe1af06bc41e22 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Mar 2019 18:51:38 -0500 Subject: [PATCH 210/304] clan chat: cleanup onGameStateChanged logic from earlier merge --- .../net/runelite/client/plugins/clanchat/ClanChatPlugin.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index 7c2e073ec2..73859e0271 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -443,12 +443,7 @@ public class ClanChatPlugin extends Plugin { clanMembers.clear(); removeClanCounter(); - } - if (state.getGameState() == GameState.LOGIN_SCREEN - || state.getGameState() == GameState.HOPPING - || state.getGameState() == GameState.CONNECTION_LOST) - { clanJoinMessages.clear(); } } From 8a6a6f93bf204daac5f46e4214c8bb6980745fa9 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Mar 2019 19:08:20 -0500 Subject: [PATCH 211/304] account plugin: move logout off of swing thread --- .../runelite/client/plugins/account/AccountPlugin.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java index 2b82c9e211..55ab81fbe3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java @@ -29,11 +29,11 @@ import java.util.concurrent.ScheduledExecutorService; import javax.inject.Inject; import javax.swing.JOptionPane; import lombok.extern.slf4j.Slf4j; -import net.runelite.client.events.SessionClose; -import net.runelite.client.events.SessionOpen; import net.runelite.client.account.AccountSession; import net.runelite.client.account.SessionManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.ClientToolbar; @@ -113,10 +113,10 @@ public class AccountPlugin extends Plugin private void logoutClick() { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null, - "Are you sure you want to logout from RuneLite?", "Logout Confirmation", - JOptionPane.YES_NO_OPTION)) + "Are you sure you want to logout from RuneLite?", "Logout Confirmation", + JOptionPane.YES_NO_OPTION)) { - sessionManager.logout(); + executor.execute(sessionManager::logout); } } From 420744c7a7c6e9515f0dc2bc0f6e50ed311f8c5e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Mar 2019 19:09:11 -0500 Subject: [PATCH 212/304] session manager: change to null session on close This fixes not assigning null to the websocket session id, which prevented re logging in later due to login() reusing the closed sockets id. Fixes #8089 --- .../main/java/net/runelite/client/account/SessionManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java b/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java index 1f17207c6e..6ef8c82e73 100644 --- a/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java +++ b/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java @@ -155,7 +155,7 @@ public class SessionManager private void closeSession() { - wsClient.close(); + wsClient.changeSession(null); if (accountSession == null) { From 7432351cbaa2e2bb32071661081bda908086ec3d Mon Sep 17 00:00:00 2001 From: trimbe Date: Thu, 7 Mar 2019 00:03:49 -0500 Subject: [PATCH 213/304] diary requirements: add missing period in combat camp task --- .../achievementdiary/diaries/ArdougneDiaryRequirement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java index 7873c2c923..0ef1683447 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java @@ -40,7 +40,7 @@ public class ArdougneDiaryRequirement extends GenericDiaryRequirement new QuestRequirement(Quest.RUNE_MYSTERIES)); add("Steal a cake from the Ardougne market stalls.", new SkillRequirement(Skill.THIEVING, 5)); - add("Enter the Combat Training Camp north of W. Ardougne", + add("Enter the Combat Training Camp north of W. Ardougne.", new QuestRequirement(Quest.BIOHAZARD)); // MEDIUM From d51c36a98370cb953df146676298a20358b3d0fc Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 7 Mar 2019 11:37:51 +0000 Subject: [PATCH 214/304] Update 178 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3478e151d6..adf3c58886 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ true true - 177 + 178 From c5ebc9547c3cd9e925aa427972839b43cf94ed6e Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 7 Mar 2019 07:06:06 -0500 Subject: [PATCH 215/304] api: update 178 --- .../main/java/net/runelite/api/Client.java | 14 ++-------- .../client/plugins/devtools/VarInspector.java | 22 +++++++-------- .../net/runelite/mixins/RSVarcsMixin.java | 14 +++++----- .../java/net/runelite/mixins/VarbitMixin.java | 28 +++++++++---------- .../java/net/runelite/rs/api/RSVarcs.java | 8 ++---- 5 files changed, 35 insertions(+), 51 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 7299e57573..2b7d3aa844 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -634,20 +634,10 @@ public interface Client extends GameEngine int[] getVarps(); /** - * Gets an array of all integer client variables. - * - * @return local variables + * Gets an array of all client variables. */ @VisibleForDevtools - int[] getIntVarcs(); - - /** - * Gets an array of all string client variables. - * - * @return local variables - */ - @VisibleForDevtools - String[] getStrVarcs(); + Map getVarcMap(); /** * Gets the value corresponding to the passed player variable. diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/VarInspector.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/VarInspector.java index dc6a6f6461..ef8454b712 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/VarInspector.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/VarInspector.java @@ -32,6 +32,8 @@ import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; import javax.swing.BorderFactory; import javax.swing.JButton; @@ -95,8 +97,7 @@ class VarInspector extends JFrame private int[] oldVarps2 = null; private int numVarbits = 10000; - private int[] oldIntVarcs = null; - private String[] oldStrVarcs = null; + private Map varcs = null; @Inject VarInspector(Client client, EventBus eventBus, DevToolsPlugin plugin) @@ -279,9 +280,9 @@ class VarInspector extends JFrame public void onVarClientIntChanged(VarClientIntChanged e) { int idx = e.getIndex(); - int neew = client.getIntVarcs()[idx]; - int old = oldIntVarcs[idx]; - oldIntVarcs[idx] = neew; + int neew = (Integer) client.getVarcMap().getOrDefault(idx, 0); + int old = (Integer) varcs.getOrDefault(idx, 0); + varcs.put(idx, neew); if (old != neew) { @@ -302,9 +303,9 @@ class VarInspector extends JFrame public void onVarClientStrChanged(VarClientStrChanged e) { int idx = e.getIndex(); - String neew = client.getStrVarcs()[idx]; - String old = oldStrVarcs[idx]; - oldStrVarcs[idx] = neew; + String neew = (String) client.getVarcMap().getOrDefault(idx, ""); + String old = (String) varcs.getOrDefault(idx, ""); + varcs.put(idx, neew); if (!Objects.equals(old, neew)) { @@ -343,14 +344,11 @@ class VarInspector extends JFrame { oldVarps = new int[client.getVarps().length]; oldVarps2 = new int[client.getVarps().length]; - oldIntVarcs = new int[client.getIntVarcs().length]; - oldStrVarcs = new String[client.getStrVarcs().length]; } System.arraycopy(client.getVarps(), 0, oldVarps, 0, oldVarps.length); System.arraycopy(client.getVarps(), 0, oldVarps2, 0, oldVarps2.length); - System.arraycopy(client.getIntVarcs(), 0, oldIntVarcs, 0, oldIntVarcs.length); - System.arraycopy(client.getStrVarcs(), 0, oldStrVarcs, 0, oldStrVarcs.length); + varcs = new HashMap<>(client.getVarcMap()); eventBus.register(this); setVisible(true); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java index c30a1388ae..2c9a0d4e1e 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSVarcsMixin.java @@ -2,8 +2,8 @@ package net.runelite.mixins; import net.runelite.api.events.VarClientIntChanged; import net.runelite.api.events.VarClientStrChanged; -import net.runelite.api.mixins.FieldHook; import net.runelite.api.mixins.Inject; +import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.Mixin; import net.runelite.api.mixins.Shadow; import net.runelite.rs.api.RSClient; @@ -15,17 +15,17 @@ public abstract class RSVarcsMixin implements RSVarcs @Shadow("clientInstance") private static RSClient client; - @FieldHook("varCInts") + @MethodHook(value = "putVarc", end = true) @Inject - public void onVarCIntChanged(int idx) + public void onVarCIntChanged(int id, int value) { - client.getCallbacks().post(new VarClientIntChanged(idx)); + client.getCallbacks().post(new VarClientIntChanged(id)); } - @FieldHook("varCStrings") + @MethodHook(value = "putVarcStringNew", end = true) @Inject - public void onVarCStrChanged(int idx) + public void onVarCStrChanged(int id, String value) { - client.getCallbacks().post(new VarClientStrChanged(idx)); + client.getCallbacks().post(new VarClientStrChanged(id)); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/VarbitMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/VarbitMixin.java index 23488c694e..a473dad4a9 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/VarbitMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/VarbitMixin.java @@ -26,6 +26,7 @@ package net.runelite.mixins; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import java.util.Map; import net.runelite.api.VarClientInt; import net.runelite.api.VarClientStr; import net.runelite.api.Varbits; @@ -118,43 +119,40 @@ public abstract class VarbitMixin implements RSClient @Override public int getVar(VarClientInt varClientInt) { - return getIntVarcs()[varClientInt.getIndex()]; + Map varcmap = getVarcMap(); + Object object = varcmap.get(varClientInt.getIndex()); + return object instanceof Integer ? (Integer) object : 0; } @Inject @Override public String getVar(VarClientStr varClientStr) { - return getStrVarcs()[varClientStr.getIndex()]; + Map varcmap = getVarcMap(); + Object var2 = varcmap.get(varClientStr.getIndex()); + return var2 instanceof String ? (String) var2 : ""; } @Inject @Override public void setVar(VarClientStr varClientStr, String value) { - String[] vars = getStrVarcs(); - vars[varClientStr.getIndex()] = value; + Map varcmap = getVarcMap(); + varcmap.put(varClientStr.getIndex(), value); } @Inject @Override public void setVar(VarClientInt varClientInt, int value) { - int[] vars = getIntVarcs(); - vars[varClientInt.getIndex()] = value; + Map varcmap = getVarcMap(); + varcmap.put(varClientInt.getIndex(), value); } @Inject @Override - public int[] getIntVarcs() + public Map getVarcMap() { - return getVarcs().getIntVarcs(); - } - - @Inject - @Override - public String[] getStrVarcs() - { - return getVarcs().getStrVarcs(); + return getVarcs().getVarcMap(); } } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSVarcs.java b/runescape-api/src/main/java/net/runelite/rs/api/RSVarcs.java index 5f330cf167..527377ae7b 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSVarcs.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSVarcs.java @@ -24,13 +24,11 @@ */ package net.runelite.rs.api; +import java.util.Map; import net.runelite.mapping.Import; public interface RSVarcs { - @Import("varCInts") - int[] getIntVarcs(); - - @Import("varCStrings") - String[] getStrVarcs(); + @Import("varcMap") + Map getVarcMap(); } From 40ea7fa607bb43acc9b6631abf3e158b9c65844b Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 7 Mar 2019 07:40:46 -0500 Subject: [PATCH 216/304] cache: assign temporary names for new varc string opcodes --- cache/src/main/java/net/runelite/cache/script/Instructions.java | 2 ++ cache/src/main/java/net/runelite/cache/script/Opcodes.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cache/src/main/java/net/runelite/cache/script/Instructions.java b/cache/src/main/java/net/runelite/cache/script/Instructions.java index f9aac6883c..94755ab986 100644 --- a/cache/src/main/java/net/runelite/cache/script/Instructions.java +++ b/cache/src/main/java/net/runelite/cache/script/Instructions.java @@ -64,6 +64,8 @@ public class Instructions add(ARRAY_STORE, "array_store", 2, 0); add(GET_VARC_STRING, "get_varc_string", 0, 0, 0, 1); add(PUT_VARC_STRING, "put_varc_string", 0, 0, 1, 0); + add(GET_VARC_STRING_2, "get_varc_string2", 0, 0, 0, 1); + add(PUT_VARC_STRING_2, "put_varc_string2", 0, 0, 1, 0); add(SWITCH, "switch", 1, 0); add(WIDGET_CREATE_CHILD, "widget_create_child", 3, 0); add(WIDGET_DESTROY_CHILD, "widget_destroy_child", 0, 0); diff --git a/cache/src/main/java/net/runelite/cache/script/Opcodes.java b/cache/src/main/java/net/runelite/cache/script/Opcodes.java index 3e67e115df..ce4c713a7a 100644 --- a/cache/src/main/java/net/runelite/cache/script/Opcodes.java +++ b/cache/src/main/java/net/runelite/cache/script/Opcodes.java @@ -55,6 +55,8 @@ public class Opcodes public static final int ARRAY_STORE = 46; public static final int GET_VARC_STRING = 47; public static final int PUT_VARC_STRING = 48; + public static final int GET_VARC_STRING_2 = 49; + public static final int PUT_VARC_STRING_2 = 50; public static final int SWITCH = 60; public static final int WIDGET_CREATE_CHILD = 100; public static final int WIDGET_DESTROY_CHILD = 101; From 654ec1adf47c810e4cc26a85075e1d542670bb56 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 7 Mar 2019 11:33:00 +0000 Subject: [PATCH 217/304] Update Item IDs to 2019-03-07-rev178 --- runelite-api/src/main/java/net/runelite/api/ItemID.java | 5 ----- runelite-api/src/main/java/net/runelite/api/NullItemID.java | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index 7da66715b0..f4d4362053 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -10643,11 +10643,6 @@ public final class ItemID public static final int ORNATE_TOP = 23097; public static final int ORNATE_CAPE = 23099; public static final int ORNATE_HELM = 23101; - public static final int COOKS_SHOPPING_LIST = 23103; - public static final int COOKS_LETTER = 23104; - public static final int BREWERS_FOLLY = 23105; - public static final int VYVINS_WINE = 23106; - public static final int BEER_GLASS_OF_WATER = 23107; public static final int BIRTHDAY_CAKE = 23108; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index 467ce59eab..b2d75645a9 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -12273,6 +12273,11 @@ public final class NullItemID public static final int NULL_23098 = 23098; public static final int NULL_23100 = 23100; public static final int NULL_23102 = 23102; + public static final int NULL_23103 = 23103; + public static final int NULL_23104 = 23104; + public static final int NULL_23105 = 23105; + public static final int NULL_23106 = 23106; + public static final int NULL_23107 = 23107; public static final int NULL_23109 = 23109; /* This file is automatically generated. Do not edit. */ } From dae118c7eb21dd08636b5db5d641f9e12ce0acea Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 7 Mar 2019 11:33:01 +0000 Subject: [PATCH 218/304] Update Object IDs to 2019-03-07-rev178 --- .../java/net/runelite/api/NullObjectID.java | 12 +----------- .../main/java/net/runelite/api/ObjectID.java | 19 ++----------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java index 4216a1571a..9c09d4df61 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -9330,6 +9330,7 @@ public final class NullObjectID public static final int NULL_20869 = 20869; public static final int NULL_20874 = 20874; public static final int NULL_20875 = 20875; + public static final int NULL_20877 = 20877; public static final int NULL_20879 = 20879; public static final int NULL_20880 = 20880; public static final int NULL_20881 = 20881; @@ -16105,17 +16106,6 @@ public final class NullObjectID public static final int NULL_34678 = 34678; public static final int NULL_34679 = 34679; public static final int NULL_34680 = 34680; - public static final int NULL_34690 = 34690; - public static final int NULL_34691 = 34691; - public static final int NULL_34692 = 34692; - public static final int NULL_34693 = 34693; - public static final int NULL_34694 = 34694; - public static final int NULL_34695 = 34695; - public static final int NULL_34699 = 34699; - public static final int NULL_34700 = 34700; - public static final int NULL_34701 = 34701; - public static final int NULL_34703 = 34703; - public static final int NULL_34704 = 34704; public static final int NULL_34707 = 34707; public static final int NULL_34708 = 34708; public static final int NULL_34709 = 34709; diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index e47f1533d9..dcc21803c3 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -11550,7 +11550,6 @@ public final class ObjectID public static final int COMPOST_BIN_20872 = 20872; public static final int CAGE_20873 = 20873; public static final int DUNGEON_ENTRANCE_20876 = 20876; - public static final int DUNGEON_ENTRANCE_20877 = 20877; public static final int EXIT_20878 = 20878; public static final int LOG_BALANCE_20882 = 20882; public static final int LOG_BALANCE_20884 = 20884; @@ -13891,14 +13890,9 @@ public final class ObjectID public static final int CHEST_26193 = 26193; public static final int LEVER_26194 = 26194; public static final int BIRTHDAY_CAKE = 26198; - public static final int BIRTHDAY_CAKE_26199 = 26199; - public static final int BIRTHDAY_CAKE_26200 = 26200; public static final int TABLE_26201 = 26201; public static final int TABLE_26202 = 26202; public static final int TABLE_26203 = 26203; - public static final int PRESENT = 26204; - public static final int PRESENT_26205 = 26205; - public static final int TABLE_26206 = 26206; public static final int LARGE_DOOR_26207 = 26207; public static final int WOODEN_BENCH_26210 = 26210; public static final int OAK_BENCH_26211 = 26211; @@ -18544,8 +18538,6 @@ public final class ObjectID public static final int ALCHEMICAL_TOPIARY = 34654; public static final int MYSTERIOUS_PIPE = 34655; public static final int CHEMICAL_WASTE_PIPE = 34656; - public static final int LIGHT_34657 = 34657; - public static final int LIGHT_34658 = 34658; public static final int THE_SHEARED_RAM = 34659; public static final int BRIMSTONE_CHEST = 34660; public static final int BRIMSTONE_CHEST_34661 = 34661; @@ -18559,10 +18551,6 @@ public final class ObjectID public static final int GANGPLANK_34670 = 34670; public static final int GANGPLANK_34671 = 34671; public static final int GANGPLANK_34672 = 34672; - public static final int LIGHT_34673 = 34673; - public static final int LIGHT_34674 = 34674; - public static final int LIGHT_34675 = 34675; - public static final int LIGHT_34676 = 34676; public static final int VERZIK_VITUR_DISPLAY = 34677; public static final int MAKING_FRIENDS_WITH_MY_ARM_DISPLAY = 34681; public static final int FIRE_34682 = 34682; @@ -18572,12 +18560,9 @@ public final class ObjectID public static final int LEATHER_SHIELDS = 34686; public static final int BRYOPHYTA_DISPLAY = 34687; public static final int BANNER_34688 = 34688; - public static final int BANNER_34689 = 34689; - public static final int BANQUET_TABLE_34696 = 34696; - public static final int PRESENT_TABLE_34697 = 34697; - public static final int BIRTHDAY_HAT_TABLE_34698 = 34698; - public static final int PARTY_BALLOONS_34702 = 34702; public static final int BLOOMING_HESPORI_SPROUT = 34705; public static final int SHRIVELLED_PLANT = 34706; + public static final int TWISTED_BUSH = 34712; + public static final int DUNGEON_ENTRANCE_34713 = 34713; /* This file is automatically generated. Do not edit. */ } From 776b120ae6328d5932faa5e6385209ba29d4e842 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 7 Mar 2019 11:33:02 +0000 Subject: [PATCH 219/304] Update NPC IDs to 2019-03-07-rev178 --- runelite-api/src/main/java/net/runelite/api/NpcID.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index 64b032dc50..0b6f19815a 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -6207,7 +6207,6 @@ public final class NpcID public static final int SPAWN_6768 = 6768; public static final int OSTEN = 6769; public static final int ARCIS = 6770; - public static final int COOK_6771 = 6771; public static final int LOVADA = 6772; public static final int DOOMSAYER = 6773; public static final int DOOMSAYER_6774 = 6774; @@ -6217,7 +6216,6 @@ public final class NpcID public static final int MAZE_GUARDIAN_6779 = 6779; public static final int PILIAR = 6780; public static final int SHAYDA = 6781; - public static final int HANS_6784 = 6784; public static final int HOSA = 6785; public static final int HELLRAT_BEHEMOTH = 6793; public static final int MONKEY_ARCHER_6794 = 6794; @@ -7265,7 +7263,6 @@ public final class NpcID public static final int GNOCCI_THE_COOK_7972 = 7972; public static final int DOLL = 7975; public static final int ARSEN_THE_THIEF = 7976; - public static final int HANS_7979 = 7979; public static final int YUSUF = 7981; public static final int YUSUF_7982 = 7982; public static final int FRANCOIS = 7983; @@ -7838,14 +7835,7 @@ public final class NpcID public static final int TAYLOR = 8629; public static final int VEOS_8630 = 8630; public static final int SEAMAN_MORRIS = 8631; - public static final int DUKE_HORACIO_8633 = 8633; public static final int ALCHEMICAL_HYDRA_8634 = 8634; - public static final int LUMBRIDGE_GUIDE_8635 = 8635; - public static final int KING_ROALD_8636 = 8636; - public static final int ELLAMARIA_8637 = 8637; - public static final int WISE_OLD_MAN_8638 = 8638; - public static final int GNOME_CHILD_8640 = 8640; - public static final int RANTZ_8641 = 8641; public static final int DODGY_GEEZER = 8644; /* This file is automatically generated. Do not edit. */ } From 580fcf4a3e1d1f7bb8d197dbb905ad1e79a0efff Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 7 Mar 2019 11:33:07 +0000 Subject: [PATCH 220/304] Update Widget IDs to 2019-03-07-rev178 --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index d8a4dba5cd..a8a1ec668e 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -135,7 +135,7 @@ public class WidgetID static final int SEARCH = 24; static final int SURFACE_SELECTOR = 32; static final int TOOLTIP = 38; - static final int OPTION = 42; + static final int OPTION = 43; } static class SlayerRewards @@ -294,7 +294,7 @@ public class WidgetID static final int TOGGLE_RUN_ORB = 22; // Has the "Toggle run" name static final int RUN_ORB_TEXT = 23; static final int SPEC_ORB = 28; - static final int WORLDMAP_ORB = 40; + static final int WORLDMAP_ORB = 41; } static class LoginClickToPlayScreen From 211739686128bbf273047ef22f6a3d9c0eb2bc02 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 7 Mar 2019 11:33:08 +0000 Subject: [PATCH 221/304] Update Scripts to 2019-03-07-rev178 --- .../src/main/scripts/BankSearchFilter.rs2asm | 2 +- .../src/main/scripts/BankSearchLayout.rs2asm | 2 +- .../scripts/ChatboxInputWidgetBuilder.hash | 2 +- .../scripts/ChatboxInputWidgetBuilder.rs2asm | 4 +- .../src/main/scripts/CommandScript.hash | 2 +- .../src/main/scripts/CommandScript.rs2asm | 44 +++++++++---------- .../src/main/scripts/PrivateMessage.hash | 2 +- .../src/main/scripts/PrivateMessage.rs2asm | 42 +++++++++--------- .../src/main/scripts/ResetChatboxInput.hash | 2 +- .../src/main/scripts/ResetChatboxInput.rs2asm | 4 +- 10 files changed, 53 insertions(+), 53 deletions(-) diff --git a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm index 80a0db4021..741c551317 100644 --- a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm +++ b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm @@ -12,7 +12,7 @@ if_icmpeq LABEL8 jump LABEL34 LABEL8: - get_varc_string 22 ; Skip truncating of varcstr 22 by not calling 280 + 049 359 ; Skip truncating of varcstr 22 by not calling 280 tolowercase ; instead get the var directly and lowercase it sstore 1 sload 1 diff --git a/runelite-client/src/main/scripts/BankSearchLayout.rs2asm b/runelite-client/src/main/scripts/BankSearchLayout.rs2asm index bd3bceac89..bf50394dad 100644 --- a/runelite-client/src/main/scripts/BankSearchLayout.rs2asm +++ b/runelite-client/src/main/scripts/BankSearchLayout.rs2asm @@ -646,7 +646,7 @@ LABEL593: if_icmpeq LABEL597 jump LABEL638 LABEL597: - get_varc_string 22 ; Skip truncating of varcstr 22 by not calling 280 + 049 359 ; Skip truncating of varcstr 22 by not calling 280 tolowercase ; instead get the var directly and lowercase it sstore 0 sload 0 diff --git a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.hash b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.hash index 5551428674..7e9ed52814 100644 --- a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.hash +++ b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.hash @@ -1 +1 @@ -19C3968C5E9D273E590A159140E658839878F48D00283DDFDADE81D86092C03E \ No newline at end of file +62630EDCE5CEB8733A496E2CAD89A4298F6EC05B8751DC6C9D2B25ED9D7BA391 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm index d20bcecbe7..63c13e7aee 100644 --- a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm @@ -32,10 +32,10 @@ LABEL23: iload 0 load_int 10616889 widget_put_textcolor_widget - get_varc_string 1 + 049 335 string_length istore 2 - get_varc_string 1 + 049 335 appendtags sstore 1 load_string "" diff --git a/runelite-client/src/main/scripts/CommandScript.hash b/runelite-client/src/main/scripts/CommandScript.hash index f305fd2eb9..c278c005ee 100644 --- a/runelite-client/src/main/scripts/CommandScript.hash +++ b/runelite-client/src/main/scripts/CommandScript.hash @@ -1 +1 @@ -59179DCB8961986539D1E5197DB9AAA6E99EA4FFC565BFAC768B55DE79DA0BCF \ No newline at end of file +2F7E219C24E4725FA8F3BCDD9F2A640666CC589B514FEBD9F5938B207F06C0EB \ No newline at end of file diff --git a/runelite-client/src/main/scripts/CommandScript.rs2asm b/runelite-client/src/main/scripts/CommandScript.rs2asm index 8d3de30e5f..eba8db6af1 100644 --- a/runelite-client/src/main/scripts/CommandScript.rs2asm +++ b/runelite-client/src/main/scripts/CommandScript.rs2asm @@ -27,7 +27,7 @@ LABEL10: LABEL19: return LABEL20: - get_varc_string 1 + 049 335 string_length istore 2 load_int 0 @@ -85,7 +85,7 @@ LABEL62: if_icmpgt LABEL67 jump LABEL178 LABEL67: - get_varc_string 1 + 049 335 load_string "/" load_int 0 string_indexof_from @@ -127,23 +127,23 @@ LABEL96: jump LABEL104 LABEL100: load_string "/" - get_varc_string 1 + 049 335 concat_string - put_varc_string 1 + 050 335 LABEL104: - get_varc_string 1 + 049 335 load_int 2 invoke 96 LABEL107: jump LABEL111 LABEL108: - get_varc_string 1 + 049 335 load_int 0 invoke 96 LABEL111: jump LABEL174 LABEL112: - get_varc_string 1 + 049 335 load_string "::" load_int 0 string_indexof_from @@ -156,7 +156,7 @@ LABEL119: if_icmpgt LABEL123 jump LABEL167 LABEL123: - get_varc_string 1 + 049 335 load_string "::toggleroof" load_int 0 string_indexof_from @@ -182,7 +182,7 @@ LABEL139: LABEL143: jump LABEL166 LABEL144: - get_varc_string 1 + 049 335 load_string "::bank" load_int 0 string_indexof_from @@ -197,13 +197,13 @@ LABEL151: invoke 96 jump LABEL166 LABEL155: - get_varc_string 1 + 049 335 invoke 224 - put_varc_string 1 - get_varc_string 1 + 050 335 + 049 335 string_length istore 2 - get_varc_string 1 + 049 335 load_int 2 iload 2 string_substring @@ -211,20 +211,20 @@ LABEL155: LABEL166: jump LABEL170 LABEL167: - get_varc_string 1 + 049 335 load_int 0 invoke 96 LABEL170: jump LABEL174 LABEL171: - get_varc_string 1 + 049 335 load_int 0 invoke 96 LABEL174: - get_varc_string 1 + 049 335 invoke 77 load_string "" - put_varc_string 1 + 050 335 LABEL178: jump LABEL247 LABEL179: @@ -261,19 +261,19 @@ LABEL199: if_icmpeq LABEL203 jump LABEL241 LABEL203: - get_varc_string + 049 356 string_length load_int 0 if_icmpgt LABEL208 jump LABEL228 LABEL208: - get_varc_string + 049 356 is_friend load_int 1 if_icmpeq LABEL213 jump LABEL216 LABEL213: - get_varc_string + 049 356 invoke 107 return LABEL216: @@ -308,7 +308,7 @@ LABEL233: return jump LABEL247 LABEL241: - get_varc_string 1 + 049 335 load_int 0 iload 0 iload 1 @@ -318,7 +318,7 @@ LABEL241: load_string "blockChatInput" ; runelite_callback ; if_icmpeq LABEL247 ; don't add to input varcstr - put_varc_string 1 + 050 335 LABEL247: invoke 223 return diff --git a/runelite-client/src/main/scripts/PrivateMessage.hash b/runelite-client/src/main/scripts/PrivateMessage.hash index ced7907d51..883f7d3747 100644 --- a/runelite-client/src/main/scripts/PrivateMessage.hash +++ b/runelite-client/src/main/scripts/PrivateMessage.hash @@ -1 +1 @@ -E9554C6591670564DEB0697E84125A1AAC2DECEFA00852CC564BC13B30E64AC8 \ No newline at end of file +BDBD51EF867D393E41B723CD28720A91E2ED34FAFF581AC69B37C648EAC7B714 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/PrivateMessage.rs2asm b/runelite-client/src/main/scripts/PrivateMessage.rs2asm index ed817dea14..c15cbc9dee 100644 --- a/runelite-client/src/main/scripts/PrivateMessage.rs2asm +++ b/runelite-client/src/main/scripts/PrivateMessage.rs2asm @@ -16,7 +16,7 @@ LABEL7: istore 0 load_string "" sstore 0 - get_varc_string 22 + 049 359 string_length istore 1 iload 1 @@ -60,7 +60,7 @@ LABEL30: if_icmpeq LABEL34 jump LABEL37 LABEL34: - get_varc_string 22 + 049 359 add_ignore jump LABEL43 LABEL37: @@ -69,7 +69,7 @@ LABEL37: if_icmpeq LABEL41 jump LABEL43 LABEL41: - get_varc_string 22 + 049 359 remove_ignore LABEL43: jump LABEL183 @@ -88,7 +88,7 @@ LABEL51: if_icmpeq LABEL55 jump LABEL58 LABEL55: - get_varc_string 22 + 049 359 add_friend jump LABEL106 LABEL58: @@ -97,7 +97,7 @@ LABEL58: if_icmpeq LABEL62 jump LABEL65 LABEL62: - get_varc_string 22 + 049 359 remove_friend jump LABEL106 LABEL65: @@ -140,12 +140,12 @@ LABEL94: if_icmpeq LABEL98 jump LABEL101 LABEL98: - get_varc_string 23 + 049 360 remove_friend jump LABEL104 LABEL101: - get_varc_string 23 - get_varc_string 22 + 049 360 + 049 359 load_string "privateMessage" ; load event name load_int 0 ; whether or not to skip runelite_callback ; invoke callback @@ -158,19 +158,19 @@ LABEL104: LABEL106: jump LABEL183 LABEL107: - get_varc_string 22 + 049 359 invoke 212 numeric_input jump LABEL183 LABEL111: - get_varc_string 22 + 049 359 string_remove_html - put_varc_string 128 - get_varc_string 22 + 050 361 + 049 359 string_input_1 jump LABEL183 LABEL117: - get_varc_string 22 + 049 359 string_input_2 jump LABEL183 LABEL120: @@ -186,10 +186,10 @@ LABEL124: send_game_message return LABEL130: - get_varc_string 22 + 049 359 string_remove_html - put_varc_string 129 - get_varc_string 22 + 050 362 + 049 359 join_clanchat jump LABEL183 LABEL136: @@ -198,14 +198,14 @@ LABEL136: if_icmpgt LABEL140 jump LABEL146 LABEL140: - get_varc_string 22 + 049 359 load_int 0 load_int 9 string_substring sstore 0 jump LABEL148 LABEL146: - get_varc_string 22 + 049 359 sstore 0 LABEL148: sload 0 @@ -227,10 +227,10 @@ LABEL158: send_game_message return LABEL164: - get_varc_string 22 + 049 359 load_int 0 put_varc 62 - put_varc_string 28 + 050 358 invoke 95 load_int 552 load_int -2147483645 @@ -246,7 +246,7 @@ LABEL176: return jump LABEL183 LABEL181: - get_varc_string 22 + 049 359 invoke 2061 LABEL183: jump LABEL190 diff --git a/runelite-client/src/main/scripts/ResetChatboxInput.hash b/runelite-client/src/main/scripts/ResetChatboxInput.hash index 9332eb1f8a..d60aa7f20e 100644 --- a/runelite-client/src/main/scripts/ResetChatboxInput.hash +++ b/runelite-client/src/main/scripts/ResetChatboxInput.hash @@ -1 +1 @@ -BA21C990EACCA53E54286CA139D58C3C7EA053BBB63C340B7BE4A0B91B156089 \ No newline at end of file +9D609388EF5AADA2ECA24164199191CF2A7C0098C19F798CCCAE4F6CCF73A041 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm b/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm index 2ab7967304..605608f9bd 100644 --- a/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm +++ b/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm @@ -4,7 +4,7 @@ .int_var_count 3 .string_var_count 0 load_string "resetChatboxInput" - runelite_callback + runelite_callback load_int 1 load_int 10616872 widget_put_hidden_widget @@ -50,7 +50,7 @@ LABEL32: jump LABEL40 LABEL38: load_string "" - put_varc_string 22 + 050 359 LABEL40: load_int 0 load_int -8 From d47e748bd606a0a04eec4a7d1f2577fadfb5c622 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 7 Mar 2019 04:53:31 -0700 Subject: [PATCH 222/304] runelite-api: Fix varcstrs for rev 178 --- .../src/main/java/net/runelite/api/VarClientStr.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/VarClientStr.java b/runelite-api/src/main/java/net/runelite/api/VarClientStr.java index 72f4ee0303..9667c56e74 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarClientStr.java +++ b/runelite-api/src/main/java/net/runelite/api/VarClientStr.java @@ -34,10 +34,10 @@ import lombok.Getter; @Getter public enum VarClientStr { - CHATBOX_TYPED_TEXT(1), - INPUT_TEXT(22), - PRIVATE_MESSAGE_TARGET(23), - RECENT_CLAN_CHAT(129); + CHATBOX_TYPED_TEXT(335), + INPUT_TEXT(359), + PRIVATE_MESSAGE_TARGET(360), + RECENT_CLAN_CHAT(362); private final int index; } From 353797561eeda48a1256f3d00a610947717d1a95 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 7 Mar 2019 14:05:18 +0000 Subject: [PATCH 223/304] [maven-release-plugin] prepare release runelite-parent-1.5.15 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 1c35833312..f4ffce05ed 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index d7599a0ee1..18c84d3b90 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 5a32517d5a..cb2c85ab17 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 2b7aeb8c46..c480dd3149 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index d300806562..e7d245e420 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 Web Service diff --git a/pom.xml b/pom.xml index adf3c58886..af5fc35cd1 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.15 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 600e4a4504..2eade1f3b7 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 1cdf3f73fa..04c48989da 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index eb2899e7fa..8fa129a0f6 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 001c3ef6e0..720d05eb14 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 0f25c82dae..650bccdb56 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 8252408774..17ce0b8e34 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index fe7235a473..3bf6763a00 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15-SNAPSHOT + 1.5.15 net.runelite.rs From ffe9f4602112d2d0d919afe96cfd75c08eda6e9d Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 7 Mar 2019 14:05:24 +0000 Subject: [PATCH 224/304] [maven-release-plugin] prepare for next development iteration --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index f4ffce05ed..94e5d7579f 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 18c84d3b90..4cccfd84ad 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index cb2c85ab17..308bdc1359 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index c480dd3149..9a8bb7805c 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index e7d245e420..5301855666 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index af5fc35cd1..b0e9cf092f 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.15 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 2eade1f3b7..52f2914ae8 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 04c48989da..7981a5ad43 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 8fa129a0f6..0456b0fdcd 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 720d05eb14..9e118b44f0 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 650bccdb56..5a230785a0 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 17ce0b8e34..3860a4a34c 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 3bf6763a00..e74de3f44f 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.15 + 1.5.16-SNAPSHOT net.runelite.rs From 0197bc9eec83b36366abed573043ef284c9ccce2 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Thu, 7 Mar 2019 15:25:52 +0000 Subject: [PATCH 225/304] wiki: Update the Fixed Minimap Clickbox to account for the spec orb --- .../wiki/fixed_mode_minimap_clickmask.png | Bin 2027 -> 654 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/wiki/fixed_mode_minimap_clickmask.png b/runelite-client/src/main/resources/net/runelite/client/plugins/wiki/fixed_mode_minimap_clickmask.png index e4f5fcbe48dab813a165f99d60a28acb3c4cb4ec..ba5a23c151ace7ac3e7ae774066ffc82b91c66ea 100644 GIT binary patch literal 654 zcmeAS@N?(olHy`uVBq!ia0vp^lYn>z2OE&&f3V>NkYY)9^mSxl*x1kgCy^D%=PdAu zEM{QfI|Ravq8eTeKtYKT*NBqf{Irtt#G+J&g2c?c61}|C5(N`ILp{?J_XwcLOgx@0 zjv*CsZ*My0-F6URb^QIWy)1!+No13$if&`FVW@+C+TZ(mc0jP-%3_II33u6Q#=A{- zvmCx3)H9v;J7K!id7~R4ha=f$XIY5yT+PsuSamVPAY}2%gcWYV2LpPSH7%6#Wpy^4 z#nqN&f~)|n<8(qW?{m8wOOF-HzX^K0lXdsihJDS>Jsr~xRN@XbRB$RY0lh&CXn0;* z_m_8Gk@O_Tk5isb$UCTLx+r=>H17+L;hTBPt`>kCX2T`7>L8ftX$nb}WLp@(!^3o1;Djul z{-*XUgZ^K~zgLU=pDyJyHTkCW_3*`!(;oluj0xv`zE9?eaiOp2ylBgo@FQQZH0(Rg zxW{PS(=Uv7kC)D|o0l5nBK!T#js~kYHwzg{Z%BT8_G*RkqqA27(~rzvz4%<0c^La# z(fl=hR@(O>WJ|()HvYN$!?X56q@gSC;|$!iq@gcJ{t7z1IeC@Tv5UVpq#qA4?OFUa z@qEwAED875kLQW*cLHg6VEpL%ibR>0pI`G&jEwnsHTL)xP>6fF`njxgN@xNAE|mj6 literal 2027 zcmcIlTWB0r7@la9B#@f45`wj1cCruEc6QFpUS?1yMev3cMSPKB>Y2TzN*eRx!r3`< z<~!g2egFCApPA8-;qI>cx-bmuP73ifx>nJ6qvLM$f6uk0pU|b#6rQj#Y{!Z_+Fswc zV>gD~^^2CtI@#0_UN(w8Q86UwD;G_K#;^m2%BCofK?j#$PSYdAuOEIw;F=O4jt5g9 zWyWA$6Q(S9Y-%JUPmRf(LL54XA1L#Ppa>liFBc2C&6guYjh9DrcbOva8pIik5JPT2 zJewNDV}=Fspf5zqbb!HG&PRs;#{~A{44_#GuoUel0nLLD@8|Hwk3i8ZMdj1+!;M(z zE<)rT$K)xhR4VyOexG6GD4OFq3NRGIkO)EAle#08N!=c7GQ^=RTbk);hK{?8qGXIa z5dtZ#TPT_>THS7>2_=jwizY?;fNQA0U`U$D0FGw>@25$?@&MGKDO3fD=!n|` z8;Yh*ZU>r5@k!lwL|ul-c!WTre43{4Qjk?uT4l)~U;xQT0fm&pVMt0rh6zBRNDQmi zbfNumLmqdN=kBi;tzyWCqm>`tAMgWO1`?@+0zs070h#20#E@ZC3c`>Kf$XQ7Y)35( zy*FavR#sP)f*56m4YI6XCRs`3$dDQUq!gfK(k})9%LD>UkoFU}BJ-+Y6-87fT2ahF z%G7fNzM&>&6bvh6C@AL$y|JE*#YQbd)e7i=ogR+j$wVwfbDSx%o$5YwukP_gxlr?9GD< z7yI6S`uyCfFT0Q4Twh&$b>_y;18uva?>>_Cu62F>pg5P^=Y6}9hzcE@p66zJc1EKD z?yaoc8C(7B?2>S)@>VLd54*cP z-rDYtPPEXov$jxaM|A%n-V__X18v?6+n{Oku6*x->ip!AtFSU#J|gsfbbU|w1L03@ zzWuYs)9-zA=Gv8qs%QGAzV6$#ync0MW$D{zY1-?h>HW3Q-&cL?65;Xc{nf8__qmFj zLHG0yxCFMbUo)=G^eaSnp@YnkCGs3CGi62gG qB+eiI%DxT4gcN!948Ya@$=CqpZ^ Date: Fri, 8 Mar 2019 03:56:17 -0700 Subject: [PATCH 226/304] runelite-client: Remove ChatboxInputManager It was superseded by ChatboxPanelManager and has been broken for a while now --- .../main/java/net/runelite/api/ScriptID.java | 9 - .../client/game/ChatboxInputManager.java | 158 ------------------ .../main/scripts/ChatboxInputHandler.rs2asm | 79 --------- .../src/main/scripts/ChatboxInputInit.rs2asm | 88 ---------- 4 files changed, 334 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java delete mode 100644 runelite-client/src/main/scripts/ChatboxInputHandler.rs2asm delete mode 100644 runelite-client/src/main/scripts/ChatboxInputInit.rs2asm diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index 6ac6aa42bb..68abc5e0f7 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -116,15 +116,6 @@ public final class ScriptID */ public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523; - /** - * Initializes the chatbox input to use RuneLite callbacks - *

    - *
  • String Prompt text
  • - *
  • String Default value
  • - *
- */ - public static final int RUNELITE_CHATBOX_INPUT_INIT = 10001; - /** * Does nothing * diff --git a/runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java b/runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java deleted file mode 100644 index ec8905e380..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.game; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.function.Consumer; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.ScriptID; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; - -@Singleton -public class ChatboxInputManager -{ - public static final int NO_LIMIT = Integer.MAX_VALUE; - private final Client client; - private final ClientThread clientThread; - - private Consumer done; - private Consumer changed; - private int characterLimit = NO_LIMIT; - - @Getter - private boolean open = false; - - @Inject - public ChatboxInputManager(Client client, ClientThread clientThread, EventBus eventBus) - { - this.client = client; - this.clientThread = clientThread; - eventBus.register(this); - } - - /** - * Opens a RuneScape-style chatbox input - * - * @param text Text to show at the top of the window - * @param defaul Default text in the editable field - * @param done Callback when the text box has been exited, called with "" on esc - */ - public void openInputWindow(String text, String defaul, Consumer done) - { - openInputWindow(text, defaul, NO_LIMIT, done); - } - - public void openInputWindow(String text, String defaul, int characterLimit, Consumer done) - { - openInputWindow(text, defaul, characterLimit, null, done); - } - - public void openInputWindow(String text, String defaul, int characterLimit, Consumer changed, Consumer done) - { - this.done = done; - this.changed = changed; - this.characterLimit = characterLimit; - this.open = true; - clientThread.invoke(() -> client.runScript( - ScriptID.RUNELITE_CHATBOX_INPUT_INIT, - text, - defaul - )); - } - - /** - * Closes the RuneScape-style chatbox input - */ - public void closeInputWindow() - { - if (!this.open) - { - return; - } - this.open = false; - clientThread.invoke(() -> client.runScript( - ScriptID.RESET_CHATBOX_INPUT, - 1, - 1 - )); - } - - @Subscribe - public void onScriptCallbackEvent(ScriptCallbackEvent ev) - { - // This replaces script 74 and most of 112 - if ("chatboxInputHandler".equals(ev.getEventName())) - { - int intStackSize = client.getIntStackSize(); - int stringStackSize = client.getStringStackSize(); - int typedKey = client.getIntStack()[--intStackSize]; - String str = client.getStringStack()[--stringStackSize]; - boolean isDone = false; - - switch (typedKey) - { - case 27: // Escape - str = ""; - // fallthrough - case '\n': - this.open = false; - isDone = true; - break; - case '\b': - if (!str.isEmpty()) - { - str = str.substring(0, str.length() - 1); - } - break; - default: - // If we wanted to do numbers only, we could add a limit here - if (typedKey >= 32 && (str.length() < characterLimit)) - { - str += Character.toString((char) typedKey); - } - } - - if (changed != null) - { - changed.accept(str); - } - - if (isDone && done != null) - { - done.accept(str); - } - - client.getStringStack()[stringStackSize++] = str; - client.getIntStack()[intStackSize++] = isDone ? 1 : 0; - client.setIntStackSize(intStackSize); - client.setStringStackSize(stringStackSize); - } - } -} diff --git a/runelite-client/src/main/scripts/ChatboxInputHandler.rs2asm b/runelite-client/src/main/scripts/ChatboxInputHandler.rs2asm deleted file mode 100644 index 106f53218e..0000000000 --- a/runelite-client/src/main/scripts/ChatboxInputHandler.rs2asm +++ /dev/null @@ -1,79 +0,0 @@ -; Copyright (c) 2018 Abex -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; 1. Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; 2. Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -;; -; Keylistener for ChatboxInputInit -; -; Script 112 Normal keylistener -; -; @param int pressedKey -; @param int typedKey -;; - -.id 10002 -.int_stack_count 1 -.string_stack_count 1 -.int_var_count 2 -.string_var_count 1 - -; If we are not the active listener, the widget ids have probably changed - get_varc 5 - load_int -2 - if_icmpeq LABEL2 - -; Log the error - load_string "Got input while not active; Widget ids in ChatboxInputInit are probably wrong." - load_string "debug" - runelite_callback - return - -LABEL2: -; Discard zero presses - iload 0 - load_int 0 - if_icmpeq LABEL1 - -; Call runelite - iload 0 - get_varc_string 22 - load_string "chatboxInputHandler" - runelite_callback - istore 0 - put_varc_string 22 - -; Check return value - iload 0 - load_int 1 - if_icmpne LABEL0 - -; Close the dialog - load_int 1 - load_int 1 - invoke 299 - -; Update UI -LABEL0: - load_string "" - invoke 222 -LABEL1: - return diff --git a/runelite-client/src/main/scripts/ChatboxInputInit.rs2asm b/runelite-client/src/main/scripts/ChatboxInputInit.rs2asm deleted file mode 100644 index a29faa76c6..0000000000 --- a/runelite-client/src/main/scripts/ChatboxInputInit.rs2asm +++ /dev/null @@ -1,88 +0,0 @@ -; Copyright (c) 2018 Abex -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; 1. Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; 2. Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -;; -; Creates a chatbox text input -; -; @param String Prompt text -; @param String Default value -; -; Script 752 GE input panel -; Script 103-111 various input panels -; Script 74 validates input -; script 112 key callback -;; - -.id 10001 -.int_stack_count 0 -.string_stack_count 2 -.int_var_count 0 -.string_var_count 2 - -; Hide the chat pane - invoke 677 - -; Set current value - sload 1 - put_varc_string 22 - -; Mark varcstring22 for our use - load_int -2 - put_varc 5 - -; Set text - sload 0 - load_int 10616876 - widget_put_text_widget - -; Init the widgets - load_string "" - invoke 222 - -; Register the key listener - load_int 10002 - load_int -2147483639 ; typedKey - load_string "i" - load_int 10616877 - widget_put_key_listener_widget - -; Restore the chatbox on exit - load_int 299 - load_int 1 - load_int 1 - load_string "ii" - load_int 10616877 - widget_put_dialog_abort_listener_widget - -; 70% sure this opens the keyboard on mobile - invoke 1972 - load_int 1 - if_icmpeq LABEL25 - jump LABEL26 -LABEL25: - load_int 1 - load_int 10 - invoke 1983 -LABEL26: - - return From 75fbb07b415ceadca6b5371ce2d4f93567d450aa Mon Sep 17 00:00:00 2001 From: Max Weber Date: Fri, 8 Mar 2019 04:00:44 -0700 Subject: [PATCH 227/304] cache: use RuneStar cs2 opcode names With exception of the opcodes with jvm analogues, which follow jvm style --- .../definitions/loaders/ScriptLoader.java | 4 +- .../cache/definitions/savers/ScriptSaver.java | 4 +- .../runelite/cache/script/Instruction.java | 44 - .../runelite/cache/script/Instructions.java | 991 +++++++++--------- .../net/runelite/cache/script/Opcodes.java | 808 +++++++------- .../script/disassembler/Disassembler.java | 2 +- .../runelite/script/RuneLiteInstructions.java | 2 +- 7 files changed, 921 insertions(+), 934 deletions(-) diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/ScriptLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/ScriptLoader.java index 6f8512695a..e77964a5ca 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/ScriptLoader.java +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/ScriptLoader.java @@ -28,7 +28,7 @@ import java.util.HashMap; import java.util.Map; import net.runelite.cache.definitions.ScriptDefinition; import net.runelite.cache.io.InputStream; -import static net.runelite.cache.script.Opcodes.LOAD_STRING; +import static net.runelite.cache.script.Opcodes.SCONST; import static net.runelite.cache.script.Opcodes.POP_INT; import static net.runelite.cache.script.Opcodes.POP_STRING; import static net.runelite.cache.script.Opcodes.RETURN; @@ -94,7 +94,7 @@ public class ScriptLoader for (int i = 0; in.getOffset() < endIdx; instructions[i++] = opcode) { opcode = in.readUnsignedShort(); - if (opcode == LOAD_STRING) + if (opcode == SCONST) { stringOperands[i] = in.readString(); } diff --git a/cache/src/main/java/net/runelite/cache/definitions/savers/ScriptSaver.java b/cache/src/main/java/net/runelite/cache/definitions/savers/ScriptSaver.java index c1fae2e995..3b130c4c53 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/savers/ScriptSaver.java +++ b/cache/src/main/java/net/runelite/cache/definitions/savers/ScriptSaver.java @@ -28,7 +28,7 @@ import java.util.Map; import java.util.Map.Entry; import net.runelite.cache.definitions.ScriptDefinition; import net.runelite.cache.io.OutputStream; -import static net.runelite.cache.script.Opcodes.LOAD_STRING; +import static net.runelite.cache.script.Opcodes.SCONST; import static net.runelite.cache.script.Opcodes.POP_INT; import static net.runelite.cache.script.Opcodes.POP_STRING; import static net.runelite.cache.script.Opcodes.RETURN; @@ -48,7 +48,7 @@ public class ScriptSaver { int opcode = instructions[i]; out.writeShort(opcode); - if (opcode == LOAD_STRING) + if (opcode == SCONST) { out.writeString(stringOperands[i]); } diff --git a/cache/src/main/java/net/runelite/cache/script/Instruction.java b/cache/src/main/java/net/runelite/cache/script/Instruction.java index 8eb8a2bb3f..b369c97de5 100644 --- a/cache/src/main/java/net/runelite/cache/script/Instruction.java +++ b/cache/src/main/java/net/runelite/cache/script/Instruction.java @@ -28,10 +28,6 @@ public class Instruction { private final int opcode; private String name; - private int intStackPops; - private int stringStackPops; - private int intStackPushes; - private int stringStackPushes; public Instruction(int opcode) { @@ -52,44 +48,4 @@ public class Instruction { this.name = name; } - - public int getIntStackPops() - { - return intStackPops; - } - - public void setIntStackPops(int intStackPops) - { - this.intStackPops = intStackPops; - } - - public int getStringStackPops() - { - return stringStackPops; - } - - public void setStringStackPops(int stringStackPops) - { - this.stringStackPops = stringStackPops; - } - - public int getIntStackPushes() - { - return intStackPushes; - } - - public void setIntStackPushes(int intStackPushes) - { - this.intStackPushes = intStackPushes; - } - - public int getStringStackPushes() - { - return stringStackPushes; - } - - public void setStringStackPushes(int stringStackPushes) - { - this.stringStackPushes = stringStackPushes; - } } diff --git a/cache/src/main/java/net/runelite/cache/script/Instructions.java b/cache/src/main/java/net/runelite/cache/script/Instructions.java index 94755ab986..17dfabfcd1 100644 --- a/cache/src/main/java/net/runelite/cache/script/Instructions.java +++ b/cache/src/main/java/net/runelite/cache/script/Instructions.java @@ -1,5 +1,7 @@ /* * Copyright (c) 2017, Adam + * Copyright (c) 2018-2019, Hunter WB + * Copyright (c) 2019, Abex * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,516 +37,480 @@ public class Instructions public void init() { - add(LOAD_INT, "load_int", 0, 1); - add(GET_VARP, "get_varp", 0, 1); - add(PUT_VARP, "put_varp", 0, 1); - add(LOAD_STRING, "load_string", 0, 0, 0, 1); - add(JUMP, "jump", 0, 0); - add(IF_ICMPNE, "if_icmpne", 2, 0); - add(IF_ICMPEQ, "if_icmpeq", 2, 0); - add(IF_ICMPLT, "if_icmplt", 2, 0); - add(IF_ICMPGT, "if_icmpgt", 2, 0); - add(RETURN, "return", 0, 0); - add(GET_VARBIT, "get_varbit", 0, 1); - add(SET_VARBIT, "set_varbit", 1, 0); - add(IF_ICMPLE, "if_icmple", 2, 0); - add(IF_ICMPGE, "if_icmpge", 2, 0); - add(ILOAD, "iload", 0, 1); - add(ISTORE, "istore", 1, 0); - add(SLOAD, "sload", 0, 0, 0, 1); - add(SSTORE, "sstore", 0, 0, 1, 0); - add(STRING_APPEND, "string_append", 0, 0, -1, 1); - add(POP_INT, "pop_int", 1, 0); - add(POP_STRING, "pop_string", 0, 0, 1, 0); - add(INVOKE, "invoke", -1, -1, -1, -1); - add(GET_VARC, "get_varc", 0, 1); - add(PUT_VARC, "put_varc", 1, 0); - add(ARRAY_INITIALIZE, "array_initialize", 1, 0); - add(ARRAY_LOAD, "array_load", 1, 1); - add(ARRAY_STORE, "array_store", 2, 0); - add(GET_VARC_STRING, "get_varc_string", 0, 0, 0, 1); - add(PUT_VARC_STRING, "put_varc_string", 0, 0, 1, 0); - add(GET_VARC_STRING_2, "get_varc_string2", 0, 0, 0, 1); - add(PUT_VARC_STRING_2, "put_varc_string2", 0, 0, 1, 0); - add(SWITCH, "switch", 1, 0); - add(WIDGET_CREATE_CHILD, "widget_create_child", 3, 0); - add(WIDGET_DESTROY_CHILD, "widget_destroy_child", 0, 0); - add(WIDGET_UNSET_CHILDREN, "widget_unset_children", 1, 0); - add(WIDGET_LOAD_CHILD, "widget_load_child", 2, 1); - add(WIDGET_LOAD, "widget_load", 1, 1); - // 2000-2100 are the same as 1000-1100, but - // pop an additional int which is used to get the current widget - add(WIDGET_PUT_POSITION, "widget_put_position", 4, 0); - add(WIDGET_PUT_SIZE, "widget_put_size", 4, 0); - add(WIDGET_PUT_HIDDEN, "widget_put_hidden", 1, 0); - add(WIDGET_PUT_NO_CLICK_THROUGH, "widget_put_no_click_through", 1, 0); - add(1006, 1, 0); - // 2100-2200 and 1100-1200 do the same thing - add(WIDGET_PUT_SCROLL, "widget_put_scroll", 2, 0); - add(WIDGET_PUT_TEXTCOLOR, "widget_put_textcolor", 1, 0); - add(WIDGET_PUT_FILLED, "widget_put_filled", 1, 0); - add(WIDGET_PUT_OPACITY, "widget_put_opacity", 1, 0); - add(WIDGET_PUT_LINE_WIDTH, "widget_put_line_width", 1, 0); - add(WIDGET_PUT_SPRITEID, "widget_put_spriteid", 1, 0); - add(WIDGET_PUT_TEXTUREID, "widget_put_textureid", 1, 0); - add(WIDGET_PUT_SPRITE_TILING, "widget_put_sprite_tiling", 1, 0); - add(WIDGET_PUT_MODELID_1, "widget_put_modelid_1", 1, 0); - add(WIDGET_PUT_3D_ROTATION, "widget_put_3d_rotation", 6, 0); - add(WIDGET_PUT_ANIMATION, "widget_put_animation", 1, 0); - add(1111, 1, 0); - add(WIDGET_PUT_TEXT, "widget_put_text", 0, 0, 1, 0); - add(WIDGET_PUT_FONTID, "widget_put_fontid", 1, 0); - add(WIDGET_PUT_TEXT_ALIGNMENT, "widget_put_text_alignment", 3, 0); - add(WIDGET_PUT_TEXT_SHADOWED, "widget_put_text_shadowed", 1, 0); - add(WIDGET_PUT_BORDERTHICKNESS, "widget_put_borderthickness", 1, 0); - add(WIDGET_PUT_SPRITE2, "widget_put_sprite2", 1, 0); - add(WIDGET_PUT_FLIPPEDVERTICALLY, "widget_put_flippedvertically", 1, 0); - add(WIDGET_PUT_FLIPPEDHORIZONALLY, "widget_put_flippedhorizonally", 1, 0); - add(WIDGET_PUT_SCROLLWIDTHHEIGHT, "widget_put_scrollwidthheight", 2, 0); - add(WIDGET_ADVANCE_DIALOGUE, "widget_advance_dialogue", 0, 0); - add(1122, 1, 0); - add(1123, 1, 0); - add(1124, 1, 0); - add(1125, 1, 0); - // and 1200-1300 and 2200-2300 - add(WIDGET_PUT_MODELID_2, "widget_put_modelid_2", 1, 0); - add(WIDGET_PUT_MODELID_3, "widget_put_modelid_3", 0, 0); - add(1200, 2, 0); - add(1205, 2, 0); - add(1212, 2, 0); - // and 1300-1400 and 2300-2400 - add(WIDGET_PUT_ACTION, "widget_put_action", 1, 0, 1, 0); - add(WIDGET_PUT_DRAG_PARENT, "widget_put_drag_parent", 2, 0); - add(1302, 1, 0); - add(1303, 1, 0); - add(1304, 1, 0); - add(WIDGET_PUT_NAME, "widget_put_name", 0, 0, 1, 0); - add(WIDGET_PUT_SELECTED_ACTION, "widget_put_selected_action", 0, 0, 1, 0); - add(WIDGET_PUT_ACTIONS_NULL, "widget_put_actions_null", 0, 0); - // and 1400-1500 and 2400-2500 - add(WIDGET_PUT_MOUSE_PRESS_LISTENER, "widget_put_mouse_press_listener", -1, 0, -1, 0); - add(WIDGET_PUT_DRAGGED_OVER_LISTENER, "widget_put_mouse_dragged_over_listener", -1, 0, -1, 0); - add(WIDGET_PUT_MOUSE_RELEASE_LISTENER, "widget_put_mouse_release_listener", -1, 0, -1, 0); - add(WIDGET_PUT_MOUSE_ENTER_LISTENER, "widget_put_mouse_enter_listener", -1, 0, -1, 0); - add(WIDGET_PUT_MOUSE_EXIT_LISTENER, "widget_put_mouse_exit_listener", -1, 0, -1, 0); - add(WIDGET_PUT_DRAG_START_LISTENER, "widget_put_drag_start_listener", -1, 0, -1, 0); - add(WIDGET_PUT_USE_WITH_LISTENER, "widget_put_use_with_listener", -1, 0, -1, 0); - add(WIDGET_PUT_CONFIG_LISTENER, "widget_put_config_listener", -1, 0, -1, 0); - add(WIDGET_PUT_RENDER_LISTENER, "widget_put_render_listener", -1, 0, -1, 0); - add(WIDGET_PUT_OPTION_CLICK_LISTENER, "widget_put_option_click_listener", -1, 0, -1, 0); - add(WIDGET_PUT_DRAG_RELEASE_LISTENER, "widget_put_drag_release_listener", -1, 0, -1, 0); - add(WIDGET_PUT_DRAG_LISTENER, "widget_put_drag_listener", -1, 0, -1, 0); - add(WIDGET_PUT_MOUSE_HOVER_LISTENER, "widget_put_mouse_hover_listener", -1, 0, -1, 0); - add(WIDGET_PUT_TABLE_LISTENER, "widget_put_table_listener", -1, 0, -1, 0); - add(WIDGET_PUT_SKILL_LISTENER, "widget_put_skill_listener", -1, 0, -1, 0); - add(WIDGET_PUT_USE_LISTENER, "widget_put_use_listener", -1, 0, -1, 0); - add(WIDGET_PUT_SCROLL_LISTENER, "widget_put_scroll_listener", -1, 0, -1, 0); - add(WIDGET_PUT_MSG_LISTENER, "widget_put_msg_listener", -1, 0, -1, 0); - add(WIDGET_PUT_KEY_LISTENER, "widget_put_key_listener", -1, 0, -1, 0); - add(WIDGET_PUT_FRIENDS_LISTENER, "widget_put_friends_listener", -1, 0, -1, 0); - add(WIDGET_PUT_CLAN_LISTENER, "widget_put_clan_listener", -1, 0, -1, 0); - add(WIDGET_PUT_DIALOG_ABORT_LISTENER, "widget_put_dialog_abort_listener", -1, 0, -1, 0); - add(WIDGET_PUT_OPENCLOSE_LISTENER, "widget_put_openclose_listener", -1, 0, -1, 0); - add(WIDGET_PUT_GE_LISTENER, "widget_put_ge_listener", -1, 0, -1, 0); - add(WIDGET_PUT_RESIZE_LISTENER, "widget_put_resize_listener", -1, 0, -1, 0); - // and 1500-1600 and 2500-2600 - add(WIDGET_GET_RELATIVEX, "widget_get_relativex", 0, 1); - add(WIDGET_GET_RELATIVEY, "widget_get_relativey", 0, 1); - add(WIDGET_GET_WIDTH, "widget_get_width", 0, 1); - add(WIDGET_GET_HEIGHT, "widget_get_height", 0, 1); - add(WIDGET_GET_HIDDEN, "widget_get_hidden", 0, 1); - add(WIDGET_GET_PARENTID, "widget_get_parentid", 0, 1); - // and 1600-1700 and 2600-2700 - add(WIDGET_GET_SCROLLX, "widget_get_scrollx", 0, 1); - add(WIDGET_GET_SCROLLY, "widget_get_scrolly", 0, 1); - add(WIDGET_GET_TEXT, "widget_get_text", 0, 0, 0, 1); - add(WIDGET_GET_SCROLLWIDTH, "widget_get_scrollwidth", 0, 1); - add(WIDGET_GET_SCROLLHEIGHT, "widget_get_scrollheight", 0, 1); - add(WIDGET_GET_MODELZOOM, "widget_get_modelzoom", 0, 1); - add(WIDGET_GET_ROTATIONX, "widget_get_rotationx", 0, 1); - add(WIDGET_GET_ROTATIONY, "widget_get_rotationy", 0, 1); - add(WIDGET_GET_ROTATIONZ, "widget_get_rotationz", 0, 1); - add(WIDGET_GET_OPACITY, "widget_get_opacity", 0, 1); - add(1610, 0, 1); - add(WIDGET_GET_TEXTCOLOR, "widget_get_textcolor", 0, 1); - add(1612, 0, 1); - add(1613, 0, 1); - // 1700 - add(WIDGET_GET_ITEMID, "widget_get_itemid", 0, 1); - add(WIDGET_GET_STACKSIZE, "widget_get_stacksize", 0, 1); - add(WIDGET_GET_INDEX, "widget_get_index", 0, 1); - add(WIDGET_GET_CONFIG, "widget_get_config", 0, 1); - add(WIDGET_GET_ACTION, "widget_get_action", 1, 0, 0, 1); - add(WIDGET_GET_NAME, "widget_get_name", 0, 0, 0, 1); - // and 1900-2000 and 2900-3000 - add(1927, 0, 0); - // 2000-2100 - add(WIDGET_PUT_POSITION_WIDGET, "widget_put_position_widget", 5, 0); - add(WIDGET_PUT_SIZE_WIDGET, "widget_put_size_widget", 5, 0); - add(WIDGET_PUT_HIDDEN_WIDGET, "widget_put_hidden_widget", 2, 0); - add(WIDGET_PUT_NO_CLICK_THROUGH_WIDGET, "widget_put_no_click_through_widget", 2, 0); - add(2006, 2, 0); - // 2100-2200 - add(WIDGET_PUT_SCROLL_WIDGET, "widget_put_scroll_widget", 3, 0); - add(WIDGET_PUT_TEXTCOLOR_WIDGET, "widget_put_textcolor_widget", 2, 0); - add(WIDGET_PUT_FILLED_WIDGET, "widget_put_filled_widget", 2, 0); - add(WIDGET_PUT_OPACITY_WIDGET, "widget_put_opacity_widget", 2, 0); - add(WIDGET_PUT_LINE_WIDTH_WIDGET, "widget_put_line_width_widget", 2, 0); - add(WIDGET_PUT_SPRITEID_WIDGET, "widget_put_spriteid_widget", 2, 0); - add(WIDGET_PUT_TEXTUREID_WIDGET, "widget_put_textureid_widget", 2, 0); - add(WIDGET_PUT_SPRITE_TILING_WIDGET, "widget_put_sprite_tiling_widget", 2, 0); - add(WIDGET_PUT_MODELID_1_WIDGET, "widget_put_modelid_1_widget", 2, 0); - add(WIDGET_PUT_3D_ROTATION_WIDGET, "widget_put_3d_rotation_widget", 7, 0); - add(WIDGET_PUT_ANIMATION_WIDGET, "widget_put_animation_widget", 2, 0); - add(2111, 2, 0); - add(WIDGET_PUT_TEXT_WIDGET, "widget_put_text_widget", 1, 0, 1, 0); - add(WIDGET_PUT_FONTID_WIDGET, "widget_put_fontid_widget", 2, 0); - add(WIDGET_PUT_TEXT_ALIGNMENT_WIDGET, "widget_put_text_alignment_widget", 4, 0); - add(WIDGET_PUT_TEXT_SHADOWED_WIDGET, "widget_put_text_shadowed_widget", 2, 0); - add(WIDGET_PUT_BORDERTHICKNESS_WIDGET, "widget_put_borderthickness_widget", 2, 0); - add(WIDGET_PUT_SPRITE2_WIDGET, "widget_put_sprite2_widget", 2, 0); - add(WIDGET_PUT_FLIPPEDVERTICALLY_WIDGET, "widget_put_flippedvertically_widget", 2, 0); - add(WIDGET_PUT_FLIPPEDHORIZONALLY_WIDGET, "widget_put_flippedhorizonally_widget", 2, 0); - add(WIDGET_PUT_SCROLLWIDTHHEIGHT_WIDGET, "widget_put_scrollwidthheight_widget", 3, 0); - add(WIDGET_ADVANCE_DIALOGUE_WIDGET, "widget_advance_dialogue_window", 1, 0); - add(2122, 2, 0); - add(2123, 2, 0); - add(2124, 2, 0); - add(2125, 2, 0); - // 2200-2300 - add(WIDGET_PUT_MODELID_2_WIDGET, "widget_put_modelid_2_widget", 2, 0); - add(WIDGET_PUT_MODELID_3_WIDGET, "widget_put_modelid_3_widget", 1, 0); - add(2200, 3, 0); - add(2205, 3, 0); - add(2212, 3, 0); - // 2300-2400 - add(WIDGET_PUT_ACTION_WIDGET, "widget_put_action_widget", 2, 0, 1, 0); - add(WIDGET_PUT_DRAG_PARENT_WIDGET, "widget_put_drag_parent_widget", 3, 0); - add(2302, 2, 0); - add(2303, 2, 0); - add(2304, 2, 0); - add(WIDGET_PUT_NAME_WIDGET, "widget_put_name_widget", 1, 0, 1, 0); - add(WIDET_PUT_SELECTED_ACTION_WIDGET, "widget_put_selected_action_widget", 1, 0, 1, 0); - add(WIDGET_PUT_ACTIONS_NULL_WIDGET, "widget_put_actions_null_widget", 1, 0); - // 2400-2500 - add(WIDGET_PUT_MOUSE_PRESS_LISTENER_WIDGET, "widget_put_mouse_press_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_DRAGGED_OVER_LISTENER_WIDGET, "widget_put_dragged_over_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_MOUSE_RELEASE_LISTENER_WIDGET, "widget_put_mouse_release_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_MOUSE_ENTER_LISTENER_WIDGET, "widget_put_mouse_enter_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_MOUSE_EXIT_LISTENER_WIDGET, "widget_put_mouse_exit_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_DRAG_START_LISTENER_WIDGET, "widget_put_drag_start_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_USE_WITH_LISTENER_WIDGET, "widget_put_mouse_use_with_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_CONFIG_LISTENER_WIDGET, "widget_put_config_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_RENDER_LISTENER_WIDGET, "widget_put_render_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_OPTION_CLICK_LISTENER_WIDGET, "widget_put_option_click_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_DRAG_RELEASE_LISTENER_WIDGET, "widget_put_drag_release_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_DRAG_LISTENER_WIDGET, "widget_put_drag_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_MOUSE_HOVER_LISTENER_WIDGET, "widget_put_mouse_hover_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_TABLE_LISTENER_WIDGET, "widget_put_table_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_SKILL_LISTENER_WIDGET, "widget_put_skill_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_USE_LISTENER_WIDGET, "widget_put_use_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_SCROLL_LISTENER_WIDGET, "widget_put_scroll_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_MSG_LISTENER_WIDGET, "widget_put_msg_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_KEY_LISTENER_WIDGET, "widget_put_key_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_FRIENDS_LISTENER_WIDGET, "widget_put_friends_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_CLAN_LISTENER_WIDGET, "widget_put_clan_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_DIALOG_ABORT_LISTENER_WIDGET, "widget_put_dialog_abort_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_OPENCLOSE_LISTENER_WIDGET, "widget_put_openclose_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_GE_LISTENER_WIDGET, "widget_put_ge_listener_widget", -1, 0, -1, 0); - add(WIDGET_PUT_RESIZE_LISTENER_WIDGET, "widget_put_resize_listener_widget", -1, 0, -1, 0); - // 2500-2600 - add(WIDGET_GET_RELATIVEX_WIDGET, "widget_get_relativex_widget", 1, 1); - add(WIDGET_GET_RELATIVEY_WIDGET, "widget_get_relativey_widget", 1, 1); - add(WIDGET_GET_WIDTH_WIDGET, "widget_get_width_widget", 1, 1); - add(WIDGET_GET_HEIGHT_WIDGET, "widget_get_height_widget", 1, 1); - add(WIDGET_GET_HIDDEN_WIDGET, "widget_get_hidden_widget", 1, 1); - add(WIDGET_GET_PARENTID_WIDGET, "widget_get_parentid_widget", 1, 1); - // 2600-2700 - add(WIDGET_GET_SCROLLX_WIDGET, "widget_get_scrollx_widget", 1, 1); - add(WIDGET_GET_SCROLLY_WIDGET, "widget_get_scrolly_widget", 1, 1); - add(WIDGET_GET_TEXT_WIDGET, "widget_get_text_widget", 1, 0, 0, 1); - add(WIDGET_GET_SCROLLWIDTH_WIDGET, "widget_get_scrollwidth_widget", 1, 1); - add(WIDGET_GET_SCROLLHEIGHT_WIDGET, "widget_get_scrollheight_widget", 1, 1); - add(WIDGET_GET_MODELZOOM_WIDGET, "widget_get_modelzoom_widget", 1, 1); - add(WIDGET_GET_ROTATIONX_WIDGET, "widget_get_rotationx_widget", 1, 1); - add(WIDGET_GET_ROTATIONY_WIDGET, "widget_get_rotationy_widget", 1, 1); - add(WIDGET_GET_ROTATIONZ_WIDGET, "widget_get_rotationz_widget", 1, 1); - add(WIDGET_GET_OPACITY_WIDGET, "widget_get_opacity_widget", 1, 1); - add(2610, 1, 1); - add(WIDGET_GET_TEXTCOLOR_WIDGET, "widget_get_textcolor_widget", 1, 1); - add(2612, 1, 1); - add(2613, 1, 1); - // 2700-2800 - add(WIDGET_GET_ITEMID_WIDGET, "widget_get_itemid_widget", 1, 1); - add(WIDGET_GET_STACKSIZE_WIDGET, "widget_get_stacksize_widget", 1, 1); - add(WIGET_GET_INDEX_WIDGET, "widget_get_index_widget", 1, 1); - add(GET_WIDGET_ROOT, "get_widget_root", 0, 1); - // 2800-2900 - add(WIDGET_GET_CONFIG_WIGET, "widget_get_config_widget", 1, 1); - add(WIDGET_GET_ACTION_WIDGET, "widget_get_action_widget", 2, 0, 0, 1); - add(WIDGET_GET_NAME_WIDGET, "widget_get_name_widget", 1, 0, 0, 1); - // 2900-3000 - add(2927, 1, 0); - // 3000-3200 - add(SEND_GAME_MESSAGE, "send_game_message", 0, 0, 1, 0); - add(PLAYER_ANIMATE, "player_animate", 2, 0); - add(CLOSE_WINDOW, "close_window", 0, 0); - add(NUMERIC_INPUT, "numeric_input", 0, 0, 1, 0); - add(STRING_INPUT_1, "string_input_1", 0, 0, 1, 0); - add(STRING_INPUT_2, "string_input_2", 0, 0, 1, 0); - add(PLAYER_ACTION, "player_action", 1, 0, 1, 0); - add(SET_TOP_CONTEXT_MENU_ROW, "set_top_context_menu_row", 3, 0); - add(SET_TOP_CONTEXT_MENU_ROW_2, "set_top_context_menu_row_2", 2, 0); - add(SET_MOUSE_BUTTON_CONTROLS_CAMERA, "set_mouse_button_controls_camera", 1, 0); - add(GET_HIDEROOFS, "get_hideroofs", 0, 1); - add(SET_HIDEROOFS, "set_hideroofs", 1, 0); - add(OPEN_URL, "open_url", 1, 0, 1, 0); - add(ITEM_PRICE, "item_price", 1, 0); - add(SEND_BUG_REPORT, "send_bug_report", 1, 0, 2, 0); - add(SET_SHIFT_DROP_ENABLED, "set_shift_drop_enabled", 1, 0); - add(SET_CONNECTION_TEXT_ENABLED, "set_connection_text_enabled", 1, 0); - // 3200-3300 - add(PLAY_SOUND_EFFECT, "play_sound_effect", 3, 0); - add(3201, 1, 0); - add(3202, 2, 0); - // 3300-3400 - add(GET_GAMECYCLE, "get_gamecycle", 0, 1); - add(GET_ITEMCONTAINER_ITEMID, "get_itemcontainer_itemid", 2, 0); - add(GET_ITEMCONTAINER_STACKSIZE, "get_itemcontainer_stacksize", 2, 1); - add(GET_ITEMCONTAINER_STACKSIZES_TOTAL, "get_itemcontainer_stacksizes_total", 2, 1); - add(GET_INVENTORY_SIZE, "get_inventory_size", 1, 1); - add(GET_BOOSTEDSKILLLEVELS, "get_boostedskilllevels", 1, 1); - add(GET_REALSKILLLEVELS, "get_realskilllevels", 1, 1); - add(GET_SKILLEXPERIENCES, "get_skillexperiences", 1, 1); - add(GET_COORDINATES, "get_coordinates", 0, 1); - add(DIVIDE_BY_16384, "divide_by_16384", 1, 1); - add(RIGHT_SHIFT_28, "right_shift_28", 1, 1); - add(AND_16384, "and_16384", 1, 1); - add(GET_ISMEMBERS, "get_ismembers", 0, 1); - add(GET_ITEMCONTAINER_ITEMID_2, "get_itemcontainer_itemid_2", 2, 1); - add(GET_ITEMCONTAINER_STACKSIZE_2, "get_itemcontainer_stacksize_2", 2, 1); - add(GET_ITEMCONTAINER_STACKSIZES_TOTAL_2, "get_itemcontainer_stacksizes_total_2", 2, 1); - add(GET_RIGHTS, "get_rights", 0, 1); - add(GET_SYSTEM_UPDATE_TIMER, "get_system_update_timer", 0, 1); - add(GET_WORLDNUM, "get_worldnum", 0, 1); - add(GET_ENERGY, "get_energy", 0, 1); - add(GET_WEIGHT, "get_weight", 0, 1); - add(GET_PLAYERMOD, "get_playermod", 0, 1); - add(GET_FLAGS, "get_flags", 0, 1); - add(PACK_LOCATION, "pack_location", 4, 1); - // 3400-3500 - add(3400, 2, 0, 0, 1); - add(GET_ENUM_VALUE, "get_enum_value", 4, -1, 0, -1); // this pushes an int or a string, depending on the argument - // 3500-3700 - add(GET_FRIENDCOUNT, "get_friendcount", 0, 1); - add(GET_FRIEND, "get_friend", 1, 0, 0, 2); - add(GET_FRIEND_WORLD, "get_friend_world", 1, 1); - add(GET_FRIEND_RANK, "get_friend_rank", 1, 1); - add(3604, 1, 0, 1, 0); - add(ADD_FRIEND, "add_friend", 0, 0, 1, 0); - add(REMOVE_FRIEND, "remove_friend", 0, 0, 1, 0); - add(ADD_IGNORE, "add_ignore", 0, 0, 1, 0); - add(REMOVE_IGNORE, "remove_ignore", 0, 0, 1, 0); - add(IS_FRIEND, "is_friend", 0, 1, 1, 0); - add(GET_CLANCHAT_OWNER, "get_clanchat_owner", 0, 0, 0, 1); - add(GET_CLANCHATCOUNT, "get_clanchatcount", 0, 1); - add(GET_CLAN_MEMBER_NAME, "get_clan_member_name", 1, 0, 0, 1); - add(GET_CLAN_MEMBER_WORLD, "get_clan_member_world", 1, 1); - add(GET_CLAN_MEMBER_RANK, "get_clan_member_rank", 1, 1); - add(CLANCHAT_KICK_RANK, "clanchat_kick_rank", 0, 1); - add(CLANCHAT_KICK_CLANMEMBER, "clanchat_kick_clanmember", 0, 0, 1, 0); - add(GET_CLANCHAT_RANK, "get_clanchat_rank", 0, 1); - add(JOIN_CLANCHAT, "join_clanchat", 0, 0, 1, 0); - add(PART_CLANCHAT, "part_clanchat", 0, 0); - add(GET_IGNORECOUNT, "get_ignorecount", 0, 1); - add(GET_IGNORE, "get_ignore", 1, 0, 0, 2); - add(IS_IGNORE, "is_ignore", 0, 1, 1, 0); - add(CLANMEMBER_ISME, "clanmember_isme", 1, 1); - add(GET_CLANCHATOWNER, "get_clanchatowner", 0, 0, 0, 1); - // 3700-4000 - add(GET_GRANDEXCHANGE_OFFER_IS_SELLING, "get_grandexchange_offer_is_selling", 1, 1); - add(GET_GRANDEXCHANGE_OFFER_ITEMID, "get_grandexchange_offer_itemid", 1, 1); - add(GET_GRANDEXCHANGE_OFFER_PRICE, "get_grandexchange_offer_price", 1, 1); - add(GET_GRANDEXCHANGE_OFFER_TOTALQUANTITY, "get_grandexchange_offer_totalquantity", 1, 1); - add(GET_GRANDEXCHANGE_OFFER_QUANTITYSOLD, "get_grandexchange_offer_quantitysold", 1, 1); - add(GET_GRANDEXCHANGE_OFFER_SPENT, "get_grandexchange_offer_spent", 1, 1); - add(GET_GRANDEXCHANGE_OFFER_NOT_STARTED, "get_grandexchange_offer_not_started", 1, 1); - add(GET_GRANDEXCHANGE_OFFER_STATUS_2, "get_grandexchange_offer_status_2", 1, 1); - add(GET_GRANDEXCHANGE_OFFER_DONE, "get_grandexchange_offer_done", 1, 1); - add(3913, 1, 1); - add(3914, 1, 0); - add(3915, 1, 0); - add(3916, 2, 0); - add(3917, 1, 0); - add(3918, 1, 0); - add(3919, 0, 1); - add(3920, 1, 1); - add(3921, 1, 0, 0, 1); - add(3922, 1, 0, 0, 1); - add(3923, 1, 0, 0, 1); - add(3924, 1, 1); - add(3925, 1, 1); - add(3926, 1, 1); - // 4000-4100 - add(IADD, "iadd", 2, 1); - add(ISUB, "isub", 2, 1); - add(IMUL, "imul", 2, 1); - add(IDIV, "idiv", 2, 1); - add(RAND_EXCL, "rand_excl", 1, 1); - add(RAND_INCL, "rand_incl", 1, 1); - add(INTERPOLATE, "interpolate", 5, 1); - add(ADD_PERCENT, "add_percent", 2, 1); - add(SET_BIT, "set_bit", 2, 1); - add(CLEAR_BIT, "clear_bit", 2, 1); - add(TEST_BIT, "test_bit", 2, 1); - add(MODULO, "modulo", 2, 1); - add(POW, "pow", 2, 1); - add(INVPOW, "invpow", 2, 1); - add(AND, "and", 2, 1); - add(OR, "or", 2, 1); - add(SCALE, "scale", 3, 1); - // 4100-4200 - add(CONCAT_INT, "concat_int", 1, 0, 1, 1); - add(CONCAT_STRING, "concat_string", 0, 0, 2, 1); - add(4102, 1, 0, 1, 1); - add(TOLOWERCASE, "tolowercase", 0, 0, 1, 1); - add(FORMAT_DATE, "format_date", 1, 0, 0, 1); - add(SWITCH_MALE_OR_FEMALE, "switch_male_or_female", 0, 0, 2, 1); - add(INT_TO_STRING, "int_to_string", 1, 0, 0, 1); - add(STRING_COMPARE, "string_compare", 0, 1, 2, 0); - add(GET_LINE_COUNT, "get_line_count", 2, 1, 1, 0); - add(GET_MAX_LINE_WIDTH, "get_max_line_width", 2, 1, 1, 0); - add(SWITCH_STRING, "switch_string", 1, 0, 2, 1); - add(APPENDTAGS, "appendtags", 0, 0, 1, 1); - add(CONCAT_CHAR, "concat_char", 1, 0, 1, 1); - add(CHAR_IS_PRINTABLE, "char_is_printable", 1, 1); - add(ISALNUM, "isalnum", 1, 1); - add(ISALPHA, "isalpha", 1, 1); - add(ISDIGIT, "isdigit", 1, 1); - add(STRING_LENGTH, "string_length", 0, 1, 1, 0); - add(STRING_SUBSTRING, "string_substring", 2, 0, 1, 1); - add(STRING_REMOVE_HTML, "string_remove_html", 0, 0, 1, 1); - add(STRING_INDEXOF, "string_indexof", 1, 1, 1, 0); - add(STRING_INDEXOF_FROM, "string_indexof_from", 1, 1, 2, 0); - // 4200-4300 - add(GET_ITEM_NAME, "get_item_name", 1, 0, 0, 1); - add(GET_ITEM_GROUND_ACTION, "get_item_ground_action", 2, 0, 0, 1); - add(GET_ITEM_INVENTORY_ACTION, "get_item_inventory_action", 2, 0, 0, 1); - add(GET_ITEM_PRICE, "get_item_price", 1, 1); - add(GET_ITEM_STACKABLE, "get_item_stackable", 1, 1); - add(GET_ITEM_NOTE_1, "get_item_note_1", 1, 1); - add(GET_ITEM_NOTE_2, "get_item_note_2", 1, 1); - add(GET_ITEM_ISMEMBERS, "get_item_ismembers", 1, 1); - add(4208, 1, 1); - add(4209, 1, 1); - add(SEARCH_ITEM, "search_item", 1, 1, 1, 0); - add(NEXT_SEARCH_RESULT, "next_search_result", 0, 1); - add(4212, 0, 0); - // 4300-5100 - add(5000, 0, 1); - add(CHATFILTER_UPDATE, "chatfilter_update", 3, 0); - add(REPORT_PLAYER, "report_player", 2, 0, 1, 0); - add(GET_CHAT_MESSAGE_TYPE, "get_chat_message_type", 2, 2, 0, 3); - add(GET_CHAT_MESSAGE, "get_chat_message", 1, 2, 0, 3); - add(5005, 0, 1); - add(CHATBOX_INPUT, "chatbox_input", 1, 0, 1, 0); - add(PRIVMSG, "privmsg", 0, 0, 2, 0); - add(GET_LOCALPLAYER_NAME, "get_localplayer_name", 0, 0, 0, 1); - add(5016, 0, 1); - add(GET_CHATLINEBUFFER_LENGTH, "get_chatlinebuffer_length", 1, 1); - add(GET_MESSAGENODE_PREV_ID, "get_messagenode_prev_id", 1, 1); - add(GET_MESSAGENODE_NEXT_ID, "get_messagenode_next_id", 1, 1); - add(RUN_COMMAND, "run_command", 0, 0, 1, 0); - add(5021, 0, 0, 1, 0); - add(5022, 0, 0, 0, 1); - // 5100-5400 - add(GET_ISRESIZED, "get_isresized", 0, 1); - add(SET_ISRESIZED, "set_isresized", 1, 0); - add(GET_SCREENTYPE, "get_screentype", 0, 1); - add(SET_SCREENTYPE, "set_screentype", 1, 0); - // 5400-5600 - add(5504, 2, 0); - add(5505, 0, 1); - add(GET_MAPANGLE, "get_mapangle", 0, 1); - add(SET_CAMERA_FOCAL_POINT_HEIGHT, "set_camera_focal_point_height", 1, 0); - add(GET_CAMERA_FOCAL_POINT_HEIGHT, "get_camera_focal_point_height", 0, 1); - // 5600-5700 - add(CANCEL_LOGIN, "cancel_login", 0, 0); - // 5700-6300 - add(6200, 2, 0); - add(SET_ZOOM_DISTANCE, "set_zoom_distance", 2, 0); - add(6202, 4, 0); - add(GET_VIEWPORT_SIZE, "get_viewport_size", 0, 2); - add(GET_ZOOM_DISTANCE, "get_zoom_distance", 0, 2); - add(6205, 0, 2); - // 6300-6600 - add(LOAD_WORLDS, "load_worlds", 0, 1); - add(GET_FIRST_WORLD, "get_first_world", 0, 4, 0, 2); - add(GET_NEXT_WORLD, "get_next_world", 0, 4, 0, 2); - add(GET_WORLD_BY_ID, "get_world_by_id", 1, 4, 0, 2); - add(6507, 4, 0); - add(GET_WORLD_BY_INDEX, "get_world_by_index", 1, 4, 0, 2); - add(6512, 1, 0); - add(GET_IS_MOBILE, "get_is_mobile", 0, 1); - // 6600-6700 - add(6600, 0, 0); - add(GET_MAP_SURFACE_NAME_BY_ID, "get_map_surface_name_by_id", 1, 0, 0, 1); - add(SET_CURRENT_MAP_SURFACE, "set_current_map_surface", 1, 0); - add(GET_CURRENT_MAP_ZOOM, "get_current_map_zoom", 0, 1); - add(SET_CURRENT_MAP_ZOOM, "set_current_map_zoom", 1, 0); - add(6605, 0, 1); - add(SET_MAP_POSITION, "set_map_position", 1, 0); - add(SET_MAP_POSITION_IMMEDIATE, "set_map_position_immediate", 1, 0); - add(SET_MAP_POSITION_2, "set_map_position_2", 1, 0); - add(SET_MAP_POSITION_IMMEDIATE_2, "set_map_position_immediate_2", 1, 0); - add(GET_MAP_POSITION, "get_map_position", 0, 2); - add(GET_MAP_DEFAULT_POSITION_BY_ID, "get_map_default_position_by_id", 1, 1); - add(GET_MAP_DIMENSIONS_BY_ID, "get_map_dimensions_by_id", 1, 2); - add(GET_MAP_BOUNDS_BY_ID, "get_map_bounds_by_id", 1, 4); - add(GET_MAP_INITAL_ZOOM_BY_ID, "get_map_inital_zoom_by_id", 1, 1); - add(6615, 2, 2); - add(GET_CURRENT_MAP_ID, "get_current_map_id", 0, 1); - add(6617, 1, 2); - // 6618 variable - add(6619, 2, 1); - add(6620, 2, 1); - add(MAP_ID_CONTAINS_COORD, "map_id_contains_coord", 2, 1); - add(GET_MAP_DISPLAY_DIMENSIONS, "get_map_display_dimensions", 0, 2); - add(GET_MAP_ID_CONTAINING_COORD, "get_map_id_containing_coord", 1, 1); - add(SET_MAP_ICON_FLASH_COUNT, "set_map_icon_flash_count", 1, 0); - add(RESET_MAP_ICON_FLASH_COUNT, "reset_map_icon_flash_count", 0, 0); - add(SET_MAP_ICON_FLASH_PERIOD, "set_map_icon_flash_period", 1, 0); - add(RESET_MAP_ICON_FLASH_PERIOD, "reset_map_icon_flash_period", 0, 0); - add(SET_MAP_ICON_FLASH_FOREVER, "set_map_icon_flash_forever", 1, 0); - add(FLASH_MAP_ICONS_BY_ID, "flash_map_icons_by_id", 1, 0); - add(FLASH_MAP_ICONS_BY_GROUP, "flash_map_icons_by_group", 1, 0); - add(CLEAR_FLASHING_ICONS, "clear_flashing_icons", 0, 0); - add(SET_MAP_ICONS_DISABLED, "set_map_icons_disabled", 1, 0); - add(SET_MAP_ICONS_ENABLED_BY_ID, "set_map_icons_enabled_by_id", 2, 0); - add(SET_MAP_ICONS_ENABLED_BY_GROUP, "set_map_icons_enabled_by_group", 2, 0); - add(GET_MAP_ICONS_DISABLED, "get_map_icons_disabled", 0, 1); - add(GET_MAP_ICONS_ENABLED_BY_ID, "get_map_icons_enabled_by_id", 1, 1); - add(GET_MAP_ICONS_ENABLED_BY_GROUP, "get_map_icons_enabled_by_group", 1, 1); - add(6638, 2, 1); - add(GET_FIRST_MAP_ICON, "get_first_map_icon", 0, 2); - add(GET_NEXT_MAP_ICON, "get_next_map_icon", 0, 2); - add(GET_MAPICON_NAME_BY_ID, "get_mapicon_name_by_id", 1, 0, 0, 1); - add(GET_MAPICON_FONT_SIZE, "get_mapicon_font_size", 1, 1); - add(GET_MAPICON_GROUP_BY_ID, "get_mapicon_group_by_id", 1, 1); - add(GET_MAPICON_SPRITE_BY_ID, "get_mapicon_sprite_by_id", 1, 1); - add(GET_CURRENT_MAPICON_ID, "get_current_mapicon_id", 0, 1); - add(GET_CURRENT_MAPICON_COORD, "get_current_mapicon_coord", 0, 1); - add(GET_CURRENT_MAPICON_OTHER_COORD, "get_current_mapicon_other_coord", 0, 1); + add(ICONST, "iconst"); + add(GET_VARP, "get_varp"); + add(SET_VARP, "set_varp"); + add(SCONST, "sconst"); + add(JUMP, "jump"); + add(IF_ICMPNE, "if_icmpne"); + add(IF_ICMPEQ, "if_icmpeq"); + add(IF_ICMPLT, "if_icmplt"); + add(IF_ICMPGT, "if_icmpgt"); + add(RETURN, "return"); + add(GET_VARBIT, "get_varbit"); + add(SET_VARBIT, "set_varbit"); + add(IF_ICMPLE, "if_icmple"); + add(IF_ICMPGE, "if_icmpge"); + add(ILOAD, "iload"); + add(ISTORE, "istore"); + add(SLOAD, "sload"); + add(SSTORE, "sstore"); + add(JOIN_STRING, "join_string"); + add(POP_INT, "pop_int"); + add(POP_STRING, "pop_string"); + add(INVOKE, "invoke"); + add(GET_VARC_INT, "get_varc_int"); + add(SET_VARC_INT, "set_varc_int"); + add(DEFINE_ARRAY, "define_array"); + add(GET_ARRAY_INT, "get_array_int"); + add(SET_ARRAY_INT, "set_array_int"); + add(GET_VARC_STRING_OLD, "get_varc_string_old"); + add(SET_VARC_STRING_OLD, "set_varc_string_old"); + add(GET_VARC_STRING, "get_varc_string"); + add(SET_VARC_STRING, "set_varc_string"); + add(SWITCH, "switch"); + add(CC_CREATE, "cc_create"); + add(CC_DELETE, "cc_delete"); + add(CC_DELETEALL, "cc_deleteall"); + add(CC_FIND, "cc_find"); + add(IF_FIND, "if_find"); + add(CC_SETPOSITION, "cc_setposition"); + add(CC_SETSIZE, "cc_setsize"); + add(CC_SETHIDE, "cc_sethide"); + add(CC_SETNOCLICKTHROUGH, "cc_setnoclickthrough"); + add(CC_SETSCROLLPOS, "cc_setscrollpos"); + add(CC_SETCOLOUR, "cc_setcolour"); + add(CC_SETFILL, "cc_setfill"); + add(CC_SETTRANS, "cc_settrans"); + add(CC_SETLINEWID, "cc_setlinewid"); + add(CC_SETGRAPHIC, "cc_setgraphic"); + add(CC_SET2DANGLE, "cc_set2dangle"); + add(CC_SETTILING, "cc_settiling"); + add(CC_SETMODEL, "cc_setmodel"); + add(CC_SETMODELANGLE, "cc_setmodelangle"); + add(CC_SETMODELANIM, "cc_setmodelanim"); + add(CC_SETMODELORTHOG, "cc_setmodelorthog"); + add(CC_SETTEXT, "cc_settext"); + add(CC_SETTEXTFONT, "cc_settextfont"); + add(CC_SETTEXTALIGN, "cc_settextalign"); + add(CC_SETTEXTSHADOW, "cc_settextshadow"); + add(CC_SETOUTLINE, "cc_setoutline"); + add(CC_SETGRAPHICSHADOW, "cc_setgraphicshadow"); + add(CC_SETVFLIP, "cc_setvflip"); + add(CC_SETHFLIP, "cc_sethflip"); + add(CC_SETSCROLLSIZE, "cc_setscrollsize"); + add(CC_RESUME_PAUSEBUTTON, "cc_resume_pausebutton"); + add(CC_SETFILLCOLOUR, "cc_setfillcolour"); + add(CC_SETLINEDIRECTION, "cc_setlinedirection"); + add(CC_SETOBJECT, "cc_setobject"); + add(CC_SETNPCHEAD, "cc_setnpchead"); + add(CC_SETPLAYERHEAD_SELF, "cc_setplayerhead_self"); + add(CC_SETOBJECT_NONUM, "cc_setobject_nonum"); + add(CC_SETOBJECT_ALWAYS_NUM, "cc_setobject_always_num"); + add(CC_SETOP, "cc_setop"); + add(CC_SETDRAGGABLE, "cc_setdraggable"); + add(CC_SETDRAGGABLEBEHAVIOR, "cc_setdraggablebehavior"); + add(CC_SETDRAGDEADZONE, "cc_setdragdeadzone"); + add(CC_SETDRAGDEADTIME, "cc_setdragdeadtime"); + add(CC_SETOPBASE, "cc_setopbase"); + add(CC_SETTARGETVERB, "cc_settargetverb"); + add(CC_CLEAROPS, "cc_clearops"); + add(CC_SETONCLICK, "cc_setonclick"); + add(CC_SETONHOLD, "cc_setonhold"); + add(CC_SETONRELEASE, "cc_setonrelease"); + add(CC_SETONMOUSEOVER, "cc_setonmouseover"); + add(CC_SETONMOUSELEAVE, "cc_setonmouseleave"); + add(CC_SETONDRAG, "cc_setondrag"); + add(CC_SETONTARGETLEAVE, "cc_setontargetleave"); + add(CC_SETONVARTRANSMIT, "cc_setonvartransmit"); + add(CC_SETONTIMER, "cc_setontimer"); + add(CC_SETONOP, "cc_setonop"); + add(CC_SETONDRAGCOMPLETE, "cc_setondragcomplete"); + add(CC_SETONCLICKREPEAT, "cc_setonclickrepeat"); + add(CC_SETONMOUSEREPEAT, "cc_setonmouserepeat"); + add(CC_SETONINVTRANSMIT, "cc_setoninvtransmit"); + add(CC_SETONSTATTRANSMIT, "cc_setonstattransmit"); + add(CC_SETONTARGETENTER, "cc_setontargetenter"); + add(CC_SETONSCROLLWHEEL, "cc_setonscrollwheel"); + add(CC_SETONCHATTRANSMIT, "cc_setonchattransmit"); + add(CC_SETONKEY, "cc_setonkey"); + add(CC_SETONFRIENDTRANSMIT, "cc_setonfriendtransmit"); + add(CC_SETONCLANTRANSMIT, "cc_setonclantransmit"); + add(CC_SETONMISCTRANSMIT, "cc_setonmisctransmit"); + add(CC_SETONDIALOGABORT, "cc_setondialogabort"); + add(CC_SETONSUBCHANGE, "cc_setonsubchange"); + add(CC_SETONSTOCKTRANSMIT, "cc_setonstocktransmit"); + add(CC_SETONRESIZE, "cc_setonresize"); + add(CC_GETX, "cc_getx"); + add(CC_GETY, "cc_gety"); + add(CC_GETWIDTH, "cc_getwidth"); + add(CC_GETHEIGHT, "cc_getheight"); + add(CC_GETHIDE, "cc_gethide"); + add(CC_GETLAYER, "cc_getlayer"); + add(CC_GETSCROLLX, "cc_getscrollx"); + add(CC_GETSCROLLY, "cc_getscrolly"); + add(CC_GETTEXT, "cc_gettext"); + add(CC_GETSCROLLWIDTH, "cc_getscrollwidth"); + add(CC_GETSCROLLHEIGHT, "cc_getscrollheight"); + add(CC_GETMODELZOOM, "cc_getmodelzoom"); + add(CC_GETMODELANGLE_X, "cc_getmodelangle_x"); + add(CC_GETMODELANGLE_Z, "cc_getmodelangle_z"); + add(CC_GETMODELANGLE_Y, "cc_getmodelangle_y"); + add(CC_GETTRANS, "cc_gettrans"); + add(CC_GETCOLOUR, "cc_getcolour"); + add(CC_GETFILLCOLOUR, "cc_getfillcolour"); + add(CC_GETINVOBJECT, "cc_getinvobject"); + add(CC_GETINVCOUNT, "cc_getinvcount"); + add(CC_GETID, "cc_getid"); + add(CC_GETTARGETMASK, "cc_gettargetmask"); + add(CC_GETOP, "cc_getop"); + add(CC_GETOPBASE, "cc_getopbase"); + add(CC_CALLONRESIZE, "cc_callonresize"); + add(IF_SETPOSITION, "if_setposition"); + add(IF_SETSIZE, "if_setsize"); + add(IF_SETHIDE, "if_sethide"); + add(IF_SETNOCLICKTHROUGH, "if_setnoclickthrough"); + add(IF_SETSCROLLPOS, "if_setscrollpos"); + add(IF_SETCOLOUR, "if_setcolour"); + add(IF_SETFILL, "if_setfill"); + add(IF_SETTRANS, "if_settrans"); + add(IF_SETLINEWID, "if_setlinewid"); + add(IF_SETGRAPHIC, "if_setgraphic"); + add(IF_SET2DANGLE, "if_set2dangle"); + add(IF_SETTILING, "if_settiling"); + add(IF_SETMODEL, "if_setmodel"); + add(IF_SETMODELANGLE, "if_setmodelangle"); + add(IF_SETMODELANIM, "if_setmodelanim"); + add(IF_SETMODELORTHOG, "if_setmodelorthog"); + add(IF_SETTEXT, "if_settext"); + add(IF_SETTEXTFONT, "if_settextfont"); + add(IF_SETTEXTALIGN, "if_settextalign"); + add(IF_SETTEXTSHADOW, "if_settextshadow"); + add(IF_SETOUTLINE, "if_setoutline"); + add(IF_SETGRAPHICSHADOW, "if_setgraphicshadow"); + add(IF_SETVFLIP, "if_setvflip"); + add(IF_SETHFLIP, "if_sethflip"); + add(IF_SETSCROLLSIZE, "if_setscrollsize"); + add(IF_RESUME_PAUSEBUTTON, "if_resume_pausebutton"); + add(IF_SETFILLCOLOUR, "if_setfillcolour"); + add(IF_SETLINEDIRECTION, "if_setlinedirection"); + add(IF_SETOBJECT, "if_setobject"); + add(IF_SETNPCHEAD, "if_setnpchead"); + add(IF_SETPLAYERHEAD_SELF, "if_setplayerhead_self"); + add(IF_SETOBJECT_NONUM, "if_setobject_nonum"); + add(IF_SETOBJECT_ALWAYS_NUM, "if_setobject_always_num"); + add(IF_SETOP, "if_setop"); + add(IF_SETDRAGGABLE, "if_setdraggable"); + add(IF_SETDRAGGABLEBEHAVIOR, "if_setdraggablebehavior"); + add(IF_SETDRAGDEADZONE, "if_setdragdeadzone"); + add(IF_SETDRAGDEADTIME, "if_setdragdeadtime"); + add(IF_SETOPBASE, "if_setopbase"); + add(IF_SETTARGETVERB, "if_settargetverb"); + add(IF_CLEAROPS, "if_clearops"); + add(IF_SETOPKEY, "if_setopkey"); + add(IF_SETOPTKEY, "if_setoptkey"); + add(IF_SETOPKEYRATE, "if_setopkeyrate"); + add(IF_SETOPTKEYRATE, "if_setoptkeyrate"); + add(IF_SETOPKEYIGNOREHELD, "if_setopkeyignoreheld"); + add(IF_SETOPTKEYIGNOREHELD, "if_setoptkeyignoreheld"); + add(IF_SETONCLICK, "if_setonclick"); + add(IF_SETONHOLD, "if_setonhold"); + add(IF_SETONRELEASE, "if_setonrelease"); + add(IF_SETONMOUSEOVER, "if_setonmouseover"); + add(IF_SETONMOUSELEAVE, "if_setonmouseleave"); + add(IF_SETONDRAG, "if_setondrag"); + add(IF_SETONTARGETLEAVE, "if_setontargetleave"); + add(IF_SETONVARTRANSMIT, "if_setonvartransmit"); + add(IF_SETONTIMER, "if_setontimer"); + add(IF_SETONOP, "if_setonop"); + add(IF_SETONDRAGCOMPLETE, "if_setondragcomplete"); + add(IF_SETONCLICKREPEAT, "if_setonclickrepeat"); + add(IF_SETONMOUSEREPEAT, "if_setonmouserepeat"); + add(IF_SETONINVTRANSMIT, "if_setoninvtransmit"); + add(IF_SETONSTATTRANSMIT, "if_setonstattransmit"); + add(IF_SETONTARGETENTER, "if_setontargetenter"); + add(IF_SETONSCROLLWHEEL, "if_setonscrollwheel"); + add(IF_SETONCHATTRANSMIT, "if_setonchattransmit"); + add(IF_SETONKEY, "if_setonkey"); + add(IF_SETONFRIENDTRANSMIT, "if_setonfriendtransmit"); + add(IF_SETONCLANTRANSMIT, "if_setonclantransmit"); + add(IF_SETONMISCTRANSMIT, "if_setonmisctransmit"); + add(IF_SETONDIALOGABORT, "if_setondialogabort"); + add(IF_SETONSUBCHANGE, "if_setonsubchange"); + add(IF_SETONSTOCKTRANSMIT, "if_setonstocktransmit"); + add(IF_SETONRESIZE, "if_setonresize"); + add(IF_GETX, "if_getx"); + add(IF_GETY, "if_gety"); + add(IF_GETWIDTH, "if_getwidth"); + add(IF_GETHEIGHT, "if_getheight"); + add(IF_GETHIDE, "if_gethide"); + add(IF_GETLAYER, "if_getlayer"); + add(IF_GETSCROLLX, "if_getscrollx"); + add(IF_GETSCROLLY, "if_getscrolly"); + add(IF_GETTEXT, "if_gettext"); + add(IF_GETSCROLLWIDTH, "if_getscrollwidth"); + add(IF_GETSCROLLHEIGHT, "if_getscrollheight"); + add(IF_GETMODELZOOM, "if_getmodelzoom"); + add(IF_GETMODELANGLE_X, "if_getmodelangle_x"); + add(IF_GETMODELANGLE_Z, "if_getmodelangle_z"); + add(IF_GETMODELANGLE_Y, "if_getmodelangle_y"); + add(IF_GETTRANS, "if_gettrans"); + add(IF_GETCOLOUR, "if_getcolour"); + add(IF_GETFILLCOLOUR, "if_getfillcolour"); + add(IF_GETINVOBJECT, "if_getinvobject"); + add(IF_GETINVCOUNT, "if_getinvcount"); + add(IF_HASSUB, "if_hassub"); + add(IF_GETTOP, "if_gettop"); + add(IF_GETTARGETMASK, "if_gettargetmask"); + add(IF_GETOP, "if_getop"); + add(IF_GETOPBASE, "if_getopbase"); + add(IF_CALLONRESIZE, "if_callonresize"); + add(MES, "mes"); + add(ANIM, "anim"); + add(IF_CLOSE, "if_close"); + add(RESUME_COUNTDIALOG, "resume_countdialog"); + add(RESUME_NAMEDIALOG, "resume_namedialog"); + add(RESUME_STRINGDIALOG, "resume_stringdialog"); + add(OPPLAYER, "opplayer"); + add(IF_DRAGPICKUP, "if_dragpickup"); + add(CC_DRAGPICKUP, "cc_dragpickup"); + add(MOUSECAM, "mousecam"); + add(GETREMOVEROOFS, "getremoveroofs"); + add(SETREMOVEROOFS, "setremoveroofs"); + add(OPENURL, "openurl"); + add(RESUME_OBJDIALOG, "resume_objdialog"); + add(BUG_REPORT, "bug_report"); + add(SETSHIFTCLICKDROP, "setshiftclickdrop"); + add(SETSHOWMOUSEOVERTEXT, "setshowmouseovertext"); + add(RENDERSELF, "renderself"); + add(SETSHOWMOUSECROSS, "setshowmousecross"); + add(SETSHOWLOADINGMESSAGES, "setshowloadingmessages"); + add(SETTAPTODROP, "settaptodrop"); + add(GETTAPTODROP, "gettaptodrop"); + add(GETCANVASSIZE, "getcanvassize"); + add(SETHIDEUSERNAME, "sethideusername"); + add(GETHIDEUSERNAME, "gethideusername"); + add(SETREMEMBERUSERNAME, "setrememberusername"); + add(GETREMEMBERUSERNAME, "getrememberusername"); + add(SOUND_SYNTH, "sound_synth"); + add(SOUND_SONG, "sound_song"); + add(SOUND_JINGLE, "sound_jingle"); + add(CLIENTCLOCK, "clientclock"); + add(INV_GETOBJ, "inv_getobj"); + add(INV_GETNUM, "inv_getnum"); + add(INV_TOTAL, "inv_total"); + add(INV_SIZE, "inv_size"); + add(STAT, "stat"); + add(STAT_BASE, "stat_base"); + add(STAT_XP, "stat_xp"); + add(COORD, "coord"); + add(COORDX, "coordx"); + add(COORDZ, "coordz"); + add(COORDY, "coordy"); + add(MAP_MEMBERS, "map_members"); + add(INVOTHER_GETOBJ, "invother_getobj"); + add(INVOTHER_GETNUM, "invother_getnum"); + add(INVOTHER_TOTAL, "invother_total"); + add(STAFFMODLEVEL, "staffmodlevel"); + add(REBOOTTIMER, "reboottimer"); + add(MAP_WORLD, "map_world"); + add(RUNENERGY_VISIBLE, "runenergy_visible"); + add(RUNWEIGHT_VISIBLE, "runweight_visible"); + add(PLAYERMOD, "playermod"); + add(WORLDFLAGS, "worldflags"); + add(MOVECOORD, "movecoord"); + add(ENUM_STRING, "enum_string"); + add(ENUM, "enum"); + add(ENUM_GETOUTPUTCOUNT, "enum_getoutputcount"); + add(FRIEND_COUNT, "friend_count"); + add(FRIEND_GETNAME, "friend_getname"); + add(FRIEND_GETWORLD, "friend_getworld"); + add(FRIEND_GETRANK, "friend_getrank"); + add(FRIEND_SETRANK, "friend_setrank"); + add(FRIEND_ADD, "friend_add"); + add(FRIEND_DEL, "friend_del"); + add(IGNORE_ADD, "ignore_add"); + add(IGNORE_DEL, "ignore_del"); + add(FRIEND_TEST, "friend_test"); + add(CLAN_GETCHATDISPLAYNAME, "clan_getchatdisplayname"); + add(CLAN_GETCHATCOUNT, "clan_getchatcount"); + add(CLAN_GETCHATUSERNAME, "clan_getchatusername"); + add(CLAN_GETCHATUSERWORLD, "clan_getchatuserworld"); + add(CLAN_GETCHATUSERRANK, "clan_getchatuserrank"); + add(CLAN_GETCHATMINKICK, "clan_getchatminkick"); + add(CLAN_KICKUSER, "clan_kickuser"); + add(CLAN_GETCHATRANK, "clan_getchatrank"); + add(CLAN_JOINCHAT, "clan_joinchat"); + add(CLAN_LEAVECHAT, "clan_leavechat"); + add(IGNORE_COUNT, "ignore_count"); + add(IGNORE_GETNAME, "ignore_getname"); + add(IGNORE_TEST, "ignore_test"); + add(CLAN_ISSELF, "clan_isself"); + add(CLAN_GETCHATOWNERNAME, "clan_getchatownername"); + add(CLAN_ISFRIEND, "clan_isfriend"); + add(CLAN_ISIGNORE, "clan_isignore"); + add(STOCKMARKET_GETOFFERTYPE, "stockmarket_getoffertype"); + add(STOCKMARKET_GETOFFERITEM, "stockmarket_getofferitem"); + add(STOCKMARKET_GETOFFERPRICE, "stockmarket_getofferprice"); + add(STOCKMARKET_GETOFFERCOUNT, "stockmarket_getoffercount"); + add(STOCKMARKET_GETOFFERCOMPLETEDCOUNT, "stockmarket_getoffercompletedcount"); + add(STOCKMARKET_GETOFFERCOMPLETEDGOLD, "stockmarket_getoffercompletedgold"); + add(STOCKMARKET_ISOFFEREMPTY, "stockmarket_isofferempty"); + add(STOCKMARKET_ISOFFERSTABLE, "stockmarket_isofferstable"); + add(STOCKMARKET_ISOFFERFINISHED, "stockmarket_isofferfinished"); + add(STOCKMARKET_ISOFFERADDING, "stockmarket_isofferadding"); + add(TRADINGPOST_SORTBY_NAME, "tradingpost_sortby_name"); + add(TRADINGPOST_SORTBY_PRICE, "tradingpost_sortby_price"); + add(TRADINGPOST_SORTFILTERBY_WORLD, "tradingpost_sortfilterby_world"); + add(TRADINGPOST_SORTBY_AGE, "tradingpost_sortby_age"); + add(TRADINGPOST_SORTBY_COUNT, "tradingpost_sortby_count"); + add(TRADINGPOST_GETTOTALOFFERS, "tradingpost_gettotaloffers"); + add(TRADINGPOST_GETOFFERWORLD, "tradingpost_getofferworld"); + add(TRADINGPOST_GETOFFERNAME, "tradingpost_getoffername"); + add(TRADINGPOST_GETOFFERPREVIOUSNAME, "tradingpost_getofferpreviousname"); + add(TRADINGPOST_GETOFFERAGE, "tradingpost_getofferage"); + add(TRADINGPOST_GETOFFERCOUNT, "tradingpost_getoffercount"); + add(TRADINGPOST_GETOFFERPRICE, "tradingpost_getofferprice"); + add(TRADINGPOST_GETOFFERITEM, "tradingpost_getofferitem"); + add(ADD, "add"); + add(SUB, "sub"); + add(MULTIPLY, "multiply"); + add(DIV, "div"); + add(RANDOM, "random"); + add(RANDOMINC, "randominc"); + add(INTERPOLATE, "interpolate"); + add(ADDPERCENT, "addpercent"); + add(SETBIT, "setbit"); + add(CLEARBIT, "clearbit"); + add(TESTBIT, "testbit"); + add(MOD, "mod"); + add(POW, "pow"); + add(INVPOW, "invpow"); + add(AND, "and"); + add(OR, "or"); + add(SCALE, "scale"); + add(APPEND_NUM, "append_num"); + add(APPEND, "append"); + add(APPEND_SIGNNUM, "append_signnum"); + add(LOWERCASE, "lowercase"); + add(FROMDATE, "fromdate"); + add(TEXT_GENDER, "text_gender"); + add(TOSTRING, "tostring"); + add(COMPARE, "compare"); + add(PARAHEIGHT, "paraheight"); + add(PARAWIDTH, "parawidth"); + add(TEXT_SWITCH, "text_switch"); + add(ESCAPE, "escape"); + add(APPEND_CHAR, "append_char"); + add(CHAR_ISPRINTABLE, "char_isprintable"); + add(CHAR_ISALPHANUMERIC, "char_isalphanumeric"); + add(CHAR_ISALPHA, "char_isalpha"); + add(CHAR_ISNUMERIC, "char_isnumeric"); + add(STRING_LENGTH, "string_length"); + add(SUBSTRING, "substring"); + add(REMOVETAGS, "removetags"); + add(STRING_INDEXOF_CHAR, "string_indexof_char"); + add(STRING_INDEXOF_STRING, "string_indexof_string"); + add(OC_NAME, "oc_name"); + add(OC_OP, "oc_op"); + add(OC_IOP, "oc_iop"); + add(OC_COST, "oc_cost"); + add(OC_STACKABLE, "oc_stackable"); + add(OC_CERT, "oc_cert"); + add(OC_UNCERT, "oc_uncert"); + add(OC_MEMBERS, "oc_members"); + add(OC_PLACEHOLDER, "oc_placeholder"); + add(OC_UNPLACEHOLDER, "oc_unplaceholder"); + add(OC_FIND, "oc_find"); + add(OC_FINDNEXT, "oc_findnext"); + add(OC_FINDRESET, "oc_findreset"); + add(CHAT_GETFILTER_PUBLIC, "chat_getfilter_public"); + add(CHAT_SETFILTER, "chat_setfilter"); + add(CHAT_SENDABUSEREPORT, "chat_sendabusereport"); + add(CHAT_GETHISTORY_BYTYPEANDLINE, "chat_gethistory_bytypeandline"); + add(CHAT_GETHISTORY_BYUID, "chat_gethistory_byuid"); + add(CHAT_GETFILTER_PRIVATE, "chat_getfilter_private"); + add(CHAT_SENDPUBLIC, "chat_sendpublic"); + add(CHAT_SENDPRIVATE, "chat_sendprivate"); + add(CHAT_PLAYERNAME, "chat_playername"); + add(CHAT_GETFILTER_TRADE, "chat_getfilter_trade"); + add(CHAT_GETHISTORYLENGTH, "chat_gethistorylength"); + add(CHAT_GETNEXTUID, "chat_getnextuid"); + add(CHAT_GETPREVUID, "chat_getprevuid"); + add(DOCHEAT, "docheat"); + add(CHAT_SETMESSAGEFILTER, "chat_setmessagefilter"); + add(CHAT_GETMESSAGEFILTER, "chat_getmessagefilter"); + add(GETWINDOWMODE, "getwindowmode"); + add(SETWINDOWMODE, "setwindowmode"); + add(GETDEFAULTWINDOWMODE, "getdefaultwindowmode"); + add(SETDEFAULTWINDOWMODE, "setdefaultwindowmode"); + add(CAM_FORCEANGLE, "cam_forceangle"); + add(CAM_GETANGLE_XA, "cam_getangle_xa"); + add(CAM_GETANGLE_YA, "cam_getangle_ya"); + add(CAM_SETFOLLOWHEIGHT, "cam_setfollowheight"); + add(CAM_GETFOLLOWHEIGHT, "cam_getfollowheight"); + add(LOGOUT, "logout"); + add(VIEWPORT_SETFOV, "viewport_setfov"); + add(VIEWPORT_SETZOOM, "viewport_setzoom"); + add(VIEWPORT_CLAMPFOV, "viewport_clampfov"); + add(VIEWPORT_GETEFFECTIVESIZE, "viewport_geteffectivesize"); + add(VIEWPORT_GETZOOM, "viewport_getzoom"); + add(VIEWPORT_GETFOV, "viewport_getfov"); + add(WORLDLIST_FETCH, "worldlist_fetch"); + add(WORLDLIST_START, "worldlist_start"); + add(WORLDLIST_NEXT, "worldlist_next"); + add(WORLDLIST_SPECIFIC, "worldlist_specific"); + add(WORLDLIST_SORT, "worldlist_sort"); + add(SETFOLLOWEROPSLOWPRIORITY, "setfolloweropslowpriority"); + add(NC_PARAM, "nc_param"); + add(LC_PARAM, "lc_param"); + add(OC_PARAM, "oc_param"); + add(STRUCT_PARAM, "struct_param"); + add(ON_MOBILE, "on_mobile"); + add(CLIENTTYPE, "clienttype"); + add(BATTERYLEVEL, "batterylevel"); + add(BATTERYCHARGING, "batterycharging"); + add(WIFIAVAILABLE, "wifiavailable"); + add(WORLDMAP_GETMAPNAME, "worldmap_getmapname"); + add(WORLDMAP_SETMAP, "worldmap_setmap"); + add(WORLDMAP_GETZOOM, "worldmap_getzoom"); + add(WORLDMAP_SETZOOM, "worldmap_setzoom"); + add(WORLDMAP_ISLOADED, "worldmap_isloaded"); + add(WORLDMAP_JUMPTODISPLAYCOORD, "worldmap_jumptodisplaycoord"); + add(WORLDMAP_JUMPTODISPLAYCOORD_INSTANT, "worldmap_jumptodisplaycoord_instant"); + add(WORLDMAP_JUMPTOSOURCECOORD, "worldmap_jumptosourcecoord"); + add(WORLDMAP_JUMPTOSOURCECOORD_INSTANT, "worldmap_jumptosourcecoord_instant"); + add(WORLDMAP_GETDISPLAYPOSITION, "worldmap_getdisplayposition"); + add(WORLDMAP_GETCONFIGORIGIN, "worldmap_getconfigorigin"); + add(WORLDMAP_GETCONFIGSIZE, "worldmap_getconfigsize"); + add(WORLDMAP_GETCONFIGBOUNDS, "worldmap_getconfigbounds"); + add(WORLDMAP_GETCONFIGZOOM, "worldmap_getconfigzoom"); + add(WORLDMAP_GETCURRENTMAP, "worldmap_getcurrentmap"); + add(WORLDMAP_GETDISPLAYCOORD, "worldmap_getdisplaycoord"); + add(WORLDMAP_COORDINMAP, "worldmap_coordinmap"); + add(WORLDMAP_GETSIZE, "worldmap_getsize"); + add(WORLDMAP_PERPETUALFLASH, "worldmap_perpetualflash"); + add(WORLDMAP_FLASHELEMENT, "worldmap_flashelement"); + add(WORLDMAP_FLASHELEMENTCATEGORY, "worldmap_flashelementcategory"); + add(WORLDMAP_STOPCURRENTFLASHES, "worldmap_stopcurrentflashes"); + add(WORLDMAP_DISABLEELEMENTS, "worldmap_disableelements"); + add(WORLDMAP_DISABLEELEMENT, "worldmap_disableelement"); + add(WORLDMAP_DISABLEELEMENTCATEGORY, "worldmap_disableelementcategory"); + add(WORLDMAP_GETDISABLEELEMENTS, "worldmap_getdisableelements"); + add(WORLDMAP_GETDISABLEELEMENT, "worldmap_getdisableelement"); + add(WORLDMAP_GETDISABLEELEMENTCATEGORY, "worldmap_getdisableelementcategory"); + add(WORLDMAP_LISTELEMENT_START, "worldmap_listelement_start"); + add(WORLDMAP_LISTELEMENT_NEXT, "worldmap_listelement_next"); + add(MEC_TEXT, "mec_text"); + add(MEC_TEXTSIZE, "mec_textsize"); + add(MEC_CATEGORY, "mec_category"); + add(MEC_SPRITE, "mec_sprite"); } - protected void add(int opcode, String name, int ipops, int ipushes, int spops, int spushes) + protected void add(int opcode, String name) { Instruction i = new Instruction(opcode); i.setName(name); - i.setIntStackPops(ipops); - i.setIntStackPushes(ipushes); - i.setStringStackPops(spops); - i.setStringStackPushes(spushes); assert instructions.containsKey(opcode) == false; instructions.put(opcode, i); @@ -556,21 +522,6 @@ public class Instructions } } - protected void add(int opcode, int ipops, int ipushes) - { - add(opcode, null, ipops, ipushes, 0, 0); - } - - protected void add(int opcode, int ipops, int ipushes, int spops, int spushes) - { - add(opcode, null, ipops, ipushes, spops, spushes); - } - - protected void add(int opcode, String name, int ipops, int ipushes) - { - add(opcode, name, ipops, ipushes, 0, 0); - } - public Instruction find(int opcode) { return instructions.get(opcode); diff --git a/cache/src/main/java/net/runelite/cache/script/Opcodes.java b/cache/src/main/java/net/runelite/cache/script/Opcodes.java index ce4c713a7a..e69a1ef5ef 100644 --- a/cache/src/main/java/net/runelite/cache/script/Opcodes.java +++ b/cache/src/main/java/net/runelite/cache/script/Opcodes.java @@ -1,5 +1,7 @@ /* * Copyright (c) 2017, Adam + * Copyright (c) 2018-2019, Hunter WB + * Copyright (c) 2019, Abex * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,10 +28,10 @@ package net.runelite.cache.script; public class Opcodes { - public static final int LOAD_INT = 0; + public static final int ICONST = 0; public static final int GET_VARP = 1; - public static final int PUT_VARP = 2; - public static final int LOAD_STRING = 3; + public static final int SET_VARP = 2; + public static final int SCONST = 3; public static final int JUMP = 6; public static final int IF_ICMPNE = 7; public static final int IF_ICMPEQ = 8; @@ -44,376 +46,454 @@ public class Opcodes public static final int ISTORE = 34; public static final int SLOAD = 35; public static final int SSTORE = 36; - public static final int STRING_APPEND = 37; + public static final int JOIN_STRING = 37; public static final int POP_INT = 38; public static final int POP_STRING = 39; public static final int INVOKE = 40; - public static final int GET_VARC = 42; - public static final int PUT_VARC = 43; - public static final int ARRAY_INITIALIZE = 44; - public static final int ARRAY_LOAD = 45; - public static final int ARRAY_STORE = 46; - public static final int GET_VARC_STRING = 47; - public static final int PUT_VARC_STRING = 48; - public static final int GET_VARC_STRING_2 = 49; - public static final int PUT_VARC_STRING_2 = 50; + public static final int GET_VARC_INT = 42; + public static final int SET_VARC_INT = 43; + public static final int DEFINE_ARRAY = 44; + public static final int GET_ARRAY_INT = 45; + public static final int SET_ARRAY_INT = 46; + public static final int GET_VARC_STRING_OLD = 47; + public static final int SET_VARC_STRING_OLD = 48; + public static final int GET_VARC_STRING = 49; + public static final int SET_VARC_STRING = 50; public static final int SWITCH = 60; - public static final int WIDGET_CREATE_CHILD = 100; - public static final int WIDGET_DESTROY_CHILD = 101; - public static final int WIDGET_UNSET_CHILDREN = 102; - public static final int WIDGET_LOAD_CHILD = 200; - public static final int WIDGET_LOAD = 201; - public static final int WIDGET_PUT_POSITION = 1000; - public static final int WIDGET_PUT_SIZE = 1001; - public static final int WIDGET_PUT_HIDDEN = 1003; - public static final int WIDGET_PUT_NO_CLICK_THROUGH = 1005; - public static final int WIDGET_PUT_SCROLL = 1100; - public static final int WIDGET_PUT_TEXTCOLOR = 1101; - public static final int WIDGET_PUT_FILLED = 1102; - public static final int WIDGET_PUT_OPACITY = 1103; - public static final int WIDGET_PUT_LINE_WIDTH = 1104; - public static final int WIDGET_PUT_SPRITEID = 1105; - public static final int WIDGET_PUT_TEXTUREID = 1106; - public static final int WIDGET_PUT_SPRITE_TILING = 1107; - public static final int WIDGET_PUT_MODELID_1 = 1108; - public static final int WIDGET_PUT_3D_ROTATION = 1109; - public static final int WIDGET_PUT_ANIMATION = 1110; - public static final int WIDGET_PUT_TEXT = 1112; - public static final int WIDGET_PUT_FONTID = 1113; - public static final int WIDGET_PUT_TEXT_ALIGNMENT = 1114; - public static final int WIDGET_PUT_TEXT_SHADOWED = 1115; - public static final int WIDGET_PUT_BORDERTHICKNESS = 1116; - public static final int WIDGET_PUT_SPRITE2 = 1117; - public static final int WIDGET_PUT_FLIPPEDVERTICALLY = 1118; - public static final int WIDGET_PUT_FLIPPEDHORIZONALLY = 1119; - public static final int WIDGET_PUT_SCROLLWIDTHHEIGHT = 1120; - public static final int WIDGET_ADVANCE_DIALOGUE = 1121; - public static final int WIDGET_PUT_MODELID_2 = 1201; - public static final int WIDGET_PUT_MODELID_3 = 1202; - public static final int WIDGET_PUT_ACTION = 1300; - public static final int WIDGET_PUT_DRAG_PARENT = 1301; - public static final int WIDGET_PUT_NAME = 1305; - public static final int WIDGET_PUT_SELECTED_ACTION = 1306; - public static final int WIDGET_PUT_ACTIONS_NULL = 1307; - public static final int WIDGET_PUT_MOUSE_PRESS_LISTENER = 1400; - public static final int WIDGET_PUT_DRAGGED_OVER_LISTENER = 1401; - public static final int WIDGET_PUT_MOUSE_RELEASE_LISTENER = 1402; - public static final int WIDGET_PUT_MOUSE_ENTER_LISTENER = 1403; - public static final int WIDGET_PUT_MOUSE_EXIT_LISTENER = 1404; - public static final int WIDGET_PUT_DRAG_START_LISTENER = 1405; - public static final int WIDGET_PUT_USE_WITH_LISTENER = 1406; - public static final int WIDGET_PUT_CONFIG_LISTENER = 1407; - public static final int WIDGET_PUT_RENDER_LISTENER = 1408; - public static final int WIDGET_PUT_OPTION_CLICK_LISTENER = 1409; - public static final int WIDGET_PUT_DRAG_RELEASE_LISTENER = 1410; - public static final int WIDGET_PUT_DRAG_LISTENER = 1411; - public static final int WIDGET_PUT_MOUSE_HOVER_LISTENER = 1412; - public static final int WIDGET_PUT_TABLE_LISTENER = 1414; - public static final int WIDGET_PUT_SKILL_LISTENER = 1415; - public static final int WIDGET_PUT_USE_LISTENER = 1416; - public static final int WIDGET_PUT_SCROLL_LISTENER = 1417; - public static final int WIDGET_PUT_MSG_LISTENER = 1418; - public static final int WIDGET_PUT_KEY_LISTENER = 1419; - public static final int WIDGET_PUT_FRIENDS_LISTENER = 1420; - public static final int WIDGET_PUT_CLAN_LISTENER = 1421; - public static final int WIDGET_PUT_DIALOG_ABORT_LISTENER = 1423; - public static final int WIDGET_PUT_OPENCLOSE_LISTENER = 1424; - public static final int WIDGET_PUT_GE_LISTENER = 1425; - public static final int WIDGET_PUT_RESIZE_LISTENER = 1427; - public static final int WIDGET_GET_RELATIVEX = 1500; - public static final int WIDGET_GET_RELATIVEY = 1501; - public static final int WIDGET_GET_WIDTH = 1502; - public static final int WIDGET_GET_HEIGHT = 1503; - public static final int WIDGET_GET_HIDDEN = 1504; - public static final int WIDGET_GET_PARENTID = 1505; - public static final int WIDGET_GET_SCROLLX = 1600; - public static final int WIDGET_GET_SCROLLY = 1601; - public static final int WIDGET_GET_TEXT = 1602; - public static final int WIDGET_GET_SCROLLWIDTH = 1603; - public static final int WIDGET_GET_SCROLLHEIGHT = 1604; - public static final int WIDGET_GET_MODELZOOM = 1605; - public static final int WIDGET_GET_ROTATIONX = 1606; - public static final int WIDGET_GET_ROTATIONY = 1607; - public static final int WIDGET_GET_ROTATIONZ = 1608; - public static final int WIDGET_GET_OPACITY = 1609; - public static final int WIDGET_GET_TEXTCOLOR = 1611; - public static final int WIDGET_GET_ITEMID = 1700; - public static final int WIDGET_GET_STACKSIZE = 1701; - public static final int WIDGET_GET_INDEX = 1702; - public static final int WIDGET_GET_CONFIG = 1800; - public static final int WIDGET_GET_ACTION = 1801; - public static final int WIDGET_GET_NAME = 1802; - public static final int WIDGET_PUT_POSITION_WIDGET = WIDGET_PUT_POSITION + 1000; - public static final int WIDGET_PUT_SIZE_WIDGET = WIDGET_PUT_SIZE + 1000; - public static final int WIDGET_PUT_HIDDEN_WIDGET = WIDGET_PUT_HIDDEN + 1000; - public static final int WIDGET_PUT_NO_CLICK_THROUGH_WIDGET = WIDGET_PUT_NO_CLICK_THROUGH + 1000; - public static final int WIDGET_PUT_SCROLL_WIDGET = WIDGET_PUT_SCROLL + 1000; - public static final int WIDGET_PUT_TEXTCOLOR_WIDGET = WIDGET_PUT_TEXTCOLOR + 1000; - public static final int WIDGET_PUT_FILLED_WIDGET = WIDGET_PUT_FILLED + 1000; - public static final int WIDGET_PUT_OPACITY_WIDGET = WIDGET_PUT_OPACITY + 1000; - public static final int WIDGET_PUT_LINE_WIDTH_WIDGET = WIDGET_PUT_LINE_WIDTH + 1000; - public static final int WIDGET_PUT_SPRITEID_WIDGET = WIDGET_PUT_SPRITEID + 1000; - public static final int WIDGET_PUT_TEXTUREID_WIDGET = WIDGET_PUT_TEXTUREID + 1000; - public static final int WIDGET_PUT_SPRITE_TILING_WIDGET = WIDGET_PUT_SPRITE_TILING + 1000; - public static final int WIDGET_PUT_MODELID_1_WIDGET = WIDGET_PUT_MODELID_1 + 1000; - public static final int WIDGET_PUT_3D_ROTATION_WIDGET = WIDGET_PUT_3D_ROTATION + 1000; - public static final int WIDGET_PUT_ANIMATION_WIDGET = WIDGET_PUT_ANIMATION + 1000; - public static final int WIDGET_PUT_TEXT_WIDGET = WIDGET_PUT_TEXT + 1000; - public static final int WIDGET_PUT_FONTID_WIDGET = WIDGET_PUT_FONTID + 1000; - public static final int WIDGET_PUT_TEXT_ALIGNMENT_WIDGET = WIDGET_PUT_TEXT_ALIGNMENT + 1000; - public static final int WIDGET_PUT_TEXT_SHADOWED_WIDGET = WIDGET_PUT_TEXT_SHADOWED + 1000; - public static final int WIDGET_PUT_BORDERTHICKNESS_WIDGET = WIDGET_PUT_BORDERTHICKNESS + 1000; - public static final int WIDGET_PUT_SPRITE2_WIDGET = WIDGET_PUT_SPRITE2 + 1000; - public static final int WIDGET_PUT_FLIPPEDVERTICALLY_WIDGET = WIDGET_PUT_FLIPPEDVERTICALLY + 1000; - public static final int WIDGET_PUT_FLIPPEDHORIZONALLY_WIDGET = WIDGET_PUT_FLIPPEDHORIZONALLY + 1000; - public static final int WIDGET_PUT_SCROLLWIDTHHEIGHT_WIDGET = WIDGET_PUT_SCROLLWIDTHHEIGHT + 1000; - public static final int WIDGET_ADVANCE_DIALOGUE_WIDGET = WIDGET_ADVANCE_DIALOGUE + 1000; - public static final int WIDGET_PUT_MODELID_2_WIDGET = WIDGET_PUT_MODELID_2 + 1000; - public static final int WIDGET_PUT_MODELID_3_WIDGET = WIDGET_PUT_MODELID_3 + 1000; - public static final int WIDGET_PUT_ACTION_WIDGET = WIDGET_PUT_ACTION + 1000; - public static final int WIDGET_PUT_DRAG_PARENT_WIDGET = WIDGET_PUT_DRAG_PARENT + 1000; - public static final int WIDGET_PUT_NAME_WIDGET = WIDGET_PUT_NAME + 1000; - public static final int WIDET_PUT_SELECTED_ACTION_WIDGET = WIDGET_PUT_SELECTED_ACTION + 1000; - public static final int WIDGET_PUT_ACTIONS_NULL_WIDGET = WIDGET_PUT_ACTIONS_NULL + 1000; - public static final int WIDGET_PUT_MOUSE_PRESS_LISTENER_WIDGET = WIDGET_PUT_MOUSE_PRESS_LISTENER + 1000; - public static final int WIDGET_PUT_DRAGGED_OVER_LISTENER_WIDGET = WIDGET_PUT_DRAGGED_OVER_LISTENER + 1000; - public static final int WIDGET_PUT_MOUSE_RELEASE_LISTENER_WIDGET = WIDGET_PUT_MOUSE_RELEASE_LISTENER + 1000; - public static final int WIDGET_PUT_MOUSE_ENTER_LISTENER_WIDGET = WIDGET_PUT_MOUSE_ENTER_LISTENER + 1000; - public static final int WIDGET_PUT_MOUSE_EXIT_LISTENER_WIDGET = WIDGET_PUT_MOUSE_EXIT_LISTENER + 1000; - public static final int WIDGET_PUT_DRAG_START_LISTENER_WIDGET = WIDGET_PUT_DRAG_START_LISTENER + 1000; - public static final int WIDGET_PUT_USE_WITH_LISTENER_WIDGET = WIDGET_PUT_USE_WITH_LISTENER + 1000; - public static final int WIDGET_PUT_CONFIG_LISTENER_WIDGET = WIDGET_PUT_CONFIG_LISTENER + 1000; - public static final int WIDGET_PUT_RENDER_LISTENER_WIDGET = WIDGET_PUT_RENDER_LISTENER + 1000; - public static final int WIDGET_PUT_OPTION_CLICK_LISTENER_WIDGET = WIDGET_PUT_OPTION_CLICK_LISTENER + 1000; - public static final int WIDGET_PUT_DRAG_RELEASE_LISTENER_WIDGET = WIDGET_PUT_DRAG_RELEASE_LISTENER + 1000; - public static final int WIDGET_PUT_DRAG_LISTENER_WIDGET = WIDGET_PUT_DRAG_LISTENER + 1000; - public static final int WIDGET_PUT_MOUSE_HOVER_LISTENER_WIDGET = WIDGET_PUT_MOUSE_HOVER_LISTENER + 1000; - public static final int WIDGET_PUT_TABLE_LISTENER_WIDGET = WIDGET_PUT_TABLE_LISTENER + 1000; - public static final int WIDGET_PUT_SKILL_LISTENER_WIDGET = WIDGET_PUT_SKILL_LISTENER + 1000; - public static final int WIDGET_PUT_USE_LISTENER_WIDGET = WIDGET_PUT_USE_LISTENER + 1000; - public static final int WIDGET_PUT_SCROLL_LISTENER_WIDGET = WIDGET_PUT_SCROLL_LISTENER + 1000; - public static final int WIDGET_PUT_MSG_LISTENER_WIDGET = WIDGET_PUT_MSG_LISTENER + 1000; - public static final int WIDGET_PUT_KEY_LISTENER_WIDGET = WIDGET_PUT_KEY_LISTENER + 1000; - public static final int WIDGET_PUT_FRIENDS_LISTENER_WIDGET = WIDGET_PUT_FRIENDS_LISTENER + 1000; - public static final int WIDGET_PUT_CLAN_LISTENER_WIDGET = WIDGET_PUT_CLAN_LISTENER + 1000; - public static final int WIDGET_PUT_DIALOG_ABORT_LISTENER_WIDGET = WIDGET_PUT_DIALOG_ABORT_LISTENER + 1000; - public static final int WIDGET_PUT_OPENCLOSE_LISTENER_WIDGET = WIDGET_PUT_OPENCLOSE_LISTENER + 1000; - public static final int WIDGET_PUT_GE_LISTENER_WIDGET = WIDGET_PUT_GE_LISTENER + 1000; - public static final int WIDGET_PUT_RESIZE_LISTENER_WIDGET = WIDGET_PUT_RESIZE_LISTENER + 1000; - public static final int WIDGET_GET_RELATIVEX_WIDGET = WIDGET_GET_RELATIVEX + 1000; - public static final int WIDGET_GET_RELATIVEY_WIDGET = WIDGET_GET_RELATIVEY + 1000; - public static final int WIDGET_GET_WIDTH_WIDGET = WIDGET_GET_WIDTH + 1000; - public static final int WIDGET_GET_HEIGHT_WIDGET = WIDGET_GET_HEIGHT + 1000; - public static final int WIDGET_GET_HIDDEN_WIDGET = WIDGET_GET_HIDDEN + 1000; - public static final int WIDGET_GET_PARENTID_WIDGET = WIDGET_GET_PARENTID + 1000; - public static final int WIDGET_GET_SCROLLX_WIDGET = WIDGET_GET_SCROLLX + 1000; - public static final int WIDGET_GET_SCROLLY_WIDGET = WIDGET_GET_SCROLLY + 1000; - public static final int WIDGET_GET_TEXT_WIDGET = WIDGET_GET_TEXT + 1000; - public static final int WIDGET_GET_SCROLLWIDTH_WIDGET = WIDGET_GET_SCROLLWIDTH + 1000; - public static final int WIDGET_GET_SCROLLHEIGHT_WIDGET = WIDGET_GET_SCROLLHEIGHT + 1000; - public static final int WIDGET_GET_MODELZOOM_WIDGET = WIDGET_GET_MODELZOOM + 1000; - public static final int WIDGET_GET_ROTATIONX_WIDGET = WIDGET_GET_ROTATIONX + 1000; - public static final int WIDGET_GET_ROTATIONY_WIDGET = WIDGET_GET_ROTATIONY + 1000; - public static final int WIDGET_GET_ROTATIONZ_WIDGET = WIDGET_GET_ROTATIONZ + 1000; - public static final int WIDGET_GET_OPACITY_WIDGET = WIDGET_GET_OPACITY + 1000; - public static final int WIDGET_GET_TEXTCOLOR_WIDGET = WIDGET_GET_TEXTCOLOR + 1000; - public static final int WIDGET_GET_ITEMID_WIDGET = WIDGET_GET_ITEMID + 1000; - public static final int WIDGET_GET_STACKSIZE_WIDGET = WIDGET_GET_STACKSIZE + 1000; - public static final int WIGET_GET_INDEX_WIDGET = WIDGET_GET_INDEX + 1000; - public static final int GET_WIDGET_ROOT = 2706; - public static final int WIDGET_GET_CONFIG_WIGET = WIDGET_GET_CONFIG + 1000; - public static final int WIDGET_GET_ACTION_WIDGET = WIDGET_GET_ACTION + 1000; - public static final int WIDGET_GET_NAME_WIDGET = WIDGET_GET_NAME + 1000; - public static final int SEND_GAME_MESSAGE = 3100; - public static final int PLAYER_ANIMATE = 3101; - public static final int CLOSE_WINDOW = 3103; - public static final int NUMERIC_INPUT = 3104; - public static final int STRING_INPUT_1 = 3105; - public static final int STRING_INPUT_2 = 3106; - public static final int PLAYER_ACTION = 3107; - public static final int SET_TOP_CONTEXT_MENU_ROW = 3108; - public static final int SET_TOP_CONTEXT_MENU_ROW_2 = 3109; - public static final int SET_MOUSE_BUTTON_CONTROLS_CAMERA = 3110; - public static final int GET_HIDEROOFS = 3111; - public static final int SET_HIDEROOFS = 3112; - public static final int OPEN_URL = 3113; - public static final int ITEM_PRICE = 3115; - public static final int SEND_BUG_REPORT = 3116; - public static final int SET_SHIFT_DROP_ENABLED = 3117; - public static final int SET_CONNECTION_TEXT_ENABLED = 3126; - public static final int PLAY_SOUND_EFFECT = 3200; - public static final int GET_GAMECYCLE = 3300; - public static final int GET_ITEMCONTAINER_ITEMID = 3301; - public static final int GET_ITEMCONTAINER_STACKSIZE = 3302; - public static final int GET_ITEMCONTAINER_STACKSIZES_TOTAL = 3303; - public static final int GET_INVENTORY_SIZE = 3304; - public static final int GET_BOOSTEDSKILLLEVELS = 3305; - public static final int GET_REALSKILLLEVELS = 3306; - public static final int GET_SKILLEXPERIENCES = 3307; - public static final int GET_COORDINATES = 3308; - public static final int DIVIDE_BY_16384 = 3309; - public static final int RIGHT_SHIFT_28 = 3310; - public static final int AND_16384 = 3311; - public static final int GET_ISMEMBERS = 3312; - public static final int GET_ITEMCONTAINER_ITEMID_2 = 3313; - public static final int GET_ITEMCONTAINER_STACKSIZE_2 = 3314; - public static final int GET_ITEMCONTAINER_STACKSIZES_TOTAL_2 = 3315; - public static final int GET_RIGHTS = 3316; - public static final int GET_SYSTEM_UPDATE_TIMER = 3317; - public static final int GET_WORLDNUM = 3318; - public static final int GET_ENERGY = 3321; - public static final int GET_WEIGHT = 3322; - public static final int GET_PLAYERMOD = 3323; - public static final int GET_FLAGS = 3324; - public static final int PACK_LOCATION = 3325; - public static final int GET_ENUM_VALUE = 3408; - public static final int GET_FRIENDCOUNT = 3600; - public static final int GET_FRIEND = 3601; - public static final int GET_FRIEND_WORLD = 3602; - public static final int GET_FRIEND_RANK = 3603; - public static final int ADD_FRIEND = 3605; - public static final int REMOVE_FRIEND = 3606; - public static final int ADD_IGNORE = 3607; - public static final int REMOVE_IGNORE = 3608; - public static final int IS_FRIEND = 3609; - public static final int GET_CLANCHAT_OWNER = 3611; - public static final int GET_CLANCHATCOUNT = 3612; - public static final int GET_CLAN_MEMBER_NAME = 3613; - public static final int GET_CLAN_MEMBER_WORLD = 3614; - public static final int GET_CLAN_MEMBER_RANK = 3615; - public static final int CLANCHAT_KICK_RANK = 3616; - public static final int CLANCHAT_KICK_CLANMEMBER = 3617; - public static final int GET_CLANCHAT_RANK = 3618; - public static final int JOIN_CLANCHAT = 3619; - public static final int PART_CLANCHAT = 3620; - public static final int GET_IGNORECOUNT = 3621; - public static final int GET_IGNORE = 3622; - public static final int IS_IGNORE = 3623; - public static final int CLANMEMBER_ISME = 3624; - public static final int GET_CLANCHATOWNER = 3625; - public static final int GET_GRANDEXCHANGE_OFFER_IS_SELLING = 3903; - public static final int GET_GRANDEXCHANGE_OFFER_ITEMID = 3904; - public static final int GET_GRANDEXCHANGE_OFFER_PRICE = 3905; - public static final int GET_GRANDEXCHANGE_OFFER_TOTALQUANTITY = 3906; - public static final int GET_GRANDEXCHANGE_OFFER_QUANTITYSOLD = 3907; - public static final int GET_GRANDEXCHANGE_OFFER_SPENT = 3908; - public static final int GET_GRANDEXCHANGE_OFFER_NOT_STARTED = 3910; - public static final int GET_GRANDEXCHANGE_OFFER_STATUS_2 = 3911; - public static final int GET_GRANDEXCHANGE_OFFER_DONE = 3912; - public static final int IADD = 4000; - public static final int ISUB = 4001; - public static final int IMUL = 4002; - public static final int IDIV = 4003; - public static final int RAND_EXCL = 4004; - public static final int RAND_INCL = 4005; + public static final int CC_CREATE = 100; + public static final int CC_DELETE = 101; + public static final int CC_DELETEALL = 102; + public static final int CC_FIND = 200; + public static final int IF_FIND = 201; + public static final int CC_SETPOSITION = 1000; + public static final int CC_SETSIZE = 1001; + public static final int CC_SETHIDE = 1003; + public static final int CC_SETNOCLICKTHROUGH = 1005; + public static final int CC_SETSCROLLPOS = 1100; + public static final int CC_SETCOLOUR = 1101; + public static final int CC_SETFILL = 1102; + public static final int CC_SETTRANS = 1103; + public static final int CC_SETLINEWID = 1104; + public static final int CC_SETGRAPHIC = 1105; + public static final int CC_SET2DANGLE = 1106; + public static final int CC_SETTILING = 1107; + public static final int CC_SETMODEL = 1108; + public static final int CC_SETMODELANGLE = 1109; + public static final int CC_SETMODELANIM = 1110; + public static final int CC_SETMODELORTHOG = 1111; + public static final int CC_SETTEXT = 1112; + public static final int CC_SETTEXTFONT = 1113; + public static final int CC_SETTEXTALIGN = 1114; + public static final int CC_SETTEXTSHADOW = 1115; + public static final int CC_SETOUTLINE = 1116; + public static final int CC_SETGRAPHICSHADOW = 1117; + public static final int CC_SETVFLIP = 1118; + public static final int CC_SETHFLIP = 1119; + public static final int CC_SETSCROLLSIZE = 1120; + public static final int CC_RESUME_PAUSEBUTTON = 1121; + public static final int CC_SETFILLCOLOUR = 1123; + public static final int CC_SETLINEDIRECTION = 1126; + public static final int CC_SETOBJECT = 1200; + public static final int CC_SETNPCHEAD = 1201; + public static final int CC_SETPLAYERHEAD_SELF = 1202; + public static final int CC_SETOBJECT_NONUM = 1205; + public static final int CC_SETOBJECT_ALWAYS_NUM = 1212; + public static final int CC_SETOP = 1300; + public static final int CC_SETDRAGGABLE = 1301; + public static final int CC_SETDRAGGABLEBEHAVIOR = 1302; + public static final int CC_SETDRAGDEADZONE = 1303; + public static final int CC_SETDRAGDEADTIME = 1304; + public static final int CC_SETOPBASE = 1305; + public static final int CC_SETTARGETVERB = 1306; + public static final int CC_CLEAROPS = 1307; + public static final int CC_SETONCLICK = 1400; + public static final int CC_SETONHOLD = 1401; + public static final int CC_SETONRELEASE = 1402; + public static final int CC_SETONMOUSEOVER = 1403; + public static final int CC_SETONMOUSELEAVE = 1404; + public static final int CC_SETONDRAG = 1405; + public static final int CC_SETONTARGETLEAVE = 1406; + public static final int CC_SETONVARTRANSMIT = 1407; + public static final int CC_SETONTIMER = 1408; + public static final int CC_SETONOP = 1409; + public static final int CC_SETONDRAGCOMPLETE = 1410; + public static final int CC_SETONCLICKREPEAT = 1411; + public static final int CC_SETONMOUSEREPEAT = 1412; + public static final int CC_SETONINVTRANSMIT = 1414; + public static final int CC_SETONSTATTRANSMIT = 1415; + public static final int CC_SETONTARGETENTER = 1416; + public static final int CC_SETONSCROLLWHEEL = 1417; + public static final int CC_SETONCHATTRANSMIT = 1418; + public static final int CC_SETONKEY = 1419; + public static final int CC_SETONFRIENDTRANSMIT = 1420; + public static final int CC_SETONCLANTRANSMIT = 1421; + public static final int CC_SETONMISCTRANSMIT = 1422; + public static final int CC_SETONDIALOGABORT = 1423; + public static final int CC_SETONSUBCHANGE = 1424; + public static final int CC_SETONSTOCKTRANSMIT = 1425; + public static final int CC_SETONRESIZE = 1427; + public static final int CC_GETX = 1500; + public static final int CC_GETY = 1501; + public static final int CC_GETWIDTH = 1502; + public static final int CC_GETHEIGHT = 1503; + public static final int CC_GETHIDE = 1504; + public static final int CC_GETLAYER = 1505; + public static final int CC_GETSCROLLX = 1600; + public static final int CC_GETSCROLLY = 1601; + public static final int CC_GETTEXT = 1602; + public static final int CC_GETSCROLLWIDTH = 1603; + public static final int CC_GETSCROLLHEIGHT = 1604; + public static final int CC_GETMODELZOOM = 1605; + public static final int CC_GETMODELANGLE_X = 1606; + public static final int CC_GETMODELANGLE_Z = 1607; + public static final int CC_GETMODELANGLE_Y = 1608; + public static final int CC_GETTRANS = 1609; + public static final int CC_GETCOLOUR = 1611; + public static final int CC_GETFILLCOLOUR = 1612; + public static final int CC_GETINVOBJECT = 1700; + public static final int CC_GETINVCOUNT = 1701; + public static final int CC_GETID = 1702; + public static final int CC_GETTARGETMASK = 1800; + public static final int CC_GETOP = 1801; + public static final int CC_GETOPBASE = 1802; + public static final int CC_CALLONRESIZE = 1927; + public static final int IF_SETPOSITION = 2000; + public static final int IF_SETSIZE = 2001; + public static final int IF_SETHIDE = 2003; + public static final int IF_SETNOCLICKTHROUGH = 2005; + public static final int IF_SETSCROLLPOS = 2100; + public static final int IF_SETCOLOUR = 2101; + public static final int IF_SETFILL = 2102; + public static final int IF_SETTRANS = 2103; + public static final int IF_SETLINEWID = 2104; + public static final int IF_SETGRAPHIC = 2105; + public static final int IF_SET2DANGLE = 2106; + public static final int IF_SETTILING = 2107; + public static final int IF_SETMODEL = 2108; + public static final int IF_SETMODELANGLE = 2109; + public static final int IF_SETMODELANIM = 2110; + public static final int IF_SETMODELORTHOG = 2111; + public static final int IF_SETTEXT = 2112; + public static final int IF_SETTEXTFONT = 2113; + public static final int IF_SETTEXTALIGN = 2114; + public static final int IF_SETTEXTSHADOW = 2115; + public static final int IF_SETOUTLINE = 2116; + public static final int IF_SETGRAPHICSHADOW = 2117; + public static final int IF_SETVFLIP = 2118; + public static final int IF_SETHFLIP = 2119; + public static final int IF_SETSCROLLSIZE = 2120; + public static final int IF_RESUME_PAUSEBUTTON = 2121; + public static final int IF_SETFILLCOLOUR = 2123; + public static final int IF_SETLINEDIRECTION = 2126; + public static final int IF_SETOBJECT = 2200; + public static final int IF_SETNPCHEAD = 2201; + public static final int IF_SETPLAYERHEAD_SELF = 2202; + public static final int IF_SETOBJECT_NONUM = 2205; + public static final int IF_SETOBJECT_ALWAYS_NUM = 2212; + public static final int IF_SETOP = 2300; + public static final int IF_SETDRAGGABLE = 2301; + public static final int IF_SETDRAGGABLEBEHAVIOR = 2302; + public static final int IF_SETDRAGDEADZONE = 2303; + public static final int IF_SETDRAGDEADTIME = 2304; + public static final int IF_SETOPBASE = 2305; + public static final int IF_SETTARGETVERB = 2306; + public static final int IF_CLEAROPS = 2307; + public static final int IF_SETOPKEY = 2350; + public static final int IF_SETOPTKEY = 2351; + public static final int IF_SETOPKEYRATE = 2352; + public static final int IF_SETOPTKEYRATE = 2353; + public static final int IF_SETOPKEYIGNOREHELD = 2354; + public static final int IF_SETOPTKEYIGNOREHELD = 2355; + public static final int IF_SETONCLICK = 2400; + public static final int IF_SETONHOLD = 2401; + public static final int IF_SETONRELEASE = 2402; + public static final int IF_SETONMOUSEOVER = 2403; + public static final int IF_SETONMOUSELEAVE = 2404; + public static final int IF_SETONDRAG = 2405; + public static final int IF_SETONTARGETLEAVE = 2406; + public static final int IF_SETONVARTRANSMIT = 2407; + public static final int IF_SETONTIMER = 2408; + public static final int IF_SETONOP = 2409; + public static final int IF_SETONDRAGCOMPLETE = 2410; + public static final int IF_SETONCLICKREPEAT = 2411; + public static final int IF_SETONMOUSEREPEAT = 2412; + public static final int IF_SETONINVTRANSMIT = 2414; + public static final int IF_SETONSTATTRANSMIT = 2415; + public static final int IF_SETONTARGETENTER = 2416; + public static final int IF_SETONSCROLLWHEEL = 2417; + public static final int IF_SETONCHATTRANSMIT = 2418; + public static final int IF_SETONKEY = 2419; + public static final int IF_SETONFRIENDTRANSMIT = 2420; + public static final int IF_SETONCLANTRANSMIT = 2421; + public static final int IF_SETONMISCTRANSMIT = 2422; + public static final int IF_SETONDIALOGABORT = 2423; + public static final int IF_SETONSUBCHANGE = 2424; + public static final int IF_SETONSTOCKTRANSMIT = 2425; + public static final int IF_SETONRESIZE = 2427; + public static final int IF_GETX = 2500; + public static final int IF_GETY = 2501; + public static final int IF_GETWIDTH = 2502; + public static final int IF_GETHEIGHT = 2503; + public static final int IF_GETHIDE = 2504; + public static final int IF_GETLAYER = 2505; + public static final int IF_GETSCROLLX = 2600; + public static final int IF_GETSCROLLY = 2601; + public static final int IF_GETTEXT = 2602; + public static final int IF_GETSCROLLWIDTH = 2603; + public static final int IF_GETSCROLLHEIGHT = 2604; + public static final int IF_GETMODELZOOM = 2605; + public static final int IF_GETMODELANGLE_X = 2606; + public static final int IF_GETMODELANGLE_Z = 2607; + public static final int IF_GETMODELANGLE_Y = 2608; + public static final int IF_GETTRANS = 2609; + public static final int IF_GETCOLOUR = 2611; + public static final int IF_GETFILLCOLOUR = 2612; + public static final int IF_GETINVOBJECT = 2700; + public static final int IF_GETINVCOUNT = 2701; + public static final int IF_HASSUB = 2702; + public static final int IF_GETTOP = 2706; + public static final int IF_GETTARGETMASK = 2800; + public static final int IF_GETOP = 2801; + public static final int IF_GETOPBASE = 2802; + public static final int IF_CALLONRESIZE = 2927; + public static final int MES = 3100; + public static final int ANIM = 3101; + public static final int IF_CLOSE = 3103; + public static final int RESUME_COUNTDIALOG = 3104; + public static final int RESUME_NAMEDIALOG = 3105; + public static final int RESUME_STRINGDIALOG = 3106; + public static final int OPPLAYER = 3107; + public static final int IF_DRAGPICKUP = 3108; + public static final int CC_DRAGPICKUP = 3109; + public static final int MOUSECAM = 3110; + public static final int GETREMOVEROOFS = 3111; + public static final int SETREMOVEROOFS = 3112; + public static final int OPENURL = 3113; + public static final int RESUME_OBJDIALOG = 3115; + public static final int BUG_REPORT = 3116; + public static final int SETSHIFTCLICKDROP = 3117; + public static final int SETSHOWMOUSEOVERTEXT = 3118; + public static final int RENDERSELF = 3119; + public static final int SETSHOWMOUSECROSS = 3125; + public static final int SETSHOWLOADINGMESSAGES = 3126; + public static final int SETTAPTODROP = 3127; + public static final int GETTAPTODROP = 3128; + public static final int GETCANVASSIZE = 3132; + public static final int SETHIDEUSERNAME = 3141; + public static final int GETHIDEUSERNAME = 3142; + public static final int SETREMEMBERUSERNAME = 3143; + public static final int GETREMEMBERUSERNAME = 3144; + public static final int SOUND_SYNTH = 3200; + public static final int SOUND_SONG = 3201; + public static final int SOUND_JINGLE = 3202; + public static final int CLIENTCLOCK = 3300; + public static final int INV_GETOBJ = 3301; + public static final int INV_GETNUM = 3302; + public static final int INV_TOTAL = 3303; + public static final int INV_SIZE = 3304; + public static final int STAT = 3305; + public static final int STAT_BASE = 3306; + public static final int STAT_XP = 3307; + public static final int COORD = 3308; + public static final int COORDX = 3309; + public static final int COORDZ = 3310; + public static final int COORDY = 3311; + public static final int MAP_MEMBERS = 3312; + public static final int INVOTHER_GETOBJ = 3313; + public static final int INVOTHER_GETNUM = 3314; + public static final int INVOTHER_TOTAL = 3315; + public static final int STAFFMODLEVEL = 3316; + public static final int REBOOTTIMER = 3317; + public static final int MAP_WORLD = 3318; + public static final int RUNENERGY_VISIBLE = 3321; + public static final int RUNWEIGHT_VISIBLE = 3322; + public static final int PLAYERMOD = 3323; + public static final int WORLDFLAGS = 3324; + public static final int MOVECOORD = 3325; + public static final int ENUM_STRING = 3400; + public static final int ENUM = 3408; + public static final int ENUM_GETOUTPUTCOUNT = 3411; + public static final int FRIEND_COUNT = 3600; + public static final int FRIEND_GETNAME = 3601; + public static final int FRIEND_GETWORLD = 3602; + public static final int FRIEND_GETRANK = 3603; + public static final int FRIEND_SETRANK = 3604; + public static final int FRIEND_ADD = 3605; + public static final int FRIEND_DEL = 3606; + public static final int IGNORE_ADD = 3607; + public static final int IGNORE_DEL = 3608; + public static final int FRIEND_TEST = 3609; + public static final int CLAN_GETCHATDISPLAYNAME = 3611; + public static final int CLAN_GETCHATCOUNT = 3612; + public static final int CLAN_GETCHATUSERNAME = 3613; + public static final int CLAN_GETCHATUSERWORLD = 3614; + public static final int CLAN_GETCHATUSERRANK = 3615; + public static final int CLAN_GETCHATMINKICK = 3616; + public static final int CLAN_KICKUSER = 3617; + public static final int CLAN_GETCHATRANK = 3618; + public static final int CLAN_JOINCHAT = 3619; + public static final int CLAN_LEAVECHAT = 3620; + public static final int IGNORE_COUNT = 3621; + public static final int IGNORE_GETNAME = 3622; + public static final int IGNORE_TEST = 3623; + public static final int CLAN_ISSELF = 3624; + public static final int CLAN_GETCHATOWNERNAME = 3625; + public static final int CLAN_ISFRIEND = 3626; + public static final int CLAN_ISIGNORE = 3627; + public static final int STOCKMARKET_GETOFFERTYPE = 3903; + public static final int STOCKMARKET_GETOFFERITEM = 3904; + public static final int STOCKMARKET_GETOFFERPRICE = 3905; + public static final int STOCKMARKET_GETOFFERCOUNT = 3906; + public static final int STOCKMARKET_GETOFFERCOMPLETEDCOUNT = 3907; + public static final int STOCKMARKET_GETOFFERCOMPLETEDGOLD = 3908; + public static final int STOCKMARKET_ISOFFEREMPTY = 3910; + public static final int STOCKMARKET_ISOFFERSTABLE = 3911; + public static final int STOCKMARKET_ISOFFERFINISHED = 3912; + public static final int STOCKMARKET_ISOFFERADDING = 3913; + public static final int TRADINGPOST_SORTBY_NAME = 3914; + public static final int TRADINGPOST_SORTBY_PRICE = 3915; + public static final int TRADINGPOST_SORTFILTERBY_WORLD = 3916; + public static final int TRADINGPOST_SORTBY_AGE = 3917; + public static final int TRADINGPOST_SORTBY_COUNT = 3918; + public static final int TRADINGPOST_GETTOTALOFFERS = 3919; + public static final int TRADINGPOST_GETOFFERWORLD = 3920; + public static final int TRADINGPOST_GETOFFERNAME = 3921; + public static final int TRADINGPOST_GETOFFERPREVIOUSNAME = 3922; + public static final int TRADINGPOST_GETOFFERAGE = 3923; + public static final int TRADINGPOST_GETOFFERCOUNT = 3924; + public static final int TRADINGPOST_GETOFFERPRICE = 3925; + public static final int TRADINGPOST_GETOFFERITEM = 3926; + public static final int ADD = 4000; + public static final int SUB = 4001; + public static final int MULTIPLY = 4002; + public static final int DIV = 4003; + public static final int RANDOM = 4004; + public static final int RANDOMINC = 4005; public static final int INTERPOLATE = 4006; - public static final int ADD_PERCENT = 4007; - public static final int SET_BIT = 4008; - public static final int CLEAR_BIT = 4009; - public static final int TEST_BIT = 4010; - public static final int MODULO = 4011; + public static final int ADDPERCENT = 4007; + public static final int SETBIT = 4008; + public static final int CLEARBIT = 4009; + public static final int TESTBIT = 4010; + public static final int MOD = 4011; public static final int POW = 4012; public static final int INVPOW = 4013; public static final int AND = 4014; public static final int OR = 4015; public static final int SCALE = 4018; - public static final int CONCAT_INT = 4100; - public static final int CONCAT_STRING = 4101; - public static final int TOLOWERCASE = 4103; - public static final int FORMAT_DATE = 4104; - public static final int SWITCH_MALE_OR_FEMALE = 4105; - public static final int INT_TO_STRING = 4106; - public static final int STRING_COMPARE = 4107; - public static final int GET_LINE_COUNT = 4108; - public static final int GET_MAX_LINE_WIDTH = 4109; - public static final int SWITCH_STRING = 4110; - public static final int APPENDTAGS = 4111; - public static final int CONCAT_CHAR = 4112; - public static final int CHAR_IS_PRINTABLE = 4113; - public static final int ISALNUM = 4114; - public static final int ISALPHA = 4115; - public static final int ISDIGIT = 4116; + public static final int APPEND_NUM = 4100; + public static final int APPEND = 4101; + public static final int APPEND_SIGNNUM = 4102; + public static final int LOWERCASE = 4103; + public static final int FROMDATE = 4104; + public static final int TEXT_GENDER = 4105; + public static final int TOSTRING = 4106; + public static final int COMPARE = 4107; + public static final int PARAHEIGHT = 4108; + public static final int PARAWIDTH = 4109; + public static final int TEXT_SWITCH = 4110; + public static final int ESCAPE = 4111; + public static final int APPEND_CHAR = 4112; + public static final int CHAR_ISPRINTABLE = 4113; + public static final int CHAR_ISALPHANUMERIC = 4114; + public static final int CHAR_ISALPHA = 4115; + public static final int CHAR_ISNUMERIC = 4116; public static final int STRING_LENGTH = 4117; - public static final int STRING_SUBSTRING = 4118; - public static final int STRING_REMOVE_HTML = 4119; - public static final int STRING_INDEXOF = 4120; - public static final int STRING_INDEXOF_FROM = 4121; - public static final int GET_ITEM_NAME = 4200; - public static final int GET_ITEM_GROUND_ACTION = 4201; - public static final int GET_ITEM_INVENTORY_ACTION = 4202; - public static final int GET_ITEM_PRICE = 4203; - public static final int GET_ITEM_STACKABLE = 4204; - public static final int GET_ITEM_NOTE_1 = 4205; - public static final int GET_ITEM_NOTE_2 = 4206; - public static final int GET_ITEM_ISMEMBERS = 4207; - public static final int SEARCH_ITEM = 4210; - public static final int NEXT_SEARCH_RESULT = 4211; - public static final int CHATFILTER_UPDATE = 5001; - public static final int REPORT_PLAYER = 5002; - public static final int GET_CHAT_MESSAGE_TYPE = 5003; - public static final int GET_CHAT_MESSAGE = 5004; - public static final int CHATBOX_INPUT = 5008; - public static final int PRIVMSG = 5009; - public static final int GET_LOCALPLAYER_NAME = 5015; - public static final int GET_CHATLINEBUFFER_LENGTH = 5017; - public static final int GET_MESSAGENODE_PREV_ID = 5018; - public static final int GET_MESSAGENODE_NEXT_ID = 5019; - public static final int RUN_COMMAND = 5020; - public static final int GET_ISRESIZED = 5306; - public static final int SET_ISRESIZED = 5307; - public static final int GET_SCREENTYPE = 5308; - public static final int SET_SCREENTYPE = 5309; - public static final int GET_MAPANGLE = 5506; - public static final int SET_CAMERA_FOCAL_POINT_HEIGHT = 5530; - public static final int GET_CAMERA_FOCAL_POINT_HEIGHT = 5531; - public static final int CANCEL_LOGIN = 5630; - public static final int SET_ZOOM_DISTANCE = 6201; - public static final int GET_VIEWPORT_SIZE = 6203; - public static final int GET_ZOOM_DISTANCE = 6204; - public static final int LOAD_WORLDS = 6500; - public static final int GET_FIRST_WORLD = 6501; - public static final int GET_NEXT_WORLD = 6502; - public static final int GET_WORLD_BY_ID = 6506; - public static final int GET_WORLD_BY_INDEX = 6511; - public static final int GET_IS_MOBILE = 6518; - public static final int GET_MAP_SURFACE_NAME_BY_ID = 6601; - public static final int SET_CURRENT_MAP_SURFACE = 6602; - public static final int GET_CURRENT_MAP_ZOOM = 6603; - public static final int SET_CURRENT_MAP_ZOOM = 6604; - public static final int SET_MAP_POSITION = 6606; - public static final int SET_MAP_POSITION_IMMEDIATE = 6607; - public static final int SET_MAP_POSITION_2 = 6608; - public static final int SET_MAP_POSITION_IMMEDIATE_2 = 6609; - public static final int GET_MAP_POSITION = 6610; - public static final int GET_MAP_DEFAULT_POSITION_BY_ID = 6611; - public static final int GET_MAP_DIMENSIONS_BY_ID = 6612; - public static final int GET_MAP_BOUNDS_BY_ID = 6613; - public static final int GET_MAP_INITAL_ZOOM_BY_ID = 6614; - public static final int GET_CURRENT_MAP_ID = 6616; - public static final int MAP_ID_CONTAINS_COORD = 6621; - public static final int GET_MAP_DISPLAY_DIMENSIONS = 6622; - public static final int GET_MAP_ID_CONTAINING_COORD = 6623; - public static final int SET_MAP_ICON_FLASH_COUNT = 6624; - public static final int RESET_MAP_ICON_FLASH_COUNT = 6625; - public static final int SET_MAP_ICON_FLASH_PERIOD = 6626; - public static final int RESET_MAP_ICON_FLASH_PERIOD = 6627; - public static final int SET_MAP_ICON_FLASH_FOREVER = 6628; - public static final int FLASH_MAP_ICONS_BY_ID = 6629; - public static final int FLASH_MAP_ICONS_BY_GROUP = 6630; - public static final int CLEAR_FLASHING_ICONS = 6631; - public static final int SET_MAP_ICONS_DISABLED = 6632; - public static final int SET_MAP_ICONS_ENABLED_BY_ID = 6633; - public static final int SET_MAP_ICONS_ENABLED_BY_GROUP = 6634; - public static final int GET_MAP_ICONS_DISABLED = 6635; - public static final int GET_MAP_ICONS_ENABLED_BY_ID = 6636; - public static final int GET_MAP_ICONS_ENABLED_BY_GROUP = 6637; - public static final int GET_FIRST_MAP_ICON = 6639; - public static final int GET_NEXT_MAP_ICON = 6640; - public static final int GET_MAPICON_NAME_BY_ID = 6693; - public static final int GET_MAPICON_FONT_SIZE = 6694; - public static final int GET_MAPICON_GROUP_BY_ID = 6695; - public static final int GET_MAPICON_SPRITE_BY_ID = 6696; - public static final int GET_CURRENT_MAPICON_ID = 6697; - public static final int GET_CURRENT_MAPICON_COORD = 6698; - public static final int GET_CURRENT_MAPICON_OTHER_COORD = 6699; + public static final int SUBSTRING = 4118; + public static final int REMOVETAGS = 4119; + public static final int STRING_INDEXOF_CHAR = 4120; + public static final int STRING_INDEXOF_STRING = 4121; + public static final int OC_NAME = 4200; + public static final int OC_OP = 4201; + public static final int OC_IOP = 4202; + public static final int OC_COST = 4203; + public static final int OC_STACKABLE = 4204; + public static final int OC_CERT = 4205; + public static final int OC_UNCERT = 4206; + public static final int OC_MEMBERS = 4207; + public static final int OC_PLACEHOLDER = 4208; + public static final int OC_UNPLACEHOLDER = 4209; + public static final int OC_FIND = 4210; + public static final int OC_FINDNEXT = 4211; + public static final int OC_FINDRESET = 4212; + public static final int CHAT_GETFILTER_PUBLIC = 5000; + public static final int CHAT_SETFILTER = 5001; + public static final int CHAT_SENDABUSEREPORT = 5002; + public static final int CHAT_GETHISTORY_BYTYPEANDLINE = 5003; + public static final int CHAT_GETHISTORY_BYUID = 5004; + public static final int CHAT_GETFILTER_PRIVATE = 5005; + public static final int CHAT_SENDPUBLIC = 5008; + public static final int CHAT_SENDPRIVATE = 5009; + public static final int CHAT_PLAYERNAME = 5015; + public static final int CHAT_GETFILTER_TRADE = 5016; + public static final int CHAT_GETHISTORYLENGTH = 5017; + public static final int CHAT_GETNEXTUID = 5018; + public static final int CHAT_GETPREVUID = 5019; + public static final int DOCHEAT = 5020; + public static final int CHAT_SETMESSAGEFILTER = 5021; + public static final int CHAT_GETMESSAGEFILTER = 5022; + public static final int GETWINDOWMODE = 5306; + public static final int SETWINDOWMODE = 5307; + public static final int GETDEFAULTWINDOWMODE = 5308; + public static final int SETDEFAULTWINDOWMODE = 5309; + public static final int CAM_FORCEANGLE = 5504; + public static final int CAM_GETANGLE_XA = 5505; + public static final int CAM_GETANGLE_YA = 5506; + public static final int CAM_SETFOLLOWHEIGHT = 5530; + public static final int CAM_GETFOLLOWHEIGHT = 5531; + public static final int LOGOUT = 5630; + public static final int VIEWPORT_SETFOV = 6200; + public static final int VIEWPORT_SETZOOM = 6201; + public static final int VIEWPORT_CLAMPFOV = 6202; + public static final int VIEWPORT_GETEFFECTIVESIZE = 6203; + public static final int VIEWPORT_GETZOOM = 6204; + public static final int VIEWPORT_GETFOV = 6205; + public static final int WORLDLIST_FETCH = 6500; + public static final int WORLDLIST_START = 6501; + public static final int WORLDLIST_NEXT = 6502; + public static final int WORLDLIST_SPECIFIC = 6506; + public static final int WORLDLIST_SORT = 6507; + public static final int SETFOLLOWEROPSLOWPRIORITY = 6512; + public static final int NC_PARAM = 6513; + public static final int LC_PARAM = 6514; + public static final int OC_PARAM = 6515; + public static final int STRUCT_PARAM = 6516; + public static final int ON_MOBILE = 6518; + public static final int CLIENTTYPE = 6519; + public static final int BATTERYLEVEL = 6524; + public static final int BATTERYCHARGING = 6525; + public static final int WIFIAVAILABLE = 6526; + public static final int WORLDMAP_GETMAPNAME = 6601; + public static final int WORLDMAP_SETMAP = 6602; + public static final int WORLDMAP_GETZOOM = 6603; + public static final int WORLDMAP_SETZOOM = 6604; + public static final int WORLDMAP_ISLOADED = 6605; + public static final int WORLDMAP_JUMPTODISPLAYCOORD = 6606; + public static final int WORLDMAP_JUMPTODISPLAYCOORD_INSTANT = 6607; + public static final int WORLDMAP_JUMPTOSOURCECOORD = 6608; + public static final int WORLDMAP_JUMPTOSOURCECOORD_INSTANT = 6609; + public static final int WORLDMAP_GETDISPLAYPOSITION = 6610; + public static final int WORLDMAP_GETCONFIGORIGIN = 6611; + public static final int WORLDMAP_GETCONFIGSIZE = 6612; + public static final int WORLDMAP_GETCONFIGBOUNDS = 6613; + public static final int WORLDMAP_GETCONFIGZOOM = 6614; + public static final int WORLDMAP_GETCURRENTMAP = 6616; + public static final int WORLDMAP_GETDISPLAYCOORD = 6617; + public static final int WORLDMAP_COORDINMAP = 6621; + public static final int WORLDMAP_GETSIZE = 6622; + public static final int WORLDMAP_PERPETUALFLASH = 6628; + public static final int WORLDMAP_FLASHELEMENT = 6629; + public static final int WORLDMAP_FLASHELEMENTCATEGORY = 6630; + public static final int WORLDMAP_STOPCURRENTFLASHES = 6631; + public static final int WORLDMAP_DISABLEELEMENTS = 6632; + public static final int WORLDMAP_DISABLEELEMENT = 6633; + public static final int WORLDMAP_DISABLEELEMENTCATEGORY = 6634; + public static final int WORLDMAP_GETDISABLEELEMENTS = 6635; + public static final int WORLDMAP_GETDISABLEELEMENT = 6636; + public static final int WORLDMAP_GETDISABLEELEMENTCATEGORY = 6637; + public static final int WORLDMAP_LISTELEMENT_START = 6639; + public static final int WORLDMAP_LISTELEMENT_NEXT = 6640; + public static final int MEC_TEXT = 6693; + public static final int MEC_TEXTSIZE = 6694; + public static final int MEC_CATEGORY = 6695; + public static final int MEC_SPRITE = 6696; } diff --git a/cache/src/main/java/net/runelite/cache/script/disassembler/Disassembler.java b/cache/src/main/java/net/runelite/cache/script/disassembler/Disassembler.java index a672d3b965..0a6382fec8 100644 --- a/cache/src/main/java/net/runelite/cache/script/disassembler/Disassembler.java +++ b/cache/src/main/java/net/runelite/cache/script/disassembler/Disassembler.java @@ -204,7 +204,7 @@ public class Disassembler switch (opcode) { - case Opcodes.LOAD_INT: + case Opcodes.ICONST: case Opcodes.ILOAD: case Opcodes.SLOAD: case Opcodes.ISTORE: diff --git a/runelite-script-assembler-plugin/src/main/java/net/runelite/script/RuneLiteInstructions.java b/runelite-script-assembler-plugin/src/main/java/net/runelite/script/RuneLiteInstructions.java index 654e5e407c..02073e8144 100644 --- a/runelite-script-assembler-plugin/src/main/java/net/runelite/script/RuneLiteInstructions.java +++ b/runelite-script-assembler-plugin/src/main/java/net/runelite/script/RuneLiteInstructions.java @@ -33,6 +33,6 @@ public class RuneLiteInstructions extends Instructions public void init() { super.init(); - add(RUNELITE_EXECUTE, "runelite_callback", 0, 0, 1, 0); + add(RUNELITE_EXECUTE, "runelite_callback"); } } From fc48e2a93678f0ca0db2d98810bbec371b6b8fd5 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Fri, 8 Mar 2019 05:28:02 -0700 Subject: [PATCH 228/304] Rewrite scripts with new opcodes --- .../cache/script/assembler/681.rs2asm | 222 ++--- .../runelite/cache/script/assembler/91.rs2asm | 72 +- .../cache/script/assembler/Unicode.rs2asm | 2 +- .../src/main/scripts/BankSearchFilter.rs2asm | 68 +- .../src/main/scripts/BankSearchLayout.rs2asm | 576 +++++------ .../src/main/scripts/ChatBuilder.rs2asm | 906 +++++++++--------- .../src/main/scripts/ChatSplitBuilder.rs2asm | 570 +++++------ .../src/main/scripts/ChatboxInput.rs2asm | 48 +- .../scripts/ChatboxInputWidgetBuilder.rs2asm | 218 ++--- .../src/main/scripts/CommandScript.rs2asm | 248 ++--- .../main/scripts/OpenBankSearchInput.rs2asm | 46 +- .../main/scripts/OptionsPanelRebuilder.rs2asm | 528 +++++----- .../OptionsPanelZoomMouseListener.rs2asm | 80 +- .../scripts/OptionsPanelZoomUpdater.rs2asm | 86 +- .../src/main/scripts/PrivateMessage.rs2asm | 210 ++-- .../src/main/scripts/ResetChatboxInput.rs2asm | 260 ++--- .../scripts/ScrollWheelZoomHandler.rs2asm | 28 +- .../main/scripts/SendPrivateMessage.rs2asm | 4 +- .../src/main/scripts/SkillTabBuilder.rs2asm | 422 ++++---- .../main/scripts/SkillTabTotalLevel.rs2asm | 96 +- .../src/main/scripts/TriggerBankLayout.rs2asm | 20 +- .../src/main/scripts/ZoomHandler.rs2asm | 70 +- runelite-client/src/main/scripts/null.rs2asm | 2 +- 23 files changed, 2391 insertions(+), 2391 deletions(-) diff --git a/cache/src/test/resources/net/runelite/cache/script/assembler/681.rs2asm b/cache/src/test/resources/net/runelite/cache/script/assembler/681.rs2asm index b70b4c7eee..a5f4222fdb 100644 --- a/cache/src/test/resources/net/runelite/cache/script/assembler/681.rs2asm +++ b/cache/src/test/resources/net/runelite/cache/script/assembler/681.rs2asm @@ -3,28 +3,28 @@ .string_stack_count 0 .int_var_count 2 .string_var_count 1 - get_varc 5 - load_int 14 + get_varc_int 5 + iconst 14 if_icmpeq LABEL4 jump LABEL7 LABEL4: - load_int 1 - put_varc 66 + iconst 1 + set_varc_int 66 return LABEL7: - load_int -1 + iconst -1 istore 0 - load_string "" + sconst "" sstore 0 - get_varc_string 22 + get_varc_string_old 22 string_length istore 1 iload 1 - load_int 0 + iconst 0 if_icmpgt LABEL18 jump LABEL193 LABEL18: - get_varc 5 + get_varc_int 5 switch 1: LABEL21 2: LABEL44 @@ -46,90 +46,90 @@ LABEL21: return jump LABEL192 LABEL23: - get_ignorecount - load_int 0 + ignore_count + iconst 0 if_icmplt LABEL27 jump LABEL30 LABEL27: - load_string "Unable to update ignore list - system busy." - send_game_message + sconst "Unable to update ignore list - system busy." + mes jump LABEL43 LABEL30: - get_varc 5 - load_int 4 + get_varc_int 5 + iconst 4 if_icmpeq LABEL34 jump LABEL37 LABEL34: - get_varc_string 22 - add_ignore + get_varc_string_old 22 + ignore_add jump LABEL43 LABEL37: - get_varc 5 - load_int 5 + get_varc_int 5 + iconst 5 if_icmpeq LABEL41 jump LABEL43 LABEL41: - get_varc_string 22 - remove_ignore + get_varc_string_old 22 + ignore_del LABEL43: jump LABEL192 LABEL44: - get_friendcount - load_int 0 + friend_count + iconst 0 if_icmplt LABEL48 jump LABEL51 LABEL48: - load_string "Unable to complete action - system busy." - send_game_message + sconst "Unable to complete action - system busy." + mes jump LABEL109 LABEL51: - get_varc 5 - load_int 2 + get_varc_int 5 + iconst 2 if_icmpeq LABEL55 jump LABEL58 LABEL55: - get_varc_string 22 - add_friend + get_varc_string_old 22 + friend_add jump LABEL109 LABEL58: - get_varc 5 - load_int 3 + get_varc_int 5 + iconst 3 if_icmpeq LABEL62 jump LABEL65 LABEL62: - get_varc_string 22 - remove_friend + get_varc_string_old 22 + friend_del jump LABEL109 LABEL65: - get_varc 5 - load_int 6 + get_varc_int 5 + iconst 6 if_icmpeq LABEL69 jump LABEL109 LABEL69: - get_varc 203 - load_int 0 + get_varc_int 203 + iconst 0 if_icmpeq LABEL76 - get_varc 203 - load_int -1 + get_varc_int 203 + iconst -1 if_icmpeq LABEL76 jump LABEL82 LABEL76: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 - load_string "You must set a name before you can chat." - send_game_message + sconst "You must set a name before you can chat." + mes return LABEL82: - 5005 - load_int 2 + chat_getfilter_private + iconst 2 if_icmpeq LABEL86 jump LABEL97 LABEL86: - 5000 - load_int 1 - 5016 - chatfilter_update + chat_getfilter_public + iconst 1 + chat_getfilter_trade + chat_setfilter invoke 178 invoke 553 istore 0 @@ -139,123 +139,123 @@ LABEL86: invoke 89 LABEL97: get_varbit 4394 - load_int 1 + iconst 1 if_icmpeq LABEL101 jump LABEL104 LABEL101: - get_varc_string 23 - remove_friend + get_varc_string_old 23 + friend_del jump LABEL107 LABEL104: - get_varc_string 23 - get_varc_string 22 - privmsg + get_varc_string_old 23 + get_varc_string_old 22 + chat_sendprivate LABEL107: - get_gamecycle - put_varc 61 + clientclock + set_varc_int 61 LABEL109: jump LABEL192 LABEL110: - get_varc_string 22 + get_varc_string_old 22 invoke 212 - numeric_input + resume_countdialog jump LABEL192 LABEL114: - get_varc_string 22 - string_remove_html - put_varc_string 128 - get_varc_string 22 - string_input_1 + get_varc_string_old 22 + removetags + set_varc_string_old 128 + get_varc_string_old 22 + resume_namedialog jump LABEL192 LABEL120: - get_varc_string 22 - string_input_2 + get_varc_string_old 22 + resume_stringdialog jump LABEL192 LABEL123: - get_varc 203 - load_int 0 + get_varc_int 203 + iconst 0 if_icmpeq LABEL130 - get_varc 203 - load_int -1 + get_varc_int 203 + iconst -1 if_icmpeq LABEL130 jump LABEL136 LABEL130: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 - load_string "You must set a name before you can chat." - send_game_message + sconst "You must set a name before you can chat." + mes return LABEL136: - get_varc_string 22 - string_remove_html - put_varc_string 129 - get_varc_string 22 - join_clanchat + get_varc_string_old 22 + removetags + set_varc_string_old 129 + get_varc_string_old 22 + clan_joinchat jump LABEL192 LABEL142: iload 1 - load_int 10 + iconst 10 if_icmpgt LABEL146 jump LABEL152 LABEL146: - get_varc_string 22 - load_int 0 - load_int 9 - string_substring + get_varc_string_old 22 + iconst 0 + iconst 9 + substring sstore 0 jump LABEL154 LABEL152: - get_varc_string 22 + get_varc_string_old 22 sstore 0 LABEL154: sload 0 - tolowercase - 5021 + lowercase + chat_setmessagefilter invoke 553 invoke 84 jump LABEL192 LABEL160: - get_varc 203 - load_int 0 + get_varc_int 203 + iconst 0 if_icmpeq LABEL167 - get_varc 203 - load_int -1 + get_varc_int 203 + iconst -1 if_icmpeq LABEL167 jump LABEL173 LABEL167: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 - load_string "You must set a name before you can chat." - send_game_message + sconst "You must set a name before you can chat." + mes return LABEL173: - get_varc_string 22 - load_int 0 - put_varc 62 - put_varc_string 28 + get_varc_string_old 22 + iconst 0 + set_varc_int 62 + set_varc_string_old 28 invoke 95 - load_int 552 - load_int -2147483645 - load_int 1 - load_string "I1" - load_int 10616843 - widget_put_render_listener_widget + iconst 552 + iconst -2147483645 + iconst 1 + sconst "I1" + iconst 10616843 + if_setontimer jump LABEL192 LABEL185: - load_int 0 - load_int 1 + iconst 0 + iconst 1 invoke 299 return jump LABEL192 LABEL190: - get_varc_string 22 + get_varc_string_old 22 invoke 2061 LABEL192: jump LABEL199 LABEL193: - get_varc 5 + get_varc_int 5 switch 16: LABEL198 7: LABEL196 @@ -269,7 +269,7 @@ LABEL196: LABEL198: return LABEL199: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 return diff --git a/cache/src/test/resources/net/runelite/cache/script/assembler/91.rs2asm b/cache/src/test/resources/net/runelite/cache/script/assembler/91.rs2asm index 901c7169ad..25a749a77b 100644 --- a/cache/src/test/resources/net/runelite/cache/script/assembler/91.rs2asm +++ b/cache/src/test/resources/net/runelite/cache/script/assembler/91.rs2asm @@ -12,111 +12,111 @@ jump LABEL84 LABEL3: iload 1 - get_varc 175 + get_varc_int 175 if_icmplt LABEL7 jump LABEL9 LABEL7: - load_int 0 + iconst 0 return LABEL9: sload 0 - string_remove_html - is_ignore - load_int 1 + removetags + ignore_test + iconst 1 if_icmpeq LABEL15 jump LABEL17 LABEL15: - load_int 0 + iconst 0 return LABEL17: - load_int 1 + iconst 1 return jump LABEL84 LABEL20: iload 1 - get_varc 175 + get_varc_int 175 if_icmplt LABEL24 jump LABEL26 LABEL24: - load_int 0 + iconst 0 return LABEL26: sload 0 - string_remove_html - is_ignore - load_int 1 + removetags + ignore_test + iconst 1 if_icmpeq LABEL32 jump LABEL34 LABEL32: - load_int 0 + iconst 0 return LABEL34: - 5005 - load_int 0 + chat_getfilter_private + iconst 0 if_icmpeq LABEL38 jump LABEL40 LABEL38: - load_int 1 + iconst 1 return LABEL40: - 5005 - load_int 1 + chat_getfilter_private + iconst 1 if_icmpeq LABEL44 jump LABEL51 LABEL44: sload 0 - is_friend - load_int 1 + friend_test + iconst 1 if_icmpeq LABEL49 jump LABEL51 LABEL49: - load_int 1 + iconst 1 return LABEL51: - load_int 0 + iconst 0 return jump LABEL84 LABEL54: iload 1 - get_varc 175 + get_varc_int 175 if_icmplt LABEL58 jump LABEL60 LABEL58: - load_int 0 + iconst 0 return LABEL60: iload 0 - load_int 5 + iconst 5 if_icmpeq LABEL64 jump LABEL76 LABEL64: get_varbit 1627 - load_int 0 + iconst 0 if_icmpeq LABEL68 jump LABEL76 LABEL68: - get_gamecycle + clientclock iload 1 - isub - load_int 500 + sub + iconst 500 if_icmpge LABEL74 jump LABEL76 LABEL74: - load_int 0 + iconst 0 return LABEL76: - 5005 - load_int 2 + chat_getfilter_private + iconst 2 if_icmpne LABEL80 jump LABEL82 LABEL80: - load_int 1 + iconst 1 return LABEL82: - load_int 0 + iconst 0 return LABEL84: - load_int 0 + iconst 0 return - load_int -1 + iconst -1 return diff --git a/cache/src/test/resources/net/runelite/cache/script/assembler/Unicode.rs2asm b/cache/src/test/resources/net/runelite/cache/script/assembler/Unicode.rs2asm index 7ca51cc723..a1fc0a62e1 100644 --- a/cache/src/test/resources/net/runelite/cache/script/assembler/Unicode.rs2asm +++ b/cache/src/test/resources/net/runelite/cache/script/assembler/Unicode.rs2asm @@ -3,5 +3,5 @@ .string_stack_count 0 .int_var_count 0 .string_var_count 0 - load_string ": " + sconst ": " return diff --git a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm index 741c551317..fd3f415b5d 100644 --- a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm +++ b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm @@ -3,68 +3,68 @@ .string_stack_count 0 .int_var_count 1 .string_var_count 2 - load_string "" + sconst "" sstore 0 - load_string "" + sconst "" sstore 1 invoke 514 - load_int 1 + iconst 1 if_icmpeq LABEL8 jump LABEL34 LABEL8: - 049 359 ; Skip truncating of varcstr 22 by not calling 280 - tolowercase ; instead get the var directly and lowercase it + get_varc_string 359 ; Skip truncating of varcstr 22 by not calling 280 + lowercase ; instead get the var directly and lowercase it sstore 1 sload 1 - string_length - load_int 0 + string_length + iconst 0 if_icmpgt LABEL15 jump LABEL34 LABEL15: iload 0 - load_int -1 + iconst -1 if_icmpne LABEL19 jump LABEL23 LABEL19: iload 0 - get_item_name - tolowercase + oc_name + lowercase sstore 0 -LABEL1337: ; check if the bank tags plugin is active - load_int 1 ; true - load_int 0 ; load active boolean - load_string "bankTagsActive" ; push event name - runelite_callback ; invoke callback +LABEL1337:; check if the bank tags plugin is active + iconst 1 ; true + iconst 0 ; load active boolean + sconst "bankTagsActive" ; push event name + runelite_callback ; invoke callback if_icmpeq LABEL1338 ; if the plugin is active then jump to the label that decides if the ; item should be shown jump LABEL23 ; if the plugin is not active then jump to the normal label -LABEL1338: ; let the bank tag plugin decide if the item should be shown - load_int 0 ; load return value +LABEL1338:; let the bank tag plugin decide if the item should be shown + iconst 0 ; load return value iload 0 ; load item id sload 0 ; load item name sload 1 ; load search string - load_string "bankSearchFilter" ; push event name - runelite_callback ; invoke callback - pop_int ; pop item id - pop_string ; pop search string - pop_string ; pop item name - return ; return value + sconst "bankSearchFilter" ; push event name + runelite_callback ; invoke callback + pop_int ; pop item id + pop_string ; pop search string + pop_string ; pop item name + return ; return value LABEL23: sload 0 sload 1 - load_int 0 - string_indexof_from - load_int -1 + iconst 0 + string_indexof_string + iconst -1 if_icmpne LABEL30 jump LABEL32 LABEL30: - load_int 1 - return + iconst 1 + return LABEL32: - load_int 0 - return + iconst 0 + return LABEL34: - load_int 1 - return - load_int -1 - return + iconst 1 + return + iconst -1 + return diff --git a/runelite-client/src/main/scripts/BankSearchLayout.rs2asm b/runelite-client/src/main/scripts/BankSearchLayout.rs2asm index bf50394dad..47dad19197 100644 --- a/runelite-client/src/main/scripts/BankSearchLayout.rs2asm +++ b/runelite-client/src/main/scripts/BankSearchLayout.rs2asm @@ -4,165 +4,165 @@ .int_var_count 31 .string_var_count 1 get_varbit 5102 - load_int 1 + iconst 1 if_icmpeq LABEL4 jump LABEL8 LABEL4: - load_int 0 + iconst 0 iload 10 - widget_put_hidden_widget + if_sethide jump LABEL13 LABEL8: - load_int 1 + iconst 1 iload 10 - widget_put_hidden_widget + if_sethide iload 12 invoke 41 LABEL13: get_varbit 5364 - load_int 1 + iconst 1 if_icmpeq LABEL17 jump LABEL24 LABEL17: - load_int 37 - load_int 37 - load_int 1 - load_int 0 + iconst 37 + iconst 37 + iconst 1 + iconst 0 iload 5 - widget_put_size_widget + if_setsize jump LABEL30 LABEL24: - load_int 0 - load_int 37 - load_int 1 - load_int 0 + iconst 0 + iconst 37 + iconst 1 + iconst 0 iload 5 - widget_put_size_widget + if_setsize LABEL30: - load_int 1 + iconst 1 iload 11 - widget_put_hidden_widget + if_sethide iload 11 - widget_unset_children - load_int 0 + cc_deleteall + iconst 0 istore 13 get_varbit 4170 - load_int 3 + iconst 3 if_icmpeq LABEL41 jump LABEL74 LABEL41: get_varbit 4171 - load_int 0 + iconst 0 if_icmpgt LABEL69 get_varbit 4172 - load_int 0 + iconst 0 if_icmpgt LABEL69 get_varbit 4173 - load_int 0 + iconst 0 if_icmpgt LABEL69 get_varbit 4174 - load_int 0 + iconst 0 if_icmpgt LABEL69 get_varbit 4175 - load_int 0 + iconst 0 if_icmpgt LABEL69 get_varbit 4176 - load_int 0 + iconst 0 if_icmpgt LABEL69 get_varbit 4177 - load_int 0 + iconst 0 if_icmpgt LABEL69 get_varbit 4178 - load_int 0 + iconst 0 if_icmpgt LABEL69 get_varbit 4179 - load_int 0 + iconst 0 if_icmpgt LABEL69 jump LABEL72 LABEL69: - load_int 0 + iconst 0 istore 13 jump LABEL74 LABEL72: - load_int 1 + iconst 1 istore 13 LABEL74: - load_int 0 + iconst 0 istore 14 iload 13 - load_int 1 + iconst 1 if_icmpeq LABEL80 jump LABEL110 LABEL80: - load_int 1 + iconst 1 iload 9 - widget_put_hidden_widget - load_int 11 + if_sethide + iconst 11 istore 14 - load_int 0 - load_int 26 - load_int 1 - load_int 1 + iconst 0 + iconst 26 + iconst 1 + iconst 1 iload 1 - widget_put_size_widget - load_int 460 - load_int 39 - load_int 0 - load_int 1 + if_setsize + iconst 460 + iconst 39 + iconst 0 + iconst 1 iload 3 - widget_put_size_widget - load_int 16 - load_int 39 - load_int 0 - load_int 1 + if_setsize + iconst 16 + iconst 39 + iconst 0 + iconst 1 iload 4 - widget_put_size_widget - load_int 30 - load_int 48 - load_int 2 - load_int 0 + if_setsize + iconst 30 + iconst 48 + iconst 2 + iconst 0 iload 2 - widget_put_position_widget + if_setposition jump LABEL137 LABEL110: - load_int 0 + iconst 0 iload 9 - widget_put_hidden_widget - load_int 0 - load_int 0 - load_int 1 - load_int 1 + if_sethide + iconst 0 + iconst 0 + iconst 1 + iconst 1 iload 1 - widget_put_size_widget - load_int 460 - load_int 81 - load_int 0 - load_int 1 + if_setsize + iconst 460 + iconst 81 + iconst 0 + iconst 1 iload 3 - widget_put_size_widget - load_int 16 - load_int 81 - load_int 0 - load_int 1 + if_setsize + iconst 16 + iconst 81 + iconst 0 + iconst 1 iload 4 - widget_put_size_widget - load_int 12 - load_int 42 - load_int 2 - load_int 0 + if_setsize + iconst 12 + iconst 42 + iconst 2 + iconst 0 iload 2 - widget_put_position_widget + if_setposition LABEL137: iload 4 iload 3 invoke 231 - load_int 816 + iconst 816 istore 15 - load_int 816 - load_int 9 - load_int 3 - imul - iadd + iconst 816 + iconst 9 + iconst 3 + multiply + add istore 16 LABEL148: iload 15 @@ -172,133 +172,133 @@ LABEL148: LABEL152: iload 3 iload 15 - widget_load_child - load_int 1 + cc_find + iconst 1 if_icmpeq LABEL158 jump LABEL160 LABEL158: - load_int 1 - widget_put_hidden + iconst 1 + cc_sethide LABEL160: iload 15 - load_int 1 - iadd + iconst 1 + add istore 15 jump LABEL148 LABEL165: - load_int 0 + iconst 0 istore 15 - load_int 8 - load_int 1 - isub + iconst 8 + iconst 1 + sub istore 17 iload 3 - widget_get_width_widget - load_int 51 - isub - load_int 35 - isub + if_getwidth + iconst 51 + sub + iconst 35 + sub istore 18 iload 18 - load_int 8 - load_int 36 - imul - isub + iconst 8 + iconst 36 + multiply + sub iload 17 - idiv + div istore 19 - load_int -1 + iconst -1 istore 20 - load_int 0 + iconst 0 istore 21 - load_int 0 + iconst 0 istore 22 - load_int 0 + iconst 0 istore 23 - load_int 0 + iconst 0 istore 24 - load_int -1 + iconst -1 istore 25 - load_int 0 + iconst 0 istore 26 - load_string "" + sconst "" sstore 0 get_varbit 4150 - load_int 0 + iconst 0 if_icmple LABEL209 get_varbit 4150 - load_int 9 + iconst 9 if_icmpgt LABEL209 jump LABEL658 LABEL209: iload 15 - load_int 816 + iconst 816 if_icmplt LABEL213 jump LABEL238 LABEL213: iload 3 iload 15 - widget_load_child - load_int 1 + cc_find + iconst 1 if_icmpeq LABEL219 jump LABEL221 LABEL219: - load_int 1 - widget_put_hidden + iconst 1 + cc_sethide LABEL221: - load_int 95 + iconst 95 iload 15 - get_itemcontainer_itemid - load_int -1 + inv_getobj + iconst -1 if_icmpne LABEL227 jump LABEL233 LABEL227: iload 24 - load_int 1 - iadd + iconst 1 + add iload 15 istore 25 istore 24 LABEL233: iload 15 - load_int 1 - iadd + iconst 1 + add istore 15 jump LABEL209 LABEL238: get_varbit 4171 get_varbit 4172 - iadd + add get_varbit 4173 - iadd + add get_varbit 4174 - iadd + add get_varbit 4175 - iadd + add get_varbit 4176 - iadd + add get_varbit 4177 - iadd + add get_varbit 4178 - iadd + add get_varbit 4179 - iadd + add istore 26 iload 26 - load_int 0 + iconst 0 if_icmple LABEL260 jump LABEL264 LABEL260: - load_int 816 - load_int 1 - isub + iconst 816 + iconst 1 + sub istore 25 LABEL264: iload 26 iload 25 - load_int 1 - iadd - load_int 0 + iconst 1 + add + iconst 0 iload 3 iload 4 iload 10 @@ -313,16 +313,16 @@ LABEL264: istore 23 iload 22 iload 21 - iadd + add istore 22 - load_int 0 + iconst 0 istore 15 get_varbit 4171 - load_int 0 + iconst 0 if_icmpgt LABEL291 jump LABEL321 LABEL291: - load_int 1 + iconst 1 iload 3 iload 23 invoke 510 @@ -330,8 +330,8 @@ LABEL291: iload 15 iload 15 get_varbit 4171 - iadd - load_int 1 + add + iconst 1 iload 3 iload 4 iload 10 @@ -346,19 +346,19 @@ LABEL291: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4171 - iadd + add istore 15 LABEL321: get_varbit 4172 - load_int 0 + iconst 0 if_icmpgt LABEL325 jump LABEL355 LABEL325: - load_int 2 + iconst 2 iload 3 iload 23 invoke 510 @@ -366,8 +366,8 @@ LABEL325: iload 15 iload 15 get_varbit 4172 - iadd - load_int 2 + add + iconst 2 iload 3 iload 4 iload 10 @@ -382,19 +382,19 @@ LABEL325: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4172 - iadd + add istore 15 LABEL355: get_varbit 4173 - load_int 0 + iconst 0 if_icmpgt LABEL359 jump LABEL389 LABEL359: - load_int 3 + iconst 3 iload 3 iload 23 invoke 510 @@ -402,8 +402,8 @@ LABEL359: iload 15 iload 15 get_varbit 4173 - iadd - load_int 3 + add + iconst 3 iload 3 iload 4 iload 10 @@ -418,19 +418,19 @@ LABEL359: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4173 - iadd + add istore 15 LABEL389: get_varbit 4174 - load_int 0 + iconst 0 if_icmpgt LABEL393 jump LABEL423 LABEL393: - load_int 4 + iconst 4 iload 3 iload 23 invoke 510 @@ -438,8 +438,8 @@ LABEL393: iload 15 iload 15 get_varbit 4174 - iadd - load_int 4 + add + iconst 4 iload 3 iload 4 iload 10 @@ -454,19 +454,19 @@ LABEL393: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4174 - iadd + add istore 15 LABEL423: get_varbit 4175 - load_int 0 + iconst 0 if_icmpgt LABEL427 jump LABEL457 LABEL427: - load_int 5 + iconst 5 iload 3 iload 23 invoke 510 @@ -474,8 +474,8 @@ LABEL427: iload 15 iload 15 get_varbit 4175 - iadd - load_int 5 + add + iconst 5 iload 3 iload 4 iload 10 @@ -490,19 +490,19 @@ LABEL427: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4175 - iadd + add istore 15 LABEL457: get_varbit 4176 - load_int 0 + iconst 0 if_icmpgt LABEL461 jump LABEL491 LABEL461: - load_int 6 + iconst 6 iload 3 iload 23 invoke 510 @@ -510,8 +510,8 @@ LABEL461: iload 15 iload 15 get_varbit 4176 - iadd - load_int 6 + add + iconst 6 iload 3 iload 4 iload 10 @@ -526,19 +526,19 @@ LABEL461: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4176 - iadd + add istore 15 LABEL491: get_varbit 4177 - load_int 0 + iconst 0 if_icmpgt LABEL495 jump LABEL525 LABEL495: - load_int 7 + iconst 7 iload 3 iload 23 invoke 510 @@ -546,8 +546,8 @@ LABEL495: iload 15 iload 15 get_varbit 4177 - iadd - load_int 7 + add + iconst 7 iload 3 iload 4 iload 10 @@ -562,19 +562,19 @@ LABEL495: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4177 - iadd + add istore 15 LABEL525: get_varbit 4178 - load_int 0 + iconst 0 if_icmpgt LABEL529 jump LABEL559 LABEL529: - load_int 8 + iconst 8 iload 3 iload 23 invoke 510 @@ -582,8 +582,8 @@ LABEL529: iload 15 iload 15 get_varbit 4178 - iadd - load_int 8 + add + iconst 8 iload 3 iload 4 iload 10 @@ -598,19 +598,19 @@ LABEL529: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4178 - iadd + add istore 15 LABEL559: get_varbit 4179 - load_int 0 + iconst 0 if_icmpgt LABEL563 jump LABEL593 LABEL563: - load_int 9 + iconst 9 iload 3 iload 23 invoke 510 @@ -618,8 +618,8 @@ LABEL563: iload 15 iload 15 get_varbit 4179 - iadd - load_int 9 + add + iconst 9 iload 3 iload 4 iload 10 @@ -634,78 +634,78 @@ LABEL563: istore 23 iload 22 iload 21 - iadd + add istore 22 iload 15 get_varbit 4179 - iadd + add istore 15 LABEL593: invoke 514 - load_int 1 + iconst 1 if_icmpeq LABEL597 jump LABEL638 LABEL597: - 049 359 ; Skip truncating of varcstr 22 by not calling 280 - tolowercase ; instead get the var directly and lowercase it + get_varc_string 359 ; Skip truncating of varcstr 22 by not calling 280 + lowercase ; instead get the var directly and lowercase it sstore 0 sload 0 string_length - load_int 0 + iconst 0 if_icmpgt LABEL604 jump LABEL623 LABEL604: - load_string "Showing items: " - load_string "" + sconst "Showing items: " + sconst "" sload 0 - load_string "" - string_append 4 + sconst "" + join_string 4 iload 6 - widget_put_text_widget - get_varc 5 - load_int 11 + if_settext + get_varc_int 5 + iconst 11 if_icmpeq LABEL615 jump LABEL622 LABEL615: - load_string "Show items whose names contain the following text: (" + sconst "Show items whose names contain the following text: (" iload 22 - int_to_string - load_string " found)" - string_append 3 + tostring + sconst " found)" + join_string 3 iload 21 ; load number of matches - load_string "setSearchBankInputTextFound" ; load event name + sconst "setSearchBankInputTextFound" ; load event name runelite_callback ; invoke callback pop_int ; pop number of matches - load_int 10616876 - widget_put_text_widget + iconst 10616876 + if_settext LABEL622: jump LABEL637 LABEL623: - load_string "Showing items: " - load_string "" - load_string "*" - load_string "" - string_append 4 + sconst "Showing items: " + sconst "" + sconst "*" + sconst "" + join_string 4 iload 6 - widget_put_text_widget - get_varc 5 - load_int 11 + if_settext + get_varc_int 5 + iconst 11 if_icmpeq LABEL634 jump LABEL637 LABEL634: - load_string "Show items whose names contain the following text:" - load_string "setSearchBankInputText" ; load event name + sconst "Show items whose names contain the following text:" + sconst "setSearchBankInputText" ; load event name runelite_callback ; invoke callback - load_int 10616876 - widget_put_text_widget + iconst 10616876 + if_settext LABEL637: jump LABEL641 LABEL638: - load_string "The Bank of Gielinor" - load_string "setBankTitle" ; - runelite_callback ; + sconst "The Bank of Gielinor" + sconst "setBankTitle" ; + runelite_callback ; iload 6 - widget_put_text_widget + if_settext LABEL641: iload 0 iload 1 @@ -726,51 +726,51 @@ LABEL641: return LABEL658: invoke 514 - load_int 1 + iconst 1 if_icmpeq LABEL662 jump LABEL665 LABEL662: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 LABEL665: - load_int -1 + iconst -1 istore 27 - load_int -1 + iconst -1 istore 28 get_varbit 4150 invoke 513 istore 28 istore 27 - load_int 0 + iconst 0 istore 29 - load_int 0 + iconst 0 istore 30 LABEL677: iload 15 - load_int 816 + iconst 816 if_icmplt LABEL681 jump LABEL761 LABEL681: iload 3 iload 15 - widget_load_child - load_int 1 + cc_find + iconst 1 if_icmpeq LABEL687 jump LABEL756 LABEL687: - load_int 95 + iconst 95 iload 15 - get_itemcontainer_itemid + inv_getobj istore 20 iload 20 - load_int -1 + iconst -1 if_icmpne LABEL695 jump LABEL699 LABEL695: iload 24 - load_int 1 - iadd + iconst 1 + add istore 24 LABEL699: iload 15 @@ -783,12 +783,12 @@ LABEL703: if_icmplt LABEL707 jump LABEL754 LABEL707: - load_int 0 - widget_put_hidden + iconst 0 + cc_sethide iload 20 - load_int 95 + iconst 95 iload 15 - get_itemcontainer_stacksize + inv_getnum iload 3 iload 4 iload 10 @@ -796,23 +796,23 @@ LABEL707: iload 12 invoke 278 iload 30 - load_int 36 - imul + iconst 36 + multiply istore 23 - load_int 51 + iconst 51 iload 29 - load_int 36 + iconst 36 iload 19 - iadd - imul - iadd + add + multiply + add iload 23 - load_int 0 - load_int 0 - widget_put_position + iconst 0 + iconst 0 + cc_setposition iload 23 - load_int 32 - iadd + iconst 32 + add istore 23 iload 29 iload 17 @@ -820,55 +820,55 @@ LABEL707: jump LABEL747 LABEL742: iload 29 - load_int 1 - iadd + iconst 1 + add istore 29 jump LABEL753 LABEL747: - load_int 0 + iconst 0 iload 30 - load_int 1 - iadd + iconst 1 + add istore 30 istore 29 LABEL753: jump LABEL756 LABEL754: - load_int 1 - widget_put_hidden + iconst 1 + cc_sethide LABEL756: iload 15 - load_int 1 - iadd + iconst 1 + add istore 15 jump LABEL677 LABEL761: get_varbit 4170 - load_int 2 + iconst 2 if_icmpeq LABEL765 jump LABEL775 LABEL765: - load_string "Tab " - load_int 105 - load_int 115 - load_int 207 + sconst "Tab " + iconst 105 + iconst 115 + iconst 207 get_varbit 4150 - get_enum_value - string_append 2 - load_string "setBankTitle" ; - runelite_callback ; + enum + join_string 2 + sconst "setBankTitle" ; + runelite_callback ; iload 6 - widget_put_text_widget + if_settext jump LABEL781 LABEL775: - load_string "Tab " + sconst "Tab " get_varbit 4150 - int_to_string - string_append 2 - load_string "setBankTitle" ; - runelite_callback ; + tostring + join_string 2 + sconst "setBankTitle" ; + runelite_callback ; iload 6 - widget_put_text_widget + if_settext LABEL781: iload 0 iload 1 diff --git a/runelite-client/src/main/scripts/ChatBuilder.rs2asm b/runelite-client/src/main/scripts/ChatBuilder.rs2asm index 2e0b41bec1..ccc78a7195 100644 --- a/runelite-client/src/main/scripts/ChatBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatBuilder.rs2asm @@ -3,175 +3,175 @@ .string_stack_count 0 .int_var_count 15 .string_var_count 13 - load_int 10616890 - widget_get_width_widget + iconst 10616890 + if_getwidth istore 1 - get_localplayer_name - string_remove_html + chat_playername + removetags sstore 0 - load_int 0 + iconst 0 istore 2 - get_varc 41 - load_int 3 + get_varc_int 41 + iconst 3 if_icmpeq LABEL12 jump LABEL14 LABEL12: - load_int 1 + iconst 1 istore 2 LABEL14: - load_int 0 + iconst 0 istore 3 - load_int 0 + iconst 0 istore 4 - load_string "" + sconst "" sstore 1 - load_string "" + sconst "" sstore 2 - load_string "" + sconst "" sstore 3 - load_string "" + sconst "" sstore 4 - load_string "" + sconst "" sstore 5 - load_string "" + sconst "" sstore 6 - load_string "" + sconst "" sstore 7 - load_string "" + sconst "" sstore 8 invoke 921 - load_int 1 + iconst 1 if_icmpeq LABEL38 jump LABEL58 LABEL38: - load_int 16777215 - load_int 1 + iconst 16777215 + iconst 1 istore 4 istore 3 - load_string "" - load_string "" - load_string "" - load_string "" + sconst "" + sconst "" + sconst "" + sconst "" sstore 4 sstore 3 sstore 2 sstore 1 - load_string "" - load_string "" - load_string "" - load_string "" + sconst "" + sconst "" + sconst "" + sconst "" sstore 8 sstore 7 sstore 6 sstore 5 LABEL58: - load_int 0 + iconst 0 istore 5 - load_int 0 + iconst 0 istore 6 - load_int 0 + iconst 0 istore 7 - load_int 105 - load_int 73 - load_int 579 + iconst 105 + iconst 73 + iconst 579 iload 7 - get_enum_value + enum istore 8 - get_varc 41 - load_int 0 + get_varc_int 41 + iconst 0 if_icmpeq LABEL77 - get_varc 41 - load_int 2 + get_varc_int 41 + iconst 2 if_icmpeq LABEL77 jump LABEL133 LABEL77: - 5022 + chat_getmessagefilter string_length - load_int 0 + iconst 0 if_icmpgt LABEL82 jump LABEL133 LABEL82: sload 1 - load_string "Public chat filtering:" - load_string "" - load_string " " - load_string "" - 5022 - appendtags - tolowercase - load_string "" - string_append 7 + sconst "Public chat filtering:" + sconst "" + sconst " " + sconst "" + chat_getmessagefilter + escape + lowercase + sconst "" + join_string 7 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 199 istore 6 iload 8 - widget_put_actions_null_widget - load_int -1 - load_string "" + if_clearops + iconst -1 + sconst "" iload 8 - widget_put_option_click_listener_widget - load_int -1 - load_string "" + if_setonop + iconst -1 + sconst "" iload 8 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 8 - widget_put_mouse_exit_listener_widget + if_setonmouseleave iload 5 iload 6 - isub + sub istore 5 iload 7 - load_int 1 - iadd + iconst 1 + add istore 7 - load_int 105 - load_int 73 - load_int 579 + iconst 105 + iconst 73 + iconst 579 iload 7 - get_enum_value + enum istore 8 LABEL133: iload 0 istore 9 - load_int 0 + iconst 0 istore 10 - load_int -1 + iconst -1 istore 11 - load_string "" + sconst "" sstore 9 - load_string "" + sconst "" sstore 10 - load_string "" + sconst "" sstore 11 - load_string "" + sconst "" sstore 12 - load_int 0 + iconst 0 istore 12 LABEL149: iload 9 - load_int -1 + iconst -1 if_icmpne LABEL153 jump LABEL645 LABEL153: iload 8 - load_int -1 + iconst -1 if_icmpne LABEL157 jump LABEL645 LABEL157: iload 9 - get_chat_message + chat_gethistory_byuid istore 12 sstore 11 sstore 10 @@ -182,7 +182,7 @@ LABEL157: sload 9 iload 12 invoke 193 - load_int 1 + iconst 1 if_icmpeq LABEL172 jump LABEL641 LABEL172: @@ -194,7 +194,7 @@ LABEL172: sload 0 iload 12 invoke 90 - load_int 1 + iconst 1 if_icmpeq LABEL183 jump LABEL641 LABEL183: @@ -217,26 +217,26 @@ LABEL183: jump LABEL426 LABEL186: iload 9 ; The id of the messageNode of the message being built - load_string "" - load_string "addTimestamp" - runelite_callback - pop_int + sconst "" + sconst "addTimestamp" + runelite_callback + pop_int sload 9 - load_string ":" - string_append 3 ; We need to append an extra string since we added the timestamp + sconst ":" + join_string 3 ; We need to append an extra string since we added the timestamp sload 1 sload 11 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 203 @@ -244,26 +244,26 @@ LABEL186: jump LABEL440 LABEL207: iload 9 ; The id of the messageNode of the message being built - load_string "" - load_string "addTimestamp" - runelite_callback - pop_int + sconst "" + sconst "addTimestamp" + runelite_callback + pop_int sload 9 - load_string ":" - string_append 3 ; We need to append an extra string since we added the timestamp + sconst ":" + join_string 3 ; We need to append an extra string since we added the timestamp sload 3 sload 11 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 203 @@ -271,29 +271,29 @@ LABEL207: jump LABEL440 LABEL228: iload 9 ; The id of the messageNode of the message being built - load_string "" - load_string "addTimestamp" - runelite_callback - pop_int - load_string "From " + sconst "" + sconst "addTimestamp" + runelite_callback + pop_int + sconst "From " sload 9 - load_string ":" - load_string "privateChatFrom" - runelite_callback - string_append 4 ; We need to append an extra string since we added the timestamp + sconst ":" + sconst "privateChatFrom" + runelite_callback + join_string 4 ; We need to append an extra string since we added the timestamp sload 2 sload 11 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 203 @@ -301,23 +301,23 @@ LABEL228: jump LABEL440 LABEL250: iload 9 ; The id of the messageNode of the message being built - load_string "" - load_string "addTimestamp" - runelite_callback - pop_int + sconst "" + sconst "addTimestamp" + runelite_callback + pop_int sload 7 sload 11 - load_string "" - string_append 4 ; We need to append an extra string since we added the timestamp + sconst "" + join_string 4 ; We need to append an extra string since we added the timestamp iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 199 @@ -325,70 +325,70 @@ LABEL250: jump LABEL440 LABEL268: iload 9 ; The id of the messageNode of the message being built - load_string "" - load_string "addTimestamp" - runelite_callback - pop_int + sconst "" + sconst "addTimestamp" + runelite_callback + pop_int sload 2 sload 11 - load_string "" - string_append 4 ; We need to append an extra string since we added the timestamp + sconst "" + join_string 4 ; We need to append an extra string since we added the timestamp iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 199 istore 6 get_varbit 1627 - load_int 0 + iconst 0 if_icmpeq LABEL289 jump LABEL300 LABEL289: iload 11 - load_int 500 - iadd - load_int 1 - iadd - put_varc 65 - load_int 664 - load_int 0 - load_string "1" - load_int 10616832 - widget_put_render_listener_widget + iconst 500 + add + iconst 1 + add + set_varc_int 65 + iconst 664 + iconst 0 + sconst "1" + iconst 10616832 + if_setontimer LABEL300: jump LABEL440 LABEL301: iload 9 ; The id of the messageNode of the message being built - load_string "" - load_string "addTimestamp" - runelite_callback - pop_int - load_string "To " + sconst "" + sconst "addTimestamp" + runelite_callback + pop_int + sconst "To " sload 9 - load_string ":" - load_string "privateChatTo" - runelite_callback - string_append 4 ; We need to append an extra string since we added the timestamp + sconst ":" + sconst "privateChatTo" + runelite_callback + join_string 4 ; We need to append an extra string since we added the timestamp sload 2 sload 11 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 203 @@ -396,23 +396,23 @@ LABEL301: jump LABEL440 LABEL323: iload 9 ; The id of the messageNode of the message being built - load_string "" - load_string "addTimestamp" - runelite_callback - pop_int + sconst "" + sconst "addTimestamp" + runelite_callback + pop_int sload 8 sload 11 - load_string "" - string_append 4 ; We need to append an extra string since we added the timestamp + sconst "" + join_string 4 ; We need to append an extra string since we added the timestamp iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 199 @@ -420,31 +420,31 @@ LABEL323: jump LABEL440 LABEL341: iload 9 ; The id of the messageNode of the message being built - load_string "" - load_string "addTimestamp" - runelite_callback - pop_int - load_string "[" + sconst "" + sconst "addTimestamp" + runelite_callback + pop_int + sconst "[" sload 5 sload 10 - load_string "" - load_string "] " + sconst "" + sconst "] " sload 9 - load_string ":" - string_append 8 ; We need to append an extra string since we added the timestamp + sconst ":" + join_string 8 ; We need to append an extra string since we added the timestamp sload 6 sload 11 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 203 @@ -456,42 +456,42 @@ LABEL367: sstore 12 sstore 11 sload 4 - load_string "Broadcast:" - load_string "" - string_append 3 + sconst "Broadcast:" + sconst "" + join_string 3 sload 11 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 203 istore 6 jump LABEL440 LABEL390: - get_gamecycle + clientclock iload 11 - isub - load_int 500 + sub + iconst 500 if_icmpgt LABEL396 jump LABEL411 LABEL396: - load_string "jk :P" + sconst "jk :P" iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 199 @@ -501,13 +501,13 @@ LABEL411: sload 11 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 199 @@ -518,20 +518,20 @@ LABEL426: sload 11 iload 7 iload 8 - load_int 10616890 + iconst 10616890 iload 1 - load_int 3 - load_int 14 + iconst 3 + iconst 14 iload 5 - load_int 0 - load_int 103 + iconst 0 + iconst 103 iload 3 iload 4 invoke 199 istore 6 LABEL440: iload 8 - widget_put_actions_null_widget + if_clearops iload 10 switch 1: LABEL445 @@ -549,221 +549,221 @@ LABEL440: 91: LABEL445 jump LABEL615 LABEL445: - load_string "" + sconst "" sload 9 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 8 - widget_put_name_widget - load_int 86 - load_int -2147483644 - load_string "event_opbase" - load_string "is" + if_setopbase + iconst 86 + iconst -2147483644 + sconst "event_opbase" + sconst "is" iload 8 - widget_put_option_click_listener_widget - load_int -1 - load_string "" + if_setonop + iconst -1 + sconst "" iload 8 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 8 - widget_put_mouse_exit_listener_widget + if_setonmouseleave sload 0 sload 9 - string_remove_html - string_compare - load_int 0 + removetags + compare + iconst 0 if_icmpne LABEL472 jump LABEL509 LABEL472: iload 12 - load_int 1 + iconst 1 if_icmpeq LABEL476 jump LABEL481 LABEL476: - load_int 6 - load_string "Message" + iconst 6 + sconst "Message" iload 8 - widget_put_action_widget + if_setop jump LABEL489 LABEL481: - load_int 6 - load_string "Add friend" + iconst 6 + sconst "Add friend" iload 8 - widget_put_action_widget - load_int 7 - load_string "Add ignore" + if_setop + iconst 7 + sconst "Add ignore" iload 8 - widget_put_action_widget + if_setop LABEL489: - load_int 8 - load_string "Report" + iconst 8 + sconst "Report" iload 8 - widget_put_action_widget + if_setop iload 10 - load_int 9 + iconst 9 if_icmpeq LABEL497 jump LABEL509 LABEL497: - get_clanchatcount - load_int 0 + clan_getchatcount + iconst 0 if_icmpgt LABEL501 jump LABEL509 LABEL501: - get_clanchat_rank - clanchat_kick_rank + clan_getchatrank + clan_getchatminkick if_icmpge LABEL505 jump LABEL509 LABEL505: - load_int 9 - load_string "Kick" + iconst 9 + sconst "Kick" iload 8 - widget_put_action_widget + if_setop LABEL509: jump LABEL627 LABEL510: - load_string "" + sconst "" sload 9 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 8 - widget_put_name_widget - load_int 86 - load_int -2147483644 - load_string "event_opbase" - load_string "is" + if_setopbase + iconst 86 + iconst -2147483644 + sconst "event_opbase" + sconst "is" iload 8 - widget_put_option_click_listener_widget - load_int -1 - load_string "" + if_setonop + iconst -1 + sconst "" iload 8 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 8 - widget_put_mouse_exit_listener_widget - load_int 1 - load_string "Accept trade" + if_setonmouseleave + iconst 1 + sconst "Accept trade" iload 8 - widget_put_action_widget + if_setop jump LABEL627 LABEL535: - load_string "" + sconst "" sload 9 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 8 - widget_put_name_widget - load_int 86 - load_int -2147483644 - load_string "event_opbase" - load_string "is" + if_setopbase + iconst 86 + iconst -2147483644 + sconst "event_opbase" + sconst "is" iload 8 - widget_put_option_click_listener_widget - load_int -1 - load_string "" + if_setonop + iconst -1 + sconst "" iload 8 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 8 - widget_put_mouse_exit_listener_widget - load_int 2 - load_string "Accept challenge" + if_setonmouseleave + iconst 2 + sconst "Accept challenge" iload 8 - widget_put_action_widget + if_setop jump LABEL627 LABEL560: sload 12 string_length - load_int 0 + iconst 0 if_icmpgt LABEL565 jump LABEL590 LABEL565: - load_int 6 - load_string "Open" + iconst 6 + sconst "Open" iload 8 - widget_put_action_widget - load_int 7 - load_string "Check" + if_setop + iconst 7 + sconst "Check" iload 8 - widget_put_action_widget - load_int 2065 + if_setop + iconst 2065 iload 8 - widget_get_parentid_widget + if_getlayer iload 7 - load_int 3158271 - load_string "Iii" + iconst 3158271 + sconst "Iii" iload 8 - widget_put_mouse_hover_listener_widget - load_int 2065 + if_setonmouserepeat + iconst 2065 iload 8 - widget_get_parentid_widget + if_getlayer iload 7 iload 3 - load_string "Iii" + sconst "Iii" iload 8 - widget_put_mouse_exit_listener_widget + if_setonmouseleave jump LABEL598 LABEL590: - load_int -1 - load_string "" + iconst -1 + sconst "" iload 8 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 8 - widget_put_mouse_exit_listener_widget + if_setonmouseleave LABEL598: - load_int 9 - load_string "Clear history" + iconst 9 + sconst "Clear history" iload 8 - widget_put_action_widget - load_string "" - load_string "Notification" - load_string "" - string_append 3 + if_setop + sconst "" + sconst "Notification" + sconst "" + join_string 3 iload 8 - widget_put_name_widget - load_int 2064 - load_int -2147483644 + if_setopbase + iconst 2064 + iconst -2147483644 sload 12 - load_string "is" + sconst "is" iload 8 - widget_put_option_click_listener_widget + if_setonop jump LABEL627 LABEL615: - load_int -1 - load_string "" + iconst -1 + sconst "" iload 8 - widget_put_option_click_listener_widget - load_int -1 - load_string "" + if_setonop + iconst -1 + sconst "" iload 8 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 8 - widget_put_mouse_exit_listener_widget + if_setonmouseleave LABEL627: iload 5 iload 6 - isub + sub istore 5 iload 7 - load_int 1 - iadd + iconst 1 + add istore 7 - load_int 105 - load_int 73 - load_int 579 + iconst 105 + iconst 73 + iconst 579 iload 7 - get_enum_value + enum istore 8 LABEL641: iload 9 - get_messagenode_next_id + chat_getprevuid istore 9 jump LABEL149 LABEL645: @@ -771,82 +771,82 @@ LABEL645: istore 13 LABEL647: iload 8 - load_int -1 + iconst -1 if_icmpne LABEL651 jump LABEL708 LABEL651: iload 8 - widget_put_actions_null_widget - load_int -1 - load_string "" + if_clearops + iconst -1 + sconst "" iload 8 - widget_put_option_click_listener_widget - load_int -1 - load_string "" + if_setonop + iconst -1 + sconst "" iload 8 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 8 - widget_put_mouse_exit_listener_widget - load_int 0 - load_int 0 - load_int 0 - load_int 0 + if_setonmouseleave + iconst 0 + iconst 0 + iconst 0 + iconst 0 iload 8 - widget_put_size_widget - load_int 10616890 + if_setsize + iconst 10616890 iload 7 - load_int 2 - imul - widget_load_child - load_int 1 + iconst 2 + multiply + cc_find + iconst 1 if_icmpeq LABEL679 jump LABEL683 LABEL679: - load_string "" - widget_put_text - load_int 1 - widget_put_hidden + sconst "" + cc_settext + iconst 1 + cc_sethide LABEL683: - load_int 10616890 + iconst 10616890 iload 7 - load_int 2 - imul - load_int 1 - iadd - widget_load_child - load_int 1 + iconst 2 + multiply + iconst 1 + add + cc_find + iconst 1 if_icmpeq LABEL693 jump LABEL697 LABEL693: - load_string "" - widget_put_text - load_int 1 - widget_put_hidden + sconst "" + cc_settext + iconst 1 + cc_sethide LABEL697: iload 7 - load_int 1 - iadd + iconst 1 + add istore 7 - load_int 105 - load_int 73 - load_int 579 + iconst 105 + iconst 73 + iconst 579 iload 7 - get_enum_value + enum istore 8 jump LABEL647 LABEL708: iload 5 - load_int 2 - isub + iconst 2 + sub istore 5 - load_int 0 + iconst 0 iload 5 - isub + sub istore 5 - load_int 10616890 - widget_get_height_widget + iconst 10616890 + if_getheight istore 14 iload 5 iload 14 @@ -860,83 +860,83 @@ LABEL725: istore 7 LABEL727: iload 7 - load_int 0 + iconst 0 if_icmpgt LABEL731 jump LABEL784 LABEL731: iload 7 - load_int 1 - isub + iconst 1 + sub istore 7 - load_int 105 - load_int 73 - load_int 579 + iconst 105 + iconst 73 + iconst 579 iload 7 - get_enum_value + enum istore 8 iload 8 - widget_get_relativey_widget + if_gety iload 14 - iadd - load_int 2 - isub + add + iconst 2 + sub istore 5 iload 8 - widget_get_relativex_widget + if_getx iload 5 - load_int 0 - load_int 0 + iconst 0 + iconst 0 iload 8 - widget_put_position_widget - load_int 10616890 + if_setposition + iconst 10616890 iload 7 - load_int 2 - imul - widget_load_child - load_int 1 + iconst 2 + multiply + cc_find + iconst 1 if_icmpeq LABEL763 jump LABEL768 LABEL763: - widget_get_relativex + cc_getx iload 5 - load_int 0 - load_int 0 - widget_put_position + iconst 0 + iconst 0 + cc_setposition LABEL768: - load_int 10616890 + iconst 10616890 iload 7 - load_int 2 - imul - load_int 1 - iadd - widget_load_child - load_int 1 + iconst 2 + multiply + iconst 1 + add + cc_find + iconst 1 if_icmpeq LABEL778 jump LABEL783 LABEL778: - widget_get_relativex + cc_getx iload 5 - load_int 0 - load_int 0 - widget_put_position + iconst 0 + iconst 0 + cc_setposition LABEL783: jump LABEL727 LABEL784: - load_int 0 + iconst 0 iload 14 - load_int 10616890 - widget_put_scrollwidthheight_widget - load_int 10617391 - load_int 10616890 - get_varc 7 + iconst 10616890 + if_setscrollsize + iconst 10617391 + iconst 10616890 + get_varc_int 7 iload 14 - get_varc 8 - isub - iadd + get_varc_int 8 + sub + add invoke 72 - load_int 10616890 - widget_get_scrolly_widget + iconst 10616890 + if_getscrolly iload 14 - put_varc 8 - put_varc 7 + set_varc_int 8 + set_varc_int 7 return diff --git a/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm b/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm index 39fa1e7b3c..8c48e849dd 100644 --- a/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm @@ -3,207 +3,207 @@ .string_stack_count 0 .int_var_count 16 .string_var_count 4 - load_int 0 + iconst 0 istore 1 - load_int 2 + iconst 2 istore 2 - load_int 103 + iconst 103 istore 3 - load_int 4 + iconst 4 istore 4 - load_int 23 + iconst 23 istore 5 invoke 900 istore 6 - load_int 103 - load_int 105 - load_int 1136 + iconst 103 + iconst 105 + iconst 1136 iload 6 - get_enum_value - load_int 0 + enum + iconst 0 if_icmpgt LABEL20 jump LABEL58 LABEL20: iload 6 - load_int 1745 + iconst 1745 if_icmpeq LABEL24 jump LABEL36 LABEL24: - load_int 0 - load_int 102 - load_int 103 - load_int 105 - load_int 1960 + iconst 0 + iconst 102 + iconst 103 + iconst 105 + iconst 1960 iload 6 - get_enum_value - load_int 30 + enum + iconst 30 istore 5 istore 1 istore 3 istore 2 LABEL36: - get_varc 41 - load_int -1 + get_varc_int 41 + iconst -1 if_icmpeq LABEL40 jump LABEL49 LABEL40: invoke 922 - load_int 1 + iconst 1 if_icmpeq LABEL44 jump LABEL49 LABEL44: iload 4 iload 5 - iadd + add istore 4 jump LABEL58 LABEL49: iload 4 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 6 - load_int 10551325 - get_enum_value - widget_get_height_widget - iadd + iconst 10551325 + enum + if_getheight + add istore 4 LABEL58: iload 4 istore 7 - load_int 10682368 - widget_get_width_widget + iconst 10682368 + if_getwidth istore 8 - load_int 0 + iconst 0 istore 9 - load_int 105 - load_int 73 - load_int 580 + iconst 105 + iconst 73 + iconst 580 iload 9 - get_enum_value + enum istore 10 - load_int 0 + iconst 0 istore 11 - load_string "" + sconst "" sstore 0 - get_system_update_timer - load_int 0 + reboottimer + iconst 0 if_icmpgt LABEL79 jump LABEL156 LABEL79: - get_system_update_timer - load_int 50 - idiv - load_int 60 - modulo + reboottimer + iconst 50 + div + iconst 60 + mod istore 11 iload 11 - load_int 10 + iconst 10 if_icmplt LABEL89 jump LABEL100 LABEL89: - load_string "System update in: " - get_system_update_timer - load_int 3000 - idiv - int_to_string - load_string ":0" + sconst "System update in: " + reboottimer + iconst 3000 + div + tostring + sconst ":0" iload 11 - int_to_string - string_append 4 + tostring + join_string 4 sstore 0 jump LABEL110 LABEL100: - load_string "System update in: " - get_system_update_timer - load_int 3000 - idiv - int_to_string - load_string ":" + sconst "System update in: " + reboottimer + iconst 3000 + div + tostring + sconst ":" iload 11 - int_to_string - string_append 4 + tostring + join_string 4 sstore 0 LABEL110: iload 7 sload 0 iload 9 iload 10 - load_int 10682368 + iconst 10682368 iload 8 iload 1 - load_int 13 + iconst 13 iload 7 iload 2 iload 3 - load_int 16776960 - load_int 1 + iconst 16776960 + iconst 1 invoke 199 - iadd + add istore 7 iload 10 - widget_put_actions_null_widget - load_int -1 - load_string "" + if_clearops + iconst -1 + sconst "" iload 10 - widget_put_option_click_listener_widget - load_int -1 - load_string "" + if_setonop + iconst -1 + sconst "" iload 10 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 10 - widget_put_mouse_exit_listener_widget - load_int 0 - load_int 0 - load_int 0 - load_int 0 + if_setonmouseleave + iconst 0 + iconst 0 + iconst 0 + iconst 0 iload 10 - widget_put_size_widget + if_setsize iload 9 - load_int 1 - iadd + iconst 1 + add istore 9 - load_int 105 - load_int 73 - load_int 580 + iconst 105 + iconst 73 + iconst 580 iload 9 - get_enum_value + enum istore 10 LABEL156: - load_int -1 + iconst -1 istore 12 - load_int -1 + iconst -1 istore 13 - load_string "" + sconst "" sstore 1 - load_int 0 + iconst 0 istore 14 - load_string "" + sconst "" sstore 2 - load_string "" + sconst "" sstore 3 - get_varc 55 - get_varc 202 + get_varc_int 55 + get_varc_int 202 if_icmpge LABEL172 jump LABEL282 LABEL172: - get_varc 55 - get_gamecycle - load_int 3000 - isub + get_varc_int 55 + clientclock + iconst 3000 + sub if_icmpgt LABEL178 jump LABEL282 LABEL178: - load_int 14 - get_chatlinebuffer_length - load_int 0 + iconst 14 + chat_gethistorylength + iconst 0 if_icmpgt LABEL183 jump LABEL282 LABEL183: - load_int 14 - load_int 0 - get_chat_message_type + iconst 14 + iconst 0 + chat_gethistory_bytypeandline istore 14 sstore 0 sstore 2 @@ -211,7 +211,7 @@ LABEL183: istore 13 istore 12 iload 12 - load_int -1 + iconst -1 if_icmpne LABEL196 jump LABEL282 LABEL196: @@ -223,124 +223,124 @@ LABEL196: sload 0 iload 9 iload 10 - load_int 10682368 + iconst 10682368 iload 8 iload 1 - load_int 13 + iconst 13 iload 7 iload 2 iload 3 - load_int 16776960 - load_int 1 + iconst 16776960 + iconst 1 invoke 199 - iadd + add istore 7 iload 10 - widget_put_actions_null_widget + if_clearops sload 3 string_length - load_int 0 + iconst 0 if_icmpgt LABEL223 jump LABEL248 LABEL223: - load_int 6 - load_string "Open" + iconst 6 + sconst "Open" iload 10 - widget_put_action_widget - load_int 7 - load_string "Check" + if_setop + iconst 7 + sconst "Check" iload 10 - widget_put_action_widget - load_int 2065 + if_setop + iconst 2065 iload 10 - widget_get_parentid_widget + if_getlayer iload 9 - load_int 16777215 - load_string "Iii" + iconst 16777215 + sconst "Iii" iload 10 - widget_put_mouse_hover_listener_widget - load_int 2065 + if_setonmouserepeat + iconst 2065 iload 10 - widget_get_parentid_widget + if_getlayer iload 9 - load_int 16776960 - load_string "Iii" + iconst 16776960 + sconst "Iii" iload 10 - widget_put_mouse_exit_listener_widget + if_setonmouseleave jump LABEL256 LABEL248: - load_int -1 - load_string "" + iconst -1 + sconst "" iload 10 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 10 - widget_put_mouse_exit_listener_widget + if_setonmouseleave LABEL256: - load_int 9 - load_string "Clear history" + iconst 9 + sconst "Clear history" iload 10 - widget_put_action_widget - load_string "" - load_string "Notification" - load_string "" - string_append 3 + if_setop + sconst "" + sconst "Notification" + sconst "" + join_string 3 iload 10 - widget_put_name_widget - load_int 2064 - load_int -2147483644 + if_setopbase + iconst 2064 + iconst -2147483644 sload 3 - load_string "is" + sconst "is" iload 10 - widget_put_option_click_listener_widget + if_setonop iload 9 - load_int 1 - iadd + iconst 1 + add istore 9 - load_int 105 - load_int 73 - load_int 580 + iconst 105 + iconst 73 + iconst 580 iload 9 - get_enum_value + enum istore 10 LABEL282: iload 0 istore 12 - load_int 0 + iconst 0 istore 15 get_varp 287 - load_int 1 + iconst 1 if_icmpeq LABEL290 jump LABEL479 LABEL290: - get_varc 41 - load_int -1 + get_varc_int 41 + iconst -1 if_icmpne LABEL297 get_varbit 4089 - load_int 0 + iconst 0 if_icmpeq LABEL297 jump LABEL479 LABEL297: iload 12 - load_int -1 + iconst -1 if_icmpne LABEL301 jump LABEL479 LABEL301: iload 10 - load_int -1 + iconst -1 if_icmpne LABEL305 jump LABEL479 LABEL305: iload 7 iload 4 - isub - load_int 57 + sub + iconst 57 if_icmplt LABEL311 jump LABEL479 LABEL311: iload 12 - get_chat_message + chat_gethistory_byuid istore 14 sstore 0 sstore 2 @@ -352,7 +352,7 @@ LABEL311: iload 13 iload 14 invoke 91 - load_int 1 + iconst 1 if_icmpeq LABEL327 jump LABEL475 LABEL327: @@ -364,50 +364,50 @@ LABEL327: jump LABEL372 LABEL330: iload 7 - load_string "From " + sconst "From " sload 1 - load_string ":" - load_string "privateChatSplitFrom" - runelite_callback - string_append 3 + sconst ":" + sconst "privateChatSplitFrom" + runelite_callback + join_string 3 sload 0 iload 9 iload 10 - load_int 10682368 + iconst 10682368 iload 8 iload 1 - load_int 13 + iconst 13 iload 7 iload 2 iload 3 - load_int 65535 - load_int 1 + iconst 65535 + iconst 1 invoke 203 - iadd + add istore 7 jump LABEL407 LABEL351: iload 7 - load_string "To " + sconst "To " sload 1 - load_string ":" - load_string "privateChatSplitTo" - runelite_callback - string_append 3 + sconst ":" + sconst "privateChatSplitTo" + runelite_callback + join_string 3 sload 0 iload 9 iload 10 - load_int 10682368 + iconst 10682368 iload 8 iload 1 - load_int 13 + iconst 13 iload 7 iload 2 iload 3 - load_int 65535 - load_int 1 + iconst 65535 + iconst 1 invoke 203 - iadd + add istore 7 jump LABEL407 LABEL372: @@ -415,184 +415,184 @@ LABEL372: sload 0 iload 9 iload 10 - load_int 10682368 + iconst 10682368 iload 8 iload 1 - load_int 13 + iconst 13 iload 7 iload 2 iload 3 - load_int 65535 - load_int 1 + iconst 65535 + iconst 1 invoke 199 - iadd + add istore 7 iload 15 - load_int 5 + iconst 5 if_icmpeq LABEL392 jump LABEL407 LABEL392: get_varbit 1627 - load_int 0 + iconst 0 if_icmpeq LABEL396 jump LABEL407 LABEL396: iload 13 - load_int 500 - iadd - load_int 1 - iadd - put_varc 65 - load_int 664 - load_int 0 - load_string "1" - load_int 10616832 - widget_put_render_listener_widget + iconst 500 + add + iconst 1 + add + set_varc_int 65 + iconst 664 + iconst 0 + sconst "1" + iconst 10616832 + if_setontimer LABEL407: iload 10 - widget_put_actions_null_widget + if_clearops iload 15 - load_int 3 + iconst 3 if_icmpeq LABEL419 iload 15 - load_int 6 + iconst 6 if_icmpeq LABEL419 iload 15 - load_int 7 + iconst 7 if_icmpeq LABEL419 jump LABEL453 LABEL419: iload 14 - load_int 1 + iconst 1 if_icmpeq LABEL423 jump LABEL428 LABEL423: - load_int 8 - load_string "Message" + iconst 8 + sconst "Message" iload 10 - widget_put_action_widget + if_setop jump LABEL436 LABEL428: - load_int 8 - load_string "Add friend" + iconst 8 + sconst "Add friend" iload 10 - widget_put_action_widget - load_int 9 - load_string "Add ignore" + if_setop + iconst 9 + sconst "Add ignore" iload 10 - widget_put_action_widget + if_setop LABEL436: - load_int 10 - load_string "Report" + iconst 10 + sconst "Report" iload 10 - widget_put_action_widget - load_string "" + if_setop + sconst "" sload 1 - load_string "" - string_append 3 + sconst "" + join_string 3 iload 10 - widget_put_name_widget - load_int 88 - load_int -2147483644 - load_string "event_opbase" - load_string "is" + if_setopbase + iconst 88 + iconst -2147483644 + sconst "event_opbase" + sconst "is" iload 10 - widget_put_option_click_listener_widget + if_setonop jump LABEL457 LABEL453: - load_int -1 - load_string "" + iconst -1 + sconst "" iload 10 - widget_put_option_click_listener_widget + if_setonop LABEL457: - load_int -1 - load_string "" + iconst -1 + sconst "" iload 10 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 10 - widget_put_mouse_exit_listener_widget + if_setonmouseleave iload 9 - load_int 1 - iadd + iconst 1 + add istore 9 - load_int 105 - load_int 73 - load_int 580 + iconst 105 + iconst 73 + iconst 580 iload 9 - get_enum_value + enum istore 10 LABEL475: iload 12 - get_messagenode_next_id + chat_getprevuid istore 12 jump LABEL297 LABEL479: iload 10 - load_int -1 + iconst -1 if_icmpne LABEL483 jump LABEL540 LABEL483: iload 10 - widget_put_actions_null_widget - load_int -1 - load_string "" + if_clearops + iconst -1 + sconst "" iload 10 - widget_put_option_click_listener_widget - load_int -1 - load_string "" + if_setonop + iconst -1 + sconst "" iload 10 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" + if_setonmouserepeat + iconst -1 + sconst "" iload 10 - widget_put_mouse_exit_listener_widget - load_int 0 - load_int 0 - load_int 0 - load_int 0 + if_setonmouseleave + iconst 0 + iconst 0 + iconst 0 + iconst 0 iload 10 - widget_put_size_widget - load_int 10682368 + if_setsize + iconst 10682368 iload 9 - load_int 2 - imul - widget_load_child - load_int 1 + iconst 2 + multiply + cc_find + iconst 1 if_icmpeq LABEL511 jump LABEL515 LABEL511: - load_string "" - widget_put_text - load_int 1 - widget_put_hidden + sconst "" + cc_settext + iconst 1 + cc_sethide LABEL515: - load_int 10682368 + iconst 10682368 iload 9 - load_int 2 - imul - load_int 1 - iadd - widget_load_child - load_int 1 + iconst 2 + multiply + iconst 1 + add + cc_find + iconst 1 if_icmpeq LABEL525 jump LABEL529 LABEL525: - load_string "" - widget_put_text - load_int 1 - widget_put_hidden + sconst "" + cc_settext + iconst 1 + cc_sethide LABEL529: iload 9 - load_int 1 - iadd + iconst 1 + add istore 9 - load_int 105 - load_int 73 - load_int 580 + iconst 105 + iconst 73 + iconst 580 iload 9 - get_enum_value + enum istore 10 jump LABEL479 LABEL540: diff --git a/runelite-client/src/main/scripts/ChatboxInput.rs2asm b/runelite-client/src/main/scripts/ChatboxInput.rs2asm index a9f0cf7f57..98567e8f1c 100644 --- a/runelite-client/src/main/scripts/ChatboxInput.rs2asm +++ b/runelite-client/src/main/scripts/ChatboxInput.rs2asm @@ -5,47 +5,47 @@ .string_var_count 1 sload 0 ; load input iload 0 ; load chat type - load_string "chatboxInput" ; event name - runelite_callback ; invoke callback - pop_int ; pop chat type - string_length ; get string length of chat message - load_int 0 ; load 0 + sconst "chatboxInput" ; event name + runelite_callback ; invoke callback + pop_int ; pop chat type + string_length ; get string length of chat message + iconst 0 ; load 0 if_icmpne LABEL100 ; if length is not 0, continue - return + return LABEL100: get_varbit 4394 - load_int 1 + iconst 1 if_icmpeq LABEL4 jump LABEL24 LABEL4: iload 0 - load_int 1 + iconst 1 if_icmpeq LABEL8 jump LABEL16 LABEL8: - get_localplayer_name - load_string ": " - load_string "" + chat_playername + sconst ": " + sconst "" sload 0 - load_string "" - string_append 5 - send_game_message + sconst "" + join_string 5 + mes jump LABEL23 LABEL16: - get_localplayer_name - load_string ": " - load_string "" + chat_playername + sconst ": " + sconst "" sload 0 - load_string "" - string_append 5 - send_game_message + sconst "" + join_string 5 + mes LABEL23: jump LABEL27 LABEL24: sload 0 iload 0 - chatbox_input + chat_sendpublic LABEL27: - get_gamecycle - put_varc 61 - return + clientclock + set_varc_int 61 + return diff --git a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm index 63c13e7aee..7d608c5d0c 100644 --- a/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatboxInputWidgetBuilder.rs2asm @@ -3,166 +3,166 @@ .string_stack_count 0 .int_var_count 4 .string_var_count 3 - load_string "" + sconst "" sstore 0 - load_int 0 + iconst 0 istore 0 - load_int 6250335 + iconst 6250335 istore 1 invoke 921 - load_int 1 + iconst 1 if_icmpeq LABEL10 jump LABEL20 LABEL10: - load_string "" - load_int 16777215 - load_int 12566463 + sconst "" + iconst 16777215 + iconst 12566463 istore 1 istore 0 sstore 0 - load_int 1 - load_int 10616889 - widget_put_text_shadowed_widget + iconst 1 + iconst 10616889 + if_settextshadow jump LABEL23 LABEL20: - load_int 0 - load_int 10616889 - widget_put_text_shadowed_widget + iconst 0 + iconst 10616889 + if_settextshadow LABEL23: iload 0 - load_int 10616889 - widget_put_textcolor_widget - 049 335 + iconst 10616889 + if_setcolour + get_varc_string 335 string_length istore 2 - 049 335 - appendtags + get_varc_string 335 + escape sstore 1 - load_string "" + sconst "" sstore 2 - load_int 0 + iconst 0 istore 3 get_varbit 8119 - load_int 1 + iconst 1 if_icmpeq LABEL40 jump LABEL99 LABEL40: - load_int 105 - load_int 115 - load_int 1894 + iconst 105 + iconst 115 + iconst 1894 get_varbit 1777 - get_enum_value - get_localplayer_name - load_string ": " + enum + chat_playername + sconst ": " sload 0 sload 1 - load_string "" - string_append 6 + sconst "" + join_string 6 sstore 2 iload 2 - load_int 80 + iconst 80 if_icmplt LABEL56 jump LABEL63 LABEL56: sload 2 sload 0 - load_string "*" - load_string "" - string_append 3 - concat_string + sconst "*" + sconst "" + join_string 3 + append sstore 2 LABEL63: sload 2 - load_int 2147483647 - load_int 495 - get_max_line_width + iconst 2147483647 + iconst 495 + parawidth istore 3 iload 3 - load_int 10616889 - widget_get_width_widget + iconst 10616889 + if_getwidth if_icmpgt LABEL73 jump LABEL79 LABEL73: - load_int 2 - load_int 2 - load_int 0 - load_int 10616889 - widget_put_text_alignment_widget + iconst 2 + iconst 2 + iconst 0 + iconst 10616889 + if_settextalign jump LABEL84 LABEL79: - load_int 0 - load_int 2 - load_int 0 - load_int 10616889 - widget_put_text_alignment_widget + iconst 0 + iconst 2 + iconst 0 + iconst 10616889 + if_settextalign LABEL84: - load_int 10616889 - widget_put_actions_null_widget - load_int -1 - load_string "" - load_int 10616889 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" - load_int 10616889 - widget_put_mouse_exit_listener_widget - load_int -1 - load_string "" - load_int 10616889 - widget_put_option_click_listener_widget + iconst 10616889 + if_clearops + iconst -1 + sconst "" + iconst 10616889 + if_setonmouserepeat + iconst -1 + sconst "" + iconst 10616889 + if_setonmouseleave + iconst -1 + sconst "" + iconst 10616889 + if_setonop jump LABEL140 LABEL99: - load_int 105 - load_int 115 - load_int 1894 + iconst 105 + iconst 115 + iconst 1894 get_varbit 1777 - get_enum_value - load_string " You must set a name before you can chat." - string_append 2 + enum + sconst " You must set a name before you can chat." + join_string 2 sstore 2 - load_int 1 - load_int 2 - load_int 0 - load_int 10616889 - widget_put_text_alignment_widget - load_int 10 - load_string "Configure" - load_int 10616889 - widget_put_action_widget - load_string "" - load_string "Display name" - load_string "" - string_append 3 - load_int 10616889 - widget_put_name_widget - load_int 45 - load_int -2147483645 + iconst 1 + iconst 2 + iconst 0 + iconst 10616889 + if_settextalign + iconst 10 + sconst "Configure" + iconst 10616889 + if_setop + sconst "" + sconst "Display name" + sconst "" + join_string 3 + iconst 10616889 + if_setopbase + iconst 45 + iconst -2147483645 iload 1 - load_string "Ii" - load_int 10616889 - widget_put_mouse_hover_listener_widget - load_int 45 - load_int -2147483645 + sconst "Ii" + iconst 10616889 + if_setonmouserepeat + iconst 45 + iconst -2147483645 iload 0 - load_string "Ii" - load_int 10616889 - widget_put_mouse_exit_listener_widget - load_int 489 - load_int -2147483644 - load_int 1024 - load_string "ii" - load_int 10616889 - widget_put_option_click_listener_widget + sconst "Ii" + iconst 10616889 + if_setonmouseleave + iconst 489 + iconst -2147483644 + iconst 1024 + sconst "ii" + iconst 10616889 + if_setonop LABEL140: sload 2 - load_int 10616889 - widget_put_text_widget - load_string "setChatboxInput" + iconst 10616889 + if_settext + sconst "setChatboxInput" runelite_callback - load_int 3 - load_int 16 - load_int 1 - load_int 0 - load_int 10616889 - widget_put_size_widget + iconst 3 + iconst 16 + iconst 1 + iconst 0 + iconst 10616889 + if_setsize return diff --git a/runelite-client/src/main/scripts/CommandScript.rs2asm b/runelite-client/src/main/scripts/CommandScript.rs2asm index eba8db6af1..0926703d6b 100644 --- a/runelite-client/src/main/scripts/CommandScript.rs2asm +++ b/runelite-client/src/main/scripts/CommandScript.rs2asm @@ -3,238 +3,238 @@ .string_stack_count 0 .int_var_count 5 .string_var_count 0 - load_int 10616887 - widget_get_hidden_widget - load_int 1 + iconst 10616887 + if_gethide + iconst 1 if_icmpeq LABEL9 - load_int 10616888 - widget_get_hidden_widget - load_int 1 + iconst 10616888 + if_gethide + iconst 1 if_icmpeq LABEL9 jump LABEL10 LABEL9: return LABEL10: get_varbit 8119 - load_int 0 + iconst 0 if_icmpeq LABEL19 - load_int -1 - load_int 162 + iconst -1 + iconst 162 invoke 1701 - load_int 0 + iconst 0 if_icmpeq LABEL19 jump LABEL20 LABEL19: return LABEL20: - 049 335 + get_varc_string 335 string_length istore 2 - load_int 0 + iconst 0 istore 3 - load_int 0 + iconst 0 istore 4 invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL31 jump LABEL37 LABEL31: - get_varc 41 - load_int 4 + get_varc_int 41 + iconst 4 if_icmpeq LABEL35 jump LABEL37 LABEL35: - load_int 1 + iconst 1 istore 4 LABEL37: - get_rights - load_int 0 + staffmodlevel + iconst 0 if_icmpgt LABEL41 jump LABEL43 LABEL41: - load_int 1 + iconst 1 istore 3 LABEL43: iload 3 - load_int 1 + iconst 1 if_icmpeq LABEL47 jump LABEL58 LABEL47: - load_string "`" + sconst "`" iload 1 - string_indexof - load_int -1 + string_indexof_char + iconst -1 if_icmpne LABEL53 jump LABEL58 LABEL53: iload 2 - load_int 0 + iconst 0 if_icmpeq LABEL57 jump LABEL58 LABEL57: return LABEL58: iload 0 - load_int 84 + iconst 84 if_icmpeq LABEL62 jump LABEL179 LABEL62: invoke 1984 iload 2 - load_int 0 + iconst 0 if_icmpgt LABEL67 jump LABEL178 LABEL67: - 049 335 - load_string "/" - load_int 0 - string_indexof_from - load_int 0 + get_varc_string 335 + sconst "/" + iconst 0 + string_indexof_string + iconst 0 if_icmpeq LABEL77 iload 4 - load_int 1 + iconst 1 if_icmpeq LABEL77 jump LABEL112 LABEL77: - get_clanchatcount - load_int 0 + clan_getchatcount + iconst 0 if_icmpgt LABEL81 jump LABEL108 LABEL81: iload 2 - load_int 1 + iconst 1 if_icmple LABEL85 jump LABEL90 LABEL85: iload 4 - load_int 0 + iconst 0 if_icmpeq LABEL89 jump LABEL90 LABEL89: return LABEL90: get_varbit 4394 - load_int 1 + iconst 1 if_icmpeq LABEL94 jump LABEL96 LABEL94: - part_clanchat + clan_leavechat jump LABEL107 LABEL96: iload 4 - load_int 1 + iconst 1 if_icmpeq LABEL100 jump LABEL104 LABEL100: - load_string "/" - 049 335 - concat_string - 050 335 + sconst "/" + get_varc_string 335 + append + set_varc_string 335 LABEL104: - 049 335 - load_int 2 + get_varc_string 335 + iconst 2 invoke 96 LABEL107: jump LABEL111 LABEL108: - 049 335 - load_int 0 + get_varc_string 335 + iconst 0 invoke 96 LABEL111: jump LABEL174 LABEL112: - 049 335 - load_string "::" - load_int 0 - string_indexof_from - load_int 0 + get_varc_string 335 + sconst "::" + iconst 0 + string_indexof_string + iconst 0 if_icmpeq LABEL119 jump LABEL171 LABEL119: iload 2 - load_int 2 + iconst 2 if_icmpgt LABEL123 jump LABEL167 LABEL123: - 049 335 - load_string "::toggleroof" - load_int 0 - string_indexof_from - load_int 0 + get_varc_string 335 + sconst "::toggleroof" + iconst 0 + string_indexof_string + iconst 0 if_icmpeq LABEL130 jump LABEL144 LABEL130: - get_hideroofs - load_int 1 + getremoveroofs + iconst 1 if_icmpeq LABEL134 jump LABEL139 LABEL134: - load_int 0 - set_hideroofs - load_string "Roofs will only be removed selectively." - send_game_message + iconst 0 + setremoveroofs + sconst "Roofs will only be removed selectively." + mes jump LABEL143 LABEL139: - load_int 1 - set_hideroofs - load_string "Roofs are now all hidden." - send_game_message + iconst 1 + setremoveroofs + sconst "Roofs are now all hidden." + mes LABEL143: jump LABEL166 LABEL144: - 049 335 - load_string "::bank" - load_int 0 - string_indexof_from - load_int 0 + get_varc_string 335 + sconst "::bank" + iconst 0 + string_indexof_string + iconst 0 if_icmpeq LABEL151 - load_string "runeliteCommand" ; load callback name + sconst "runeliteCommand" ; load callback name runelite_callback ; invoke callback jump LABEL155 LABEL151: - load_string "Hey, everyone, I just tried to do something very silly!" - load_int 0 + sconst "Hey, everyone, I just tried to do something very silly!" + iconst 0 invoke 96 jump LABEL166 LABEL155: - 049 335 + get_varc_string 335 invoke 224 - 050 335 - 049 335 + set_varc_string 335 + get_varc_string 335 string_length istore 2 - 049 335 - load_int 2 + get_varc_string 335 + iconst 2 iload 2 - string_substring - run_command + substring + docheat LABEL166: jump LABEL170 LABEL167: - 049 335 - load_int 0 + get_varc_string 335 + iconst 0 invoke 96 LABEL170: jump LABEL174 LABEL171: - 049 335 - load_int 0 + get_varc_string 335 + iconst 0 invoke 96 LABEL174: - 049 335 + get_varc_string 335 invoke 77 - load_string "" - 050 335 + sconst "" + set_varc_string 335 LABEL178: jump LABEL247 LABEL179: iload 0 - load_int 104 + iconst 104 if_icmpeq LABEL183 jump LABEL189 LABEL183: iload 3 - load_int 1 + iconst 1 if_icmpeq LABEL187 jump LABEL188 LABEL187: @@ -243,12 +243,12 @@ LABEL188: jump LABEL247 LABEL189: iload 0 - load_int 105 + iconst 105 if_icmpeq LABEL193 jump LABEL199 LABEL193: iload 3 - load_int 1 + iconst 1 if_icmpeq LABEL197 jump LABEL198 LABEL197: @@ -257,68 +257,68 @@ LABEL198: jump LABEL247 LABEL199: iload 0 - load_int 80 + iconst 80 if_icmpeq LABEL203 jump LABEL241 LABEL203: - 049 356 + get_varc_string 356 string_length - load_int 0 + iconst 0 if_icmpgt LABEL208 jump LABEL228 LABEL208: - 049 356 - is_friend - load_int 1 + get_varc_string 356 + friend_test + iconst 1 if_icmpeq LABEL213 jump LABEL216 LABEL213: - 049 356 + get_varc_string 356 invoke 107 return LABEL216: - get_varc 60 - get_gamecycle + get_varc_int 60 + clientclock if_icmpgt LABEL220 jump LABEL221 LABEL220: return LABEL221: - get_gamecycle - load_int 50 - iadd - put_varc 60 - load_string "That player was not found on your Friends list." - send_game_message + clientclock + iconst 50 + add + set_varc_int 60 + sconst "That player was not found on your Friends list." + mes return LABEL228: - get_varc 60 - get_gamecycle + get_varc_int 60 + clientclock if_icmpgt LABEL232 jump LABEL233 LABEL232: return LABEL233: - get_gamecycle - load_int 50 - iadd - put_varc 60 - load_string "You haven't received any messages to which you can reply." - send_game_message + clientclock + iconst 50 + add + set_varc_int 60 + sconst "You haven't received any messages to which you can reply." + mes return jump LABEL247 LABEL241: - 049 335 - load_int 0 + get_varc_string 335 + iconst 0 iload 0 iload 1 invoke 74 - load_int 1 ; check if we're ignoring input - load_int 0 ; - load_string "blockChatInput" ; + iconst 1 ; check if we're ignoring input + iconst 0 ; + sconst "blockChatInput" ; runelite_callback ; if_icmpeq LABEL247 ; don't add to input varcstr - 050 335 + set_varc_string 335 LABEL247: invoke 223 return diff --git a/runelite-client/src/main/scripts/OpenBankSearchInput.rs2asm b/runelite-client/src/main/scripts/OpenBankSearchInput.rs2asm index aa38d28de9..547863277a 100644 --- a/runelite-client/src/main/scripts/OpenBankSearchInput.rs2asm +++ b/runelite-client/src/main/scripts/OpenBankSearchInput.rs2asm @@ -3,42 +3,42 @@ .string_stack_count 0 .int_var_count 0 .string_var_count 1 - get_varc 11 - load_int 1 + get_varc_int 11 + iconst 1 if_icmpeq LABEL4 jump LABEL5 LABEL4: - close_window + if_close LABEL5: - load_int 11 + iconst 11 invoke 677 - load_string "Show items whose names contain the following text:" - load_string "setSearchBankInputText" ; load event name + sconst "Show items whose names contain the following text:" + sconst "setSearchBankInputText" ; load event name runelite_callback ; invoke callback - load_int 10616876 - widget_put_text_widget - load_string "" + iconst 10616876 + if_settext + sconst "" invoke 222 - load_string "" + sconst "" sstore 0 - load_int 112 - load_int -2147483640 - load_int -2147483639 + iconst 112 + iconst -2147483640 + iconst -2147483639 sload 0 - load_string "izs" - load_int 10616877 - widget_put_key_listener_widget - load_int 138 - load_string "" - load_int 10616877 - widget_put_dialog_abort_listener_widget + sconst "izs" + iconst 10616877 + if_setonkey + iconst 138 + sconst "" + iconst 10616877 + if_setondialogabort invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL29 jump LABEL32 LABEL29: - load_int 0 - load_int 80 + iconst 0 + iconst 80 invoke 1983 LABEL32: return diff --git a/runelite-client/src/main/scripts/OptionsPanelRebuilder.rs2asm b/runelite-client/src/main/scripts/OptionsPanelRebuilder.rs2asm index bb6da79dd8..afb820ff0f 100644 --- a/runelite-client/src/main/scripts/OptionsPanelRebuilder.rs2asm +++ b/runelite-client/src/main/scripts/OptionsPanelRebuilder.rs2asm @@ -3,253 +3,253 @@ .string_stack_count 0 .int_var_count 21 .string_var_count 0 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551298 - get_enum_value + iconst 10551298 + enum istore 2 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551306 - get_enum_value + iconst 10551306 + enum istore 3 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551301 - get_enum_value + iconst 10551301 + enum istore 4 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551308 - get_enum_value + iconst 10551308 + enum istore 5 - load_int 103 - load_int 105 - load_int 1960 + iconst 103 + iconst 105 + iconst 1960 iload 1 - get_enum_value + enum istore 6 - load_int 103 - load_int 105 - load_int 1961 + iconst 103 + iconst 105 + iconst 1961 iload 1 - get_enum_value + enum istore 7 - load_int 103 - load_int 105 - load_int 1135 + iconst 103 + iconst 105 + iconst 1135 iload 1 - get_enum_value + enum istore 8 - load_int 103 - load_int 105 - load_int 1136 + iconst 103 + iconst 105 + iconst 1136 iload 1 - get_enum_value + enum istore 9 - load_int 0 + iconst 0 istore 10 - load_int 0 + iconst 0 istore 11 - load_int 0 + iconst 0 istore 12 - load_int 0 + iconst 0 istore 13 - load_int 0 + iconst 0 istore 14 - load_int 0 + iconst 0 istore 15 iload 0 - widget_get_width_widget + if_getwidth istore 16 iload 0 - widget_get_height_widget + if_getheight istore 17 iload 1 - load_int 1745 + iconst 1745 if_icmpeq LABEL70 jump LABEL84 LABEL70: - load_int 0 + iconst 0 iload 16 - load_int 39387148 - widget_get_width_widget - isub + iconst 39387148 + if_getwidth + sub invoke 1045 istore 14 - load_int 0 + iconst 0 iload 17 - load_int 39387148 - widget_get_height_widget - isub + iconst 39387148 + if_getheight + sub invoke 1045 istore 15 LABEL84: get_varbit 4606 - load_int 0 + iconst 0 if_icmpne LABEL88 jump LABEL253 LABEL88: get_varbit 4606 - load_int 2 + iconst 2 if_icmpeq LABEL92 jump LABEL101 LABEL92: - load_int 512 - load_int 220 - 6200 - load_int 0 - load_int 0 - load_int 0 - load_int 0 - 6202 + iconst 512 + iconst 220 + viewport_setfov + iconst 0 + iconst 0 + iconst 0 + iconst 0 + viewport_clampfov jump LABEL106 LABEL101: - load_int 512 - load_int 512 - load_int 512 - load_int 512 - 6202 + iconst 512 + iconst 512 + iconst 512 + iconst 512 + viewport_clampfov LABEL106: - load_int 50 - set_camera_focal_point_height + iconst 50 + cam_setfollowheight iload 2 - load_int -1 + iconst -1 if_icmpne LABEL112 jump LABEL252 LABEL112: iload 3 - load_int -1 + iconst -1 if_icmpne LABEL116 jump LABEL252 LABEL116: - get_viewport_size + viewport_geteffectivesize istore 11 istore 10 - load_int 0 + iconst 0 iload 16 iload 10 - isub + sub invoke 1045 - load_int 0 + iconst 0 iload 17 iload 11 - isub + sub invoke 1045 istore 13 istore 12 iload 10 iload 11 - load_int 0 - load_int 0 + iconst 0 + iconst 0 iload 2 - widget_put_size_widget + if_setsize iload 10 - load_int 0 + iconst 0 iload 14 iload 12 - isub + sub invoke 1045 - isub + sub iload 11 - load_int 0 + iconst 0 iload 15 iload 13 - isub + sub invoke 1045 - isub - load_int 0 - load_int 0 + sub + iconst 0 + iconst 0 iload 3 - widget_put_size_widget + if_setsize iload 4 - load_int -1 + iconst -1 if_icmpne LABEL159 jump LABEL242 LABEL159: iload 5 - load_int -1 + iconst -1 if_icmpne LABEL163 jump LABEL242 LABEL163: iload 12 iload 14 - isub - load_int 2 - idiv + sub + iconst 2 + div iload 13 iload 15 - isub - load_int 2 - idiv + sub + iconst 2 + div istore 13 istore 12 - load_int 0 + iconst 0 iload 6 iload 12 - isub + sub invoke 1045 - load_int 0 + iconst 0 iload 8 iload 12 - isub + sub invoke 1045 istore 8 istore 6 - load_int 0 + iconst 0 iload 7 iload 13 - isub + sub invoke 1045 - load_int 0 + iconst 0 iload 9 iload 13 - isub + sub invoke 1045 istore 9 istore 7 iload 6 iload 7 - load_int 0 - load_int 0 + iconst 0 + iconst 0 iload 4 - widget_put_position_widget + if_setposition iload 6 iload 7 - load_int 0 - load_int 0 + iconst 0 + iconst 0 iload 5 - widget_put_position_widget + if_setposition iload 6 iload 8 - iadd + add iload 7 iload 9 - iadd - load_int 1 - load_int 1 + add + iconst 1 + iconst 1 iload 4 - widget_put_size_widget + if_setsize iload 6 iload 8 - iadd + add iload 7 iload 9 - iadd - load_int 1 - load_int 1 + add + iconst 1 + iconst 1 iload 5 - widget_put_size_widget + if_setsize iload 1 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551307 - get_enum_value + iconst 10551307 + enum iload 5 iload 8 iload 9 @@ -257,137 +257,137 @@ LABEL163: jump LABEL252 LABEL242: iload 1 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551307 - get_enum_value + iconst 10551307 + enum iload 3 - load_int 0 - load_int 0 + iconst 0 + iconst 0 invoke 910 LABEL252: jump LABEL369 LABEL253: - load_int 0 - load_int 0 - load_int 0 - load_int 0 - 6202 - get_varc 73 - load_int 128 - load_string "outerZoomLimit" - runelite_callback + iconst 0 + iconst 0 + iconst 0 + iconst 0 + viewport_clampfov + get_varc_int 73 + iconst 128 + sconst "outerZoomLimit" + runelite_callback if_icmpge LABEL262 jump LABEL278 LABEL262: - get_varc 73 - load_int 896 - load_string "innerZoomLimit" + get_varc_int 73 + iconst 896 + sconst "innerZoomLimit" runelite_callback if_icmple LABEL266 jump LABEL278 LABEL266: - get_varc 74 - load_int 128 - load_string "outerZoomLimit" - runelite_callback + get_varc_int 74 + iconst 128 + sconst "outerZoomLimit" + runelite_callback if_icmpge LABEL270 jump LABEL278 LABEL270: - get_varc 74 - load_int 896 - load_string "innerZoomLimit" + get_varc_int 74 + iconst 896 + sconst "innerZoomLimit" runelite_callback if_icmple LABEL274 jump LABEL278 LABEL274: - get_varc 73 - get_varc 74 + get_varc_int 73 + get_varc_int 74 invoke 42 jump LABEL281 LABEL278: - load_int 512 - load_int 512 + iconst 512 + iconst 512 invoke 42 LABEL281: - get_viewport_size + viewport_geteffectivesize istore 11 istore 10 iload 2 - load_int -1 + iconst -1 if_icmpne LABEL288 jump LABEL369 LABEL288: iload 3 - load_int -1 + iconst -1 if_icmpne LABEL292 jump LABEL369 LABEL292: iload 10 iload 11 - load_int 0 - load_int 0 + iconst 0 + iconst 0 iload 2 - widget_put_size_widget + if_setsize iload 10 iload 14 - isub + sub iload 11 iload 15 - isub - load_int 0 - load_int 0 + sub + iconst 0 + iconst 0 iload 3 - widget_put_size_widget + if_setsize iload 4 - load_int -1 + iconst -1 if_icmpne LABEL312 jump LABEL359 LABEL312: iload 5 - load_int -1 + iconst -1 if_icmpne LABEL316 jump LABEL359 LABEL316: iload 6 iload 7 - load_int 0 - load_int 0 + iconst 0 + iconst 0 iload 4 - widget_put_position_widget + if_setposition iload 6 iload 7 - load_int 0 - load_int 0 + iconst 0 + iconst 0 iload 5 - widget_put_position_widget + if_setposition iload 6 iload 8 - iadd + add iload 7 iload 9 - iadd - load_int 1 - load_int 1 + add + iconst 1 + iconst 1 iload 4 - widget_put_size_widget + if_setsize iload 6 iload 8 - iadd + add iload 7 iload 9 - iadd - load_int 1 - load_int 1 + add + iconst 1 + iconst 1 iload 5 - widget_put_size_widget + if_setsize iload 1 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551307 - get_enum_value + iconst 10551307 + enum iload 5 iload 8 iload 9 @@ -395,191 +395,191 @@ LABEL316: jump LABEL369 LABEL359: iload 1 - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551307 - get_enum_value + iconst 10551307 + enum iload 3 - load_int 0 - load_int 0 + iconst 0 + iconst 0 invoke 910 LABEL369: - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551309 - get_enum_value + iconst 10551309 + enum istore 18 iload 18 - load_int -1 + iconst -1 if_icmpne LABEL379 jump LABEL423 LABEL379: invoke 1972 - load_int 0 + iconst 0 if_icmpeq LABEL383 jump LABEL417 LABEL383: iload 18 - widget_get_index_widget - load_int 1 + if_hassub + iconst 1 if_icmpeq LABEL388 jump LABEL417 LABEL388: - get_varc 173 - load_int -2 + get_varc_int 173 + iconst -2 if_icmpeq LABEL392 jump LABEL399 LABEL392: - load_int 512 - load_int 0 - load_int 0 - load_int 1 + iconst 512 + iconst 0 + iconst 0 + iconst 1 iload 18 - widget_put_size_widget + if_setsize jump LABEL416 LABEL399: - get_varc 173 - load_int -3 + get_varc_int 173 + iconst -3 if_icmpeq LABEL403 jump LABEL410 LABEL403: - load_int 0 - load_int 0 - load_int 1 - load_int 1 + iconst 0 + iconst 0 + iconst 1 + iconst 1 iload 18 - widget_put_size_widget + if_setsize jump LABEL416 LABEL410: - load_int 512 - load_int 334 - load_int 0 - load_int 0 + iconst 512 + iconst 334 + iconst 0 + iconst 0 iload 18 - widget_put_size_widget + if_setsize LABEL416: jump LABEL423 LABEL417: - load_int 512 - load_int 334 - load_int 0 - load_int 0 + iconst 512 + iconst 334 + iconst 0 + iconst 0 iload 18 - widget_put_size_widget + if_setsize LABEL423: - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551311 - get_enum_value + iconst 10551311 + enum istore 18 - load_int 0 + iconst 0 istore 19 - load_int 0 + iconst 0 istore 20 iload 18 - load_int -1 + iconst -1 if_icmpne LABEL437 jump LABEL481 LABEL437: - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551303 - get_enum_value - widget_get_index_widget - load_int 1 + iconst 10551303 + enum + if_hassub + iconst 1 if_icmpeq LABEL446 jump LABEL455 LABEL446: get_varbit 4692 - load_int 0 + iconst 0 if_icmpne LABEL450 jump LABEL453 LABEL450: - load_int 0 + iconst 0 istore 20 jump LABEL455 LABEL453: - load_int 38 + iconst 38 istore 20 LABEL455: invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL459 jump LABEL473 LABEL459: get_varbit 6254 - load_int 0 + iconst 0 if_icmpeq LABEL463 jump LABEL468 LABEL463: - load_int 182 - load_int 4 - iadd + iconst 182 + iconst 4 + add istore 19 jump LABEL472 LABEL468: - load_int 120 - load_int 4 - iadd + iconst 120 + iconst 4 + add istore 19 LABEL472: jump LABEL475 LABEL473: - load_int 0 + iconst 0 istore 19 LABEL475: iload 19 iload 20 - load_int 2 - load_int 0 + iconst 2 + iconst 0 iload 18 - widget_put_position_widget + if_setposition LABEL481: - load_int 73 - load_int 73 + iconst 73 + iconst 73 iload 1 - load_int 10551303 - get_enum_value + iconst 10551303 + enum istore 18 - load_int 0 + iconst 0 istore 19 iload 18 - load_int -1 + iconst -1 if_icmpne LABEL493 jump LABEL515 LABEL493: invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL497 jump LABEL507 LABEL497: get_varbit 6254 - load_int 0 + iconst 0 if_icmpeq LABEL501 jump LABEL504 LABEL501: - load_int 182 + iconst 182 istore 19 jump LABEL506 LABEL504: - load_int 120 + iconst 120 istore 19 LABEL506: jump LABEL509 LABEL507: - load_int 0 + iconst 0 istore 19 LABEL509: iload 19 - load_int 0 - load_int 1 - load_int 1 + iconst 0 + iconst 1 + iconst 1 iload 18 - widget_put_size_widget + if_setsize LABEL515: iload 0 iload 1 diff --git a/runelite-client/src/main/scripts/OptionsPanelZoomMouseListener.rs2asm b/runelite-client/src/main/scripts/OptionsPanelZoomMouseListener.rs2asm index 35bc2c04d4..a9aa9f62ad 100644 --- a/runelite-client/src/main/scripts/OptionsPanelZoomMouseListener.rs2asm +++ b/runelite-client/src/main/scripts/OptionsPanelZoomMouseListener.rs2asm @@ -6,77 +6,77 @@ ; locals ; 2 bar size get_varbit 4606 - load_int 0 + iconst 0 if_icmpne LABEL4 jump LABEL5 LABEL4: return LABEL5: - load_int 512 + iconst 512 istore 3 - load_int 512 + iconst 512 istore 4 iload 1 - widget_get_width_widget + if_getwidth iload 0 - widget_get_width_widget - isub + if_getwidth + sub istore 5 - load_int 0 + iconst 0 iload 2 invoke 1045 istore 2 iload 1 - widget_get_width_widget + if_getwidth iload 0 - widget_get_width_widget - isub + if_getwidth + sub iload 2 invoke 1046 istore 2 - load_int 896 - load_string "innerZoomLimit" + iconst 896 + sconst "innerZoomLimit" runelite_callback - load_int 128 - load_string "outerZoomLimit" - runelite_callback - isub + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub istore 6 ; resizable delta - load_int 896 - load_string "innerZoomLimit" + iconst 896 + sconst "innerZoomLimit" runelite_callback - load_int 128 - load_string "outerZoomLimit" - runelite_callback - isub + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub istore 7 ; fixed delta iload 2 iload 6 - imul + multiply iload 5 - idiv + div iload 6 - load_string "zoomLinToExp" - runelite_callback - pop_int - load_int 128 - load_string "outerZoomLimit" - runelite_callback - iadd + sconst "zoomLinToExp" + runelite_callback + pop_int + iconst 128 + sconst "outerZoomLimit" + runelite_callback + add istore 3 iload 2 iload 7 - imul + multiply iload 5 - idiv + div iload 7 - load_string "zoomLinToExp" - runelite_callback - pop_int - load_int 128 - load_string "outerZoomLimit" - runelite_callback - iadd + sconst "zoomLinToExp" + runelite_callback + pop_int + iconst 128 + sconst "outerZoomLimit" + runelite_callback + add istore 4 iload 4 iload 3 diff --git a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm index ae8b33dd98..3abf21a570 100644 --- a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm +++ b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm @@ -7,77 +7,77 @@ ; 0 resizableZoomRange ; 1 fixedZoomRange ; 2 bar size - load_int 896 - load_string "innerZoomLimit" + iconst 896 + sconst "innerZoomLimit" runelite_callback - load_int 128 - load_string "outerZoomLimit" - runelite_callback - isub + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub istore 0 - load_int 896 - load_string "innerZoomLimit" + iconst 896 + sconst "innerZoomLimit" runelite_callback - load_int 128 - load_string "outerZoomLimit" - runelite_callback - isub + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub istore 1 - load_int 17104910 - widget_get_width_widget - load_int 17104911 - widget_get_width_widget - isub + iconst 17104910 + if_getwidth + iconst 17104911 + if_getwidth + sub istore 2 - load_int 0 + iconst 0 istore 3 - load_int 0 + iconst 0 istore 4 - get_viewport_size + viewport_geteffectivesize istore 4 istore 3 - load_int 0 + iconst 0 istore 5 iload 3 - load_int 334 + iconst 334 if_icmpgt LABEL27 jump LABEL36 LABEL27: - get_varc 74 - load_int 128 - load_string "outerZoomLimit" - runelite_callback - isub + get_varc_int 74 + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub iload 0 - load_string "zoomExpToLin" + sconst "zoomExpToLin" runelite_callback pop_int iload 2 - imul + multiply iload 0 - idiv + div istore 5 jump LABEL44 LABEL36: - get_varc 73 - load_int 128 - load_string "outerZoomLimit" - runelite_callback - isub + get_varc_int 73 + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub iload 0 - load_string "zoomExpToLin" + sconst "zoomExpToLin" runelite_callback pop_int iload 2 - imul + multiply iload 1 - idiv + div istore 5 LABEL44: iload 5 - load_int 0 - load_int 0 - load_int 0 - load_int 17104911 - widget_put_position_widget + iconst 0 + iconst 0 + iconst 0 + iconst 17104911 + if_setposition return diff --git a/runelite-client/src/main/scripts/PrivateMessage.rs2asm b/runelite-client/src/main/scripts/PrivateMessage.rs2asm index c15cbc9dee..3d9d8901f6 100644 --- a/runelite-client/src/main/scripts/PrivateMessage.rs2asm +++ b/runelite-client/src/main/scripts/PrivateMessage.rs2asm @@ -3,28 +3,28 @@ .string_stack_count 0 .int_var_count 2 .string_var_count 1 - get_varc 5 - load_int 14 + get_varc_int 5 + iconst 14 if_icmpeq LABEL4 jump LABEL7 LABEL4: - load_int 1 - put_varc 66 + iconst 1 + set_varc_int 66 return LABEL7: - load_int -1 + iconst -1 istore 0 - load_string "" + sconst "" sstore 0 - 049 359 + get_varc_string 359 string_length istore 1 iload 1 - load_int 0 + iconst 0 if_icmpgt LABEL18 jump LABEL184 LABEL18: - get_varc 5 + get_varc_int 5 switch 1: LABEL21 2: LABEL44 @@ -46,87 +46,87 @@ LABEL21: return jump LABEL183 LABEL23: - get_ignorecount - load_int 0 + ignore_count + iconst 0 if_icmplt LABEL27 jump LABEL30 LABEL27: - load_string "Unable to update ignore list - system busy." - send_game_message + sconst "Unable to update ignore list - system busy." + mes jump LABEL43 LABEL30: - get_varc 5 - load_int 4 + get_varc_int 5 + iconst 4 if_icmpeq LABEL34 jump LABEL37 LABEL34: - 049 359 - add_ignore + get_varc_string 359 + ignore_add jump LABEL43 LABEL37: - get_varc 5 - load_int 5 + get_varc_int 5 + iconst 5 if_icmpeq LABEL41 jump LABEL43 LABEL41: - 049 359 - remove_ignore + get_varc_string 359 + ignore_del LABEL43: jump LABEL183 LABEL44: - get_friendcount - load_int 0 + friend_count + iconst 0 if_icmplt LABEL48 jump LABEL51 LABEL48: - load_string "Unable to complete action - system busy." - send_game_message + sconst "Unable to complete action - system busy." + mes jump LABEL106 LABEL51: - get_varc 5 - load_int 2 + get_varc_int 5 + iconst 2 if_icmpeq LABEL55 jump LABEL58 LABEL55: - 049 359 - add_friend + get_varc_string 359 + friend_add jump LABEL106 LABEL58: - get_varc 5 - load_int 3 + get_varc_int 5 + iconst 3 if_icmpeq LABEL62 jump LABEL65 LABEL62: - 049 359 - remove_friend + get_varc_string 359 + friend_del jump LABEL106 LABEL65: - get_varc 5 - load_int 6 + get_varc_int 5 + iconst 6 if_icmpeq LABEL69 jump LABEL106 LABEL69: get_varbit 8119 - load_int 0 + iconst 0 if_icmpeq LABEL73 jump LABEL79 LABEL73: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 - load_string "You must set a name before you can chat." - send_game_message + sconst "You must set a name before you can chat." + mes return LABEL79: - 5005 - load_int 2 + chat_getfilter_private + iconst 2 if_icmpeq LABEL83 jump LABEL94 LABEL83: - 5000 - load_int 1 - 5016 - chatfilter_update + chat_getfilter_public + iconst 1 + chat_getfilter_trade + chat_setfilter invoke 178 invoke 553 istore 0 @@ -136,122 +136,122 @@ LABEL83: invoke 89 LABEL94: get_varbit 4394 - load_int 1 + iconst 1 if_icmpeq LABEL98 jump LABEL101 LABEL98: - 049 360 - remove_friend + get_varc_string 360 + friend_del jump LABEL104 LABEL101: - 049 360 - 049 359 - load_string "privateMessage" ; load event name - load_int 0 ; whether or not to skip + get_varc_string 360 + get_varc_string 359 + sconst "privateMessage" ; load event name + iconst 0 ; whether or not to skip runelite_callback ; invoke callback - load_int 1 + iconst 1 if_icmpeq LABEL104 ; if skipped, do not message - privmsg + chat_sendprivate LABEL104: - get_gamecycle - put_varc 61 + clientclock + set_varc_int 61 LABEL106: jump LABEL183 LABEL107: - 049 359 + get_varc_string 359 invoke 212 - numeric_input + resume_countdialog jump LABEL183 LABEL111: - 049 359 - string_remove_html - 050 361 - 049 359 - string_input_1 + get_varc_string 359 + removetags + set_varc_string 361 + get_varc_string 359 + resume_namedialog jump LABEL183 LABEL117: - 049 359 - string_input_2 + get_varc_string 359 + resume_stringdialog jump LABEL183 LABEL120: get_varbit 8119 - load_int 0 + iconst 0 if_icmpeq LABEL124 jump LABEL130 LABEL124: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 - load_string "You must set a name before you can chat." - send_game_message + sconst "You must set a name before you can chat." + mes return LABEL130: - 049 359 - string_remove_html - 050 362 - 049 359 - join_clanchat + get_varc_string 359 + removetags + set_varc_string 362 + get_varc_string 359 + clan_joinchat jump LABEL183 LABEL136: iload 1 - load_int 10 + iconst 10 if_icmpgt LABEL140 jump LABEL146 LABEL140: - 049 359 - load_int 0 - load_int 9 - string_substring + get_varc_string 359 + iconst 0 + iconst 9 + substring sstore 0 jump LABEL148 LABEL146: - 049 359 + get_varc_string 359 sstore 0 LABEL148: sload 0 - tolowercase - 5021 + lowercase + chat_setmessagefilter invoke 553 invoke 84 jump LABEL183 LABEL154: get_varbit 8119 - load_int 0 + iconst 0 if_icmpeq LABEL158 jump LABEL164 LABEL158: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 - load_string "You must set a name before you can chat." - send_game_message + sconst "You must set a name before you can chat." + mes return LABEL164: - 049 359 - load_int 0 - put_varc 62 - 050 358 + get_varc_string 359 + iconst 0 + set_varc_int 62 + set_varc_string 358 invoke 95 - load_int 552 - load_int -2147483645 - load_int 1 - load_string "I1" - load_int 10616845 - widget_put_render_listener_widget + iconst 552 + iconst -2147483645 + iconst 1 + sconst "I1" + iconst 10616845 + if_setontimer jump LABEL183 LABEL176: - load_int 0 - load_int 1 + iconst 0 + iconst 1 invoke 299 return jump LABEL183 LABEL181: - 049 359 + get_varc_string 359 invoke 2061 LABEL183: jump LABEL190 LABEL184: - get_varc 5 + get_varc_int 5 switch 16: LABEL189 7: LABEL187 @@ -265,7 +265,7 @@ LABEL187: LABEL189: return LABEL190: - load_int 1 - load_int 1 + iconst 1 + iconst 1 invoke 299 return diff --git a/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm b/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm index 605608f9bd..4aeb36de78 100644 --- a/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm +++ b/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm @@ -3,19 +3,19 @@ .string_stack_count 0 .int_var_count 3 .string_var_count 0 - load_string "resetChatboxInput" + sconst "resetChatboxInput" runelite_callback - load_int 1 - load_int 10616872 - widget_put_hidden_widget - load_int 0 - load_int 10616887 - widget_put_hidden_widget + iconst 1 + iconst 10616872 + if_sethide + iconst 0 + iconst 10616887 + if_sethide invoke 923 - load_int 0 + iconst 0 istore 2 iload 1 - load_int 1 + iconst 1 if_icmpeq LABEL13 jump LABEL27 LABEL13: @@ -26,144 +26,144 @@ LABEL13: iload 2 invoke 89 invoke 223 - load_int 1 + iconst 1 invoke 927 invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL26 jump LABEL27 LABEL26: invoke 1984 LABEL27: invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL31 jump LABEL32 LABEL31: invoke 2581 LABEL32: - load_int 0 - put_varc 5 + iconst 0 + set_varc_int 5 iload 0 - load_int 1 + iconst 1 if_icmpeq LABEL38 jump LABEL40 LABEL38: - load_string "" - 050 359 + sconst "" + set_varc_string 359 LABEL40: - load_int 0 - load_int -8 - load_int 1 - load_int 1 - load_int 10616876 - widget_put_position_widget - load_int 0 - load_int 40 - load_int 1 - load_int 0 - load_int 10616876 - widget_put_size_widget - load_int 0 - load_int 22 - load_int 1 - load_int 1 - load_int 10616877 - widget_put_position_widget - load_int 0 - load_int 20 - load_int 1 - load_int 0 - load_int 10616877 - widget_put_size_widget - load_int 0 - load_int 10616876 - widget_put_hidden_widget - load_int 0 - load_int 10616877 - widget_put_hidden_widget - load_int 1 - load_int 10616881 - widget_put_hidden_widget - load_int 10616885 - widget_unset_children - load_int 10616886 - widget_unset_children - load_int -1 - load_string "" - load_int 10616872 - widget_put_mouse_press_listener_widget - load_int -1 - load_string "" - load_int 10616872 - widget_put_render_listener_widget - load_int 10616872 - widget_unset_children - load_int 10616878 - widget_unset_children - load_int 10616879 - widget_unset_children - load_int 10616880 - widget_unset_children - load_int 1 - load_int 10616878 - widget_put_hidden_widget - load_int 1 - load_int 10616879 - widget_put_hidden_widget - load_int 1 - load_int 10616880 - widget_put_hidden_widget - load_int -1 - load_string "" - load_int 10616878 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" - load_int 10616879 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" - load_int 10616880 - widget_put_mouse_hover_listener_widget - load_int -1 - load_string "" - load_int 10616878 - widget_put_mouse_exit_listener_widget - load_int -1 - load_string "" - load_int 10616879 - widget_put_mouse_exit_listener_widget - load_int -1 - load_string "" - load_int 10616880 - widget_put_mouse_exit_listener_widget - load_int -1 - load_string "" - load_int 10616878 - widget_put_render_listener_widget - load_int -1 - load_string "" - load_int 10616879 - widget_put_render_listener_widget - load_int -1 - load_string "" - load_int 10616880 - widget_put_render_listener_widget - load_int -1 - load_string "" - load_int 10616878 - widget_put_mouse_press_listener_widget - load_int -1 - load_string "" - load_int 10616879 - widget_put_mouse_press_listener_widget - load_int -1 - load_string "" - load_int 10616880 - widget_put_mouse_press_listener_widget - get_varc 41 - load_int -1 + iconst 0 + iconst -8 + iconst 1 + iconst 1 + iconst 10616876 + if_setposition + iconst 0 + iconst 40 + iconst 1 + iconst 0 + iconst 10616876 + if_setsize + iconst 0 + iconst 22 + iconst 1 + iconst 1 + iconst 10616877 + if_setposition + iconst 0 + iconst 20 + iconst 1 + iconst 0 + iconst 10616877 + if_setsize + iconst 0 + iconst 10616876 + if_sethide + iconst 0 + iconst 10616877 + if_sethide + iconst 1 + iconst 10616881 + if_sethide + iconst 10616885 + cc_deleteall + iconst 10616886 + cc_deleteall + iconst -1 + sconst "" + iconst 10616872 + if_setonclick + iconst -1 + sconst "" + iconst 10616872 + if_setontimer + iconst 10616872 + cc_deleteall + iconst 10616878 + cc_deleteall + iconst 10616879 + cc_deleteall + iconst 10616880 + cc_deleteall + iconst 1 + iconst 10616878 + if_sethide + iconst 1 + iconst 10616879 + if_sethide + iconst 1 + iconst 10616880 + if_sethide + iconst -1 + sconst "" + iconst 10616878 + if_setonmouserepeat + iconst -1 + sconst "" + iconst 10616879 + if_setonmouserepeat + iconst -1 + sconst "" + iconst 10616880 + if_setonmouserepeat + iconst -1 + sconst "" + iconst 10616878 + if_setonmouseleave + iconst -1 + sconst "" + iconst 10616879 + if_setonmouseleave + iconst -1 + sconst "" + iconst 10616880 + if_setonmouseleave + iconst -1 + sconst "" + iconst 10616878 + if_setontimer + iconst -1 + sconst "" + iconst 10616879 + if_setontimer + iconst -1 + sconst "" + iconst 10616880 + if_setontimer + iconst -1 + sconst "" + iconst 10616878 + if_setonclick + iconst -1 + sconst "" + iconst 10616879 + if_setonclick + iconst -1 + sconst "" + iconst 10616880 + if_setonclick + get_varc_int 41 + iconst -1 if_icmpeq LABEL154 jump LABEL156 LABEL154: @@ -171,7 +171,7 @@ LABEL154: pop_int LABEL156: invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL160 jump LABEL161 LABEL160: diff --git a/runelite-client/src/main/scripts/ScrollWheelZoomHandler.rs2asm b/runelite-client/src/main/scripts/ScrollWheelZoomHandler.rs2asm index 9ca40fbbf2..665eb44242 100644 --- a/runelite-client/src/main/scripts/ScrollWheelZoomHandler.rs2asm +++ b/runelite-client/src/main/scripts/ScrollWheelZoomHandler.rs2asm @@ -3,43 +3,43 @@ .string_stack_count 0 .int_var_count 4 .string_var_count 0 - load_int 1 - load_int 0 - load_string "scrollWheelZoom" + iconst 1 + iconst 0 + sconst "scrollWheelZoom" runelite_callback if_icmpeq LABEL18 - load_int 0 + iconst 0 iload 0 - load_int 25 - imul - isub + iconst 25 + multiply + sub istore 1 - load_int 512 + iconst 512 istore 2 - load_int 512 + iconst 512 istore 3 get_varbit 6357 - load_int 0 + iconst 0 if_icmpeq LABEL14 jump LABEL33 LABEL14: get_varbit 4606 - load_int 0 + iconst 0 if_icmpne LABEL18 jump LABEL19 LABEL18: return LABEL19: - 6205 + viewport_getfov istore 2 istore 3 iload 3 iload 1 - iadd + add istore 3 iload 2 iload 1 - iadd + add istore 2 iload 3 iload 2 diff --git a/runelite-client/src/main/scripts/SendPrivateMessage.rs2asm b/runelite-client/src/main/scripts/SendPrivateMessage.rs2asm index 3e1e3a8d47..1803820d2d 100644 --- a/runelite-client/src/main/scripts/SendPrivateMessage.rs2asm +++ b/runelite-client/src/main/scripts/SendPrivateMessage.rs2asm @@ -30,5 +30,5 @@ ; Send a private message sload 0 sload 1 - privmsg - return + chat_sendprivate + return diff --git a/runelite-client/src/main/scripts/SkillTabBuilder.rs2asm b/runelite-client/src/main/scripts/SkillTabBuilder.rs2asm index c3e1f8261b..a9529b3efb 100644 --- a/runelite-client/src/main/scripts/SkillTabBuilder.rs2asm +++ b/runelite-client/src/main/scripts/SkillTabBuilder.rs2asm @@ -3,112 +3,112 @@ .string_stack_count 1 .int_var_count 11 .string_var_count 4 - load_int 83 - load_int 49 - load_int 1497 + iconst 83 + iconst 49 + iconst 1497 iload 0 - get_enum_value + enum istore 3 iload 0 - get_boostedskilllevels - int_to_string - widget_put_text + stat + tostring + cc_settext iload 0 - get_realskilllevels + stat_base istore 4 iload 0 ; load the skill id from arguments iload 4 ; load the current real skill level - load_string "skillTabBaseLevel" ; push event name + sconst "skillTabBaseLevel" ; push event name runelite_callback ; invoke callback istore 4 ; store the (possibly) edited real skill level iload 4 - int_to_string - widget_put_text 1 + tostring + cc_settext 1 iload 0 - get_skillexperiences + stat_xp istore 5 - load_string "," + sconst "," sstore 1 sload 0 - load_string " XP:" - string_append 2 + sconst " XP:" + join_string 2 sstore 2 iload 5 sload 1 invoke 46 sstore 3 - load_int 0 + iconst 0 istore 6 get_varbit 4181 - load_int 0 + iconst 0 if_icmpeq LABEL35 jump LABEL66 LABEL35: iload 4 - load_int 99 - load_string "skillTabMaxLevel" ; push event name + iconst 99 + sconst "skillTabMaxLevel" ; push event name runelite_callback ; invoke callback if_icmplt LABEL39 jump LABEL65 LABEL39: - load_int 105 - load_int 105 - load_int 256 + iconst 105 + iconst 105 + iconst 256 iload 4 - load_int 1 - iadd - get_enum_value + iconst 1 + add + enum istore 6 sload 2 - load_string "|Next level at:|Remaining XP:" - concat_string + sconst "|Next level at:|Remaining XP:" + append sstore 2 sload 3 - load_string "|" + sconst "|" iload 6 sload 1 invoke 46 - load_string "|" + sconst "|" iload 6 iload 5 - isub + sub sload 1 invoke 46 - string_append 4 - concat_string + join_string 4 + append sstore 3 LABEL65: jump LABEL84 LABEL66: sload 2 - load_string "|Next level at:" - concat_string + sconst "|Next level at:" + append sstore 2 sload 3 - load_string "|" - load_int 105 - load_int 105 - load_int 256 + sconst "|" + iconst 105 + iconst 105 + iconst 256 iload 4 - load_int 1 - iadd - get_enum_value + iconst 1 + add + enum sload 1 invoke 46 - string_append 2 - concat_string + join_string 2 + append sstore 3 LABEL84: - load_int 0 + iconst 0 istore 7 - load_int 0 + iconst 0 istore 8 - load_int 0 + iconst 0 istore 9 - load_int 0 + iconst 0 istore 10 invoke 1138 - load_int 1 + iconst 1 if_icmpeq LABEL96 jump LABEL278 LABEL96: @@ -116,13 +116,13 @@ LABEL96: invoke 1936 istore 7 iload 7 - load_int -1 + iconst -1 if_icmpne LABEL103 jump LABEL133 LABEL103: iload 7 - load_int 10 - idiv + iconst 10 + div istore 7 iload 7 iload 5 @@ -130,35 +130,35 @@ LABEL103: jump LABEL133 LABEL111: sload 2 - load_string "|" - load_string "" - load_string "XP to regain:" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "XP to regain:" + sconst "" + join_string 4 + append sstore 2 sload 3 - load_string "|" - load_string "" + sconst "|" + sconst "" iload 7 iload 5 - isub + sub sload 1 invoke 46 - load_string "" - string_append 4 - concat_string + sconst "" + join_string 4 + append sstore 3 - load_int 1 + iconst 1 istore 8 LABEL133: iload 8 - load_int 0 + iconst 0 if_icmpeq LABEL137 jump LABEL278 LABEL137: get_varp 1588 - load_int 0 + iconst 0 if_icmpgt LABEL141 jump LABEL278 LABEL141: @@ -171,279 +171,279 @@ LABEL141: 6: LABEL144 jump LABEL278 LABEL144: - load_int 20 + iconst 20 invoke 2031 istore 10 iload 10 - load_int 0 + iconst 0 if_icmpgt LABEL151 jump LABEL170 LABEL151: sload 2 - load_string "|" - load_string "" - load_string "XP permitted:" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "XP permitted:" + sconst "" + join_string 4 + append sstore 2 sload 3 - load_string "|" - load_string "" + sconst "|" + sconst "" iload 10 sload 1 invoke 46 - load_string "" - string_append 4 - concat_string + sconst "" + join_string 4 + append sstore 3 jump LABEL188 LABEL170: - load_int 1 + iconst 1 istore 9 sload 2 - load_string "|" - load_string "" - load_string "XP permitted:" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "XP permitted:" + sconst "" + join_string 4 + append sstore 2 sload 3 - load_string "|" - load_string "" - load_string "NONE" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "NONE" + sconst "" + join_string 4 + append sstore 3 LABEL188: jump LABEL278 LABEL189: - load_int 30 + iconst 30 invoke 2031 istore 10 iload 10 - load_int 0 + iconst 0 if_icmpgt LABEL196 jump LABEL215 LABEL196: sload 2 - load_string "|" - load_string "" - load_string "XP permitted:" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "XP permitted:" + sconst "" + join_string 4 + append sstore 2 sload 3 - load_string "|" - load_string "" + sconst "|" + sconst "" iload 10 sload 1 invoke 46 - load_string "" - string_append 4 - concat_string + sconst "" + join_string 4 + append sstore 3 jump LABEL233 LABEL215: - load_int 1 + iconst 1 istore 9 sload 2 - load_string "|" - load_string "" - load_string "XP permitted:" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "XP permitted:" + sconst "" + join_string 4 + append sstore 2 sload 3 - load_string "|" - load_string "" - load_string "NONE" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "NONE" + sconst "" + join_string 4 + append sstore 3 LABEL233: jump LABEL278 LABEL234: - load_int 40 + iconst 40 invoke 2031 istore 10 iload 10 - load_int 0 + iconst 0 if_icmpgt LABEL241 jump LABEL260 LABEL241: sload 2 - load_string "|" - load_string "" - load_string "XP permitted:" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "XP permitted:" + sconst "" + join_string 4 + append sstore 2 sload 3 - load_string "|" - load_string "" + sconst "|" + sconst "" iload 10 sload 1 invoke 46 - load_string "" - string_append 4 - concat_string + sconst "" + join_string 4 + append sstore 3 jump LABEL278 LABEL260: - load_int 1 + iconst 1 istore 9 sload 2 - load_string "|" - load_string "" - load_string "XP permitted:" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "XP permitted:" + sconst "" + join_string 4 + append sstore 2 sload 3 - load_string "|" - load_string "" - load_string "NONE" - load_string "" - string_append 4 - concat_string + sconst "|" + sconst "" + sconst "NONE" + sconst "" + join_string 4 + append sstore 3 LABEL278: iload 1 - load_int 5 - widget_load_child 1 - load_int 1 + iconst 5 + cc_find 1 + iconst 1 if_icmpeq LABEL284 jump LABEL294 LABEL284: iload 9 - load_int 1 + iconst 1 if_icmpeq LABEL288 jump LABEL291 LABEL288: - load_int 0 - widget_put_hidden 1 + iconst 0 + cc_sethide 1 jump LABEL293 LABEL291: - load_int 1 - widget_put_hidden 1 + iconst 1 + cc_sethide 1 LABEL293: jump LABEL321 LABEL294: iload 1 - load_int 5 - load_int 5 - widget_create_child 1 - load_int 6 - load_int 0 - load_int 0 - load_int 1 - widget_put_position 1 - load_int 19 - load_int 19 - load_int 0 - load_int 0 - widget_put_size 1 - load_int 940 - widget_put_spriteid 1 - load_int 65793 - widget_put_sprite2 1 + iconst 5 + iconst 5 + cc_create 1 + iconst 6 + iconst 0 + iconst 0 + iconst 1 + cc_setposition 1 + iconst 19 + iconst 19 + iconst 0 + iconst 0 + cc_setsize 1 + iconst 940 + cc_setgraphic 1 + iconst 65793 + cc_setgraphicshadow 1 iload 9 - load_int 1 + iconst 1 if_icmpeq LABEL316 jump LABEL319 LABEL316: - load_int 0 - widget_put_hidden 1 + iconst 0 + cc_sethide 1 jump LABEL321 LABEL319: - load_int 1 - widget_put_hidden 1 + iconst 1 + cc_sethide 1 LABEL321: iload 3 - load_int 1 + iconst 1 if_icmpeq LABEL325 jump LABEL344 LABEL325: - get_ismembers - load_int 0 + map_members + iconst 0 if_icmpeq LABEL329 jump LABEL344 LABEL329: - get_varc 103 - load_int 0 + get_varc_int 103 + iconst 0 if_icmpeq LABEL333 jump LABEL344 LABEL333: - load_string "" + sconst "" sload 0 - load_string ":" - load_string "" - string_append 4 + sconst ":" + sconst "" + join_string 4 sstore 2 - load_string "" - load_string "Members Only" - load_string "" - string_append 3 + sconst "" + sconst "Members Only" + sconst "" + join_string 3 sstore 3 LABEL344: invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL348 jump LABEL375 LABEL348: - load_int 2367 - load_int -2147483644 - load_int -2147483645 - load_int -1 + iconst 2367 + iconst -2147483644 + iconst -2147483645 + iconst -1 iload 2 sload 2 sload 3 - load_int 495 - load_string "iIiIssf" + iconst 495 + sconst "iIiIssf" iload 1 - widget_put_option_click_listener_widget - get_varc 218 + if_setonop + get_varc_int 218 iload 1 if_icmpeq LABEL363 jump LABEL374 LABEL363: - get_varc 217 - load_int -1 + get_varc_int 217 + iconst -1 if_icmpeq LABEL367 jump LABEL374 LABEL367: iload 1 - load_int -1 + iconst -1 iload 2 sload 2 sload 3 - load_int 495 + iconst 495 invoke 2344 LABEL374: jump LABEL390 LABEL375: - load_int 992 - load_int -2147483645 - load_int -1 + iconst 992 + iconst -2147483645 + iconst -1 iload 2 sload 2 sload 3 - load_int 495 - load_int 25 - load_int 5 - idiv - load_string "IiIssfi" + iconst 495 + iconst 25 + iconst 5 + div + sconst "IiIssfi" iload 1 - widget_put_mouse_hover_listener_widget - load_int 0 - put_varc 2 + if_setonmouserepeat + iconst 0 + set_varc_int 2 LABEL390: return diff --git a/runelite-client/src/main/scripts/SkillTabTotalLevel.rs2asm b/runelite-client/src/main/scripts/SkillTabTotalLevel.rs2asm index 2d1142dc7a..2f623396d6 100644 --- a/runelite-client/src/main/scripts/SkillTabTotalLevel.rs2asm +++ b/runelite-client/src/main/scripts/SkillTabTotalLevel.rs2asm @@ -5,105 +5,105 @@ .string_var_count 2 invoke 1007 istore 2 - load_string "Total level:" - load_string "
" + sconst "Total level:" + sconst "
" iload 2 - int_to_string - string_append 3 + tostring + join_string 3 iload 0 - load_string "skillTabTotalLevel" ; push event name + sconst "skillTabTotalLevel" ; push event name runelite_callback ; invoke callback - widget_put_text_widget + if_settext iload 0 - widget_put_actions_null_widget - load_string "" + if_clearops + sconst "" sstore 0 - load_string "" + sconst "" sstore 1 - get_ismembers - load_int 1 + map_members + iconst 1 if_icmpeq LABEL22 - get_varc 103 - load_int 1 + get_varc_int 103 + iconst 1 if_icmpeq LABEL22 jump LABEL28 LABEL22: - load_string "Total XP:" + sconst "Total XP:" sstore 0 invoke 1008 invoke 1009 sstore 1 jump LABEL37 LABEL28: - load_string "Total XP:|Free Total Level:" + sconst "Total XP:|Free Total Level:" sstore 0 invoke 1008 invoke 1009 - load_string "|" + sconst "|" invoke 1320 - int_to_string - string_append 3 + tostring + join_string 3 sstore 1 LABEL37: invoke 1972 - load_int 1 + iconst 1 if_icmpeq LABEL41 jump LABEL72 LABEL41: - load_int 1 - load_string "Toggle Total XP" + iconst 1 + sconst "Toggle Total XP" iload 0 - widget_put_action_widget - load_int 2367 - load_int -2147483644 - load_int -2147483645 - load_int -1 + if_setop + iconst 2367 + iconst -2147483644 + iconst -2147483645 + iconst -1 iload 1 sload 0 sload 1 - load_int 495 - load_string "iIiIssf" + iconst 495 + sconst "iIiIssf" iload 0 - widget_put_option_click_listener_widget - get_varc 218 + if_setonop + get_varc_int 218 iload 0 if_icmpeq LABEL60 jump LABEL71 LABEL60: - get_varc 217 - load_int -1 + get_varc_int 217 + iconst -1 if_icmpeq LABEL64 jump LABEL71 LABEL64: iload 0 - load_int -1 + iconst -1 iload 1 sload 0 sload 1 - load_int 495 + iconst 495 invoke 2344 LABEL71: jump LABEL92 LABEL72: - load_int 992 - load_int -2147483645 - load_int -1 + iconst 992 + iconst -2147483645 + iconst -1 iload 1 sload 0 sload 1 - load_int 495 - load_int 25 - load_int 5 - idiv - load_string "IiIssfi" + iconst 495 + iconst 25 + iconst 5 + div + sconst "IiIssfi" iload 0 - widget_put_mouse_hover_listener_widget - load_int 40 + if_setonmouserepeat + iconst 40 iload 1 - load_string "I" + sconst "I" iload 0 - widget_put_mouse_exit_listener_widget - load_int 0 - put_varc 2 + if_setonmouseleave + iconst 0 + set_varc_int 2 LABEL92: return diff --git a/runelite-client/src/main/scripts/TriggerBankLayout.rs2asm b/runelite-client/src/main/scripts/TriggerBankLayout.rs2asm index 4b739a959c..a9fd094407 100644 --- a/runelite-client/src/main/scripts/TriggerBankLayout.rs2asm +++ b/runelite-client/src/main/scripts/TriggerBankLayout.rs2asm @@ -5,24 +5,24 @@ .string_var_count 0 ; Check if we should allow server to relayout bank - load_int 1 ; true - load_int 0 ; load active boolean - load_string "getSearchingTagTab" ; push event name - runelite_callback ; invoke callback + iconst 1 ; true + iconst 0 ; load active boolean + sconst "getSearchingTagTab" ; push event name + runelite_callback ; invoke callback if_icmpne LABEL2 ; Let layout continue if current bank tab is 0 get_varbit 4150 - load_int 0 + iconst 0 if_icmpeq LABEL2 ; Reset the current bank tab to 0 otherwise - load_int 0 + iconst 0 set_varbit 4150 - load_string "Server attempted to reset bank tab." - load_string "debug" - runelite_callback + sconst "Server attempted to reset bank tab." + sconst "debug" + runelite_callback LABEL2: iload 0 @@ -39,4 +39,4 @@ LABEL2: iload 11 iload 12 invoke 277 - return + return diff --git a/runelite-client/src/main/scripts/ZoomHandler.rs2asm b/runelite-client/src/main/scripts/ZoomHandler.rs2asm index b19086168e..5ff5fa6fe6 100644 --- a/runelite-client/src/main/scripts/ZoomHandler.rs2asm +++ b/runelite-client/src/main/scripts/ZoomHandler.rs2asm @@ -4,88 +4,88 @@ .int_var_count 6 .string_var_count 0 get_varbit 4606 - load_int 0 + iconst 0 if_icmpne LABEL4 jump LABEL5 LABEL4: return LABEL5: - load_int 896 - load_string "innerZoomLimit" + iconst 896 + sconst "innerZoomLimit" runelite_callback iload 0 invoke 1046 istore 0 - load_int 128 - load_string "outerZoomLimit" - runelite_callback + iconst 128 + sconst "outerZoomLimit" + runelite_callback iload 0 invoke 1045 istore 0 - load_int 896 - load_string "innerZoomLimit" + iconst 896 + sconst "innerZoomLimit" runelite_callback iload 1 invoke 1046 istore 1 - load_int 128 - load_string "outerZoomLimit" - runelite_callback + iconst 128 + sconst "outerZoomLimit" + runelite_callback iload 1 invoke 1045 istore 1 iload 0 iload 1 - 6200 - load_int 0 + viewport_setfov + iconst 0 istore 2 - load_int 0 + iconst 0 istore 3 - get_viewport_size + viewport_geteffectivesize istore 3 istore 2 iload 3 - load_int 334 - isub + iconst 334 + sub istore 4 iload 4 - load_int 0 + iconst 0 if_icmplt LABEL39 jump LABEL42 LABEL39: - load_int 0 + iconst 0 istore 4 jump LABEL48 LABEL42: iload 4 - load_int 100 + iconst 100 if_icmpgt LABEL46 jump LABEL48 LABEL46: - load_int 100 + iconst 100 istore 4 LABEL48: iload 0 iload 1 iload 0 - isub + sub iload 4 - imul - load_int 100 - idiv - iadd + multiply + iconst 100 + div + add istore 5 - load_int 25 - load_int 25 + iconst 25 + iconst 25 iload 5 - imul - load_int 256 - idiv - iadd - set_camera_focal_point_height + multiply + iconst 256 + div + add + cam_setfollowheight iload 0 iload 1 - put_varc 74 - put_varc 73 + set_varc_int 74 + set_varc_int 73 invoke 1049 return diff --git a/runelite-client/src/main/scripts/null.rs2asm b/runelite-client/src/main/scripts/null.rs2asm index 81afec5354..6c402affd9 100644 --- a/runelite-client/src/main/scripts/null.rs2asm +++ b/runelite-client/src/main/scripts/null.rs2asm @@ -34,4 +34,4 @@ .int_var_count 0 .string_var_count 0 -return +return From 5420f874dbeb1ba70020e1efd8bc25c632cafd03 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sat, 16 Feb 2019 23:35:46 -0800 Subject: [PATCH 229/304] ground markers plugin: Clean up legacy code This includes various code quality improvements such as stronger access control, enforcing newlines at EOF, naming magic numbers and strings, and utilizing higher efficiency methods and class constructors. --- .../groundmarkers/GroundMarkerConfig.java | 1 - .../GroundMarkerInputListener.java | 2 +- .../groundmarkers/GroundMarkerOverlay.java | 6 ++-- .../groundmarkers/GroundMarkerPlugin.java | 32 +++++++++---------- .../groundmarkers/GroundMarkerPoint.java | 5 ++- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java index d77f3ab9f5..394ffcf81b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java @@ -23,7 +23,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package net.runelite.client.plugins.groundmarkers; import java.awt.Color; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java index 3b87dd1802..a097d47d29 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java @@ -64,4 +64,4 @@ public class GroundMarkerInputListener implements KeyListener plugin.setHotKeyPressed(false); } } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java index ccd6fd7483..d2b64a81d0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java @@ -42,6 +42,8 @@ import net.runelite.client.ui.overlay.OverlayUtil; public class GroundMarkerOverlay extends Overlay { + private static final int MAX_DRAW_DISTANCE = 32; + private final Client client; private final GroundMarkerConfig config; private final GroundMarkerPlugin plugin; @@ -78,7 +80,7 @@ public class GroundMarkerOverlay extends Overlay { WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - if (point.distanceTo(playerLocation) >= 32) + if (point.distanceTo(playerLocation) >= MAX_DRAW_DISTANCE) { return; } @@ -97,4 +99,4 @@ public class GroundMarkerOverlay extends Overlay OverlayUtil.renderPolygon(graphics, poly, config.markerColor()); } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 2cb7ebf1c2..3de2295913 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -69,8 +69,9 @@ public class GroundMarkerPlugin extends Plugin private static final String CONFIG_GROUP = "groundMarker"; private static final String MARK = "Mark tile"; private static final String WALK_HERE = "Walk here"; + private static final String REGION_PREFIX = "region_"; - private static final Gson gson = new Gson(); + private static final Gson GSON = new Gson(); @Getter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE) @@ -101,22 +102,22 @@ public class GroundMarkerPlugin extends Plugin { if (points == null || points.isEmpty()) { - configManager.unsetConfiguration(CONFIG_GROUP, "region_" + regionId); + configManager.unsetConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); return; } - String json = gson.toJson(points); - configManager.setConfiguration(CONFIG_GROUP, "region_" + regionId, json); + String json = GSON.toJson(points); + configManager.setConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId, json); } private Collection getPoints(int regionId) { - String json = configManager.getConfiguration(CONFIG_GROUP, "region_" + regionId); + String json = configManager.getConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); if (Strings.isNullOrEmpty(json)) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } - return gson.fromJson(json, new TypeToken>() + return GSON.fromJson(json, new TypeToken>() { }.getType()); } @@ -152,7 +153,7 @@ public class GroundMarkerPlugin extends Plugin { if (points.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } return points.stream() @@ -243,8 +244,7 @@ public class GroundMarkerPlugin extends Plugin keyManager.unregisterKeyListener(inputListener); } - - protected void markTile(LocalPoint localPoint) + private void markTile(LocalPoint localPoint) { if (localPoint == null) { @@ -257,18 +257,18 @@ public class GroundMarkerPlugin extends Plugin GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getX() & 0x3f, worldPoint.getY() & 0x3f, client.getPlane()); log.debug("Updating point: {} - {}", point, worldPoint); - List points = new ArrayList<>(getPoints(regionId)); - if (points.contains(point)) + List groundMarkerPoints = new ArrayList<>(getPoints(regionId)); + if (groundMarkerPoints.contains(point)) { - points.remove(point); + groundMarkerPoints.remove(point); } else { - points.add(point); + groundMarkerPoints.add(point); } - savePoints(regionId, points); + savePoints(regionId, groundMarkerPoints); loadPoints(); } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java index b31db32222..396a2217cb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java @@ -23,16 +23,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package net.runelite.client.plugins.groundmarkers; import lombok.Value; @Value -public class GroundMarkerPoint +class GroundMarkerPoint { private int regionId; private int regionX; private int regionY; private int z; -} \ No newline at end of file +} From 15fbbdd7863866b805a8d8ffd0d3d0254331a5f5 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sun, 17 Feb 2019 19:43:49 -0800 Subject: [PATCH 230/304] ground markers: Fix startup and shutdown bug When logging in to the game with the plugin disabled, enabling it will not cause points to be filled, as the game state trigger will not be reached. This commit properly loads points on plugin startup and clears them on shutdown. --- .../client/plugins/groundmarkers/GroundMarkerPlugin.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 3de2295913..292574c452 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -133,6 +133,12 @@ public class GroundMarkerPlugin extends Plugin points.clear(); int[] regions = client.getMapRegions(); + + if (regions == null) + { + return; + } + for (int regionId : regions) { // load points for region @@ -235,6 +241,7 @@ public class GroundMarkerPlugin extends Plugin { overlayManager.add(overlay); keyManager.registerKeyListener(inputListener); + loadPoints(); } @Override @@ -242,6 +249,7 @@ public class GroundMarkerPlugin extends Plugin { overlayManager.remove(overlay); keyManager.unregisterKeyListener(inputListener); + points.clear(); } private void markTile(LocalPoint localPoint) From a18827f92938f28a2c0b56344b223f26e0c2fc7a Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sun, 17 Feb 2019 19:26:56 -0800 Subject: [PATCH 231/304] worldpoint: Add static fromRegion method --- .../main/java/net/runelite/api/coords/WorldPoint.java | 11 +++++++++++ .../plugins/groundmarkers/GroundMarkerPlugin.java | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index 2ddf7e4198..fc73be636c 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -326,4 +326,15 @@ public class WorldPoint { return ((x >> 6) << 8) | (y >> 6); } + + /** + * Converts the passed region ID and coordinates to a world coordinate + */ + public static WorldPoint fromRegion(int regionId, int regionX, int regionY, int plane) + { + return new WorldPoint( + ((regionId >>> 8) << 6) + regionX, + ((regionId & 0xff) << 6) + regionY, + plane); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 292574c452..c7916146d7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -170,12 +170,7 @@ public class GroundMarkerPlugin extends Plugin int regionY = point.getRegionY(); int z = point.getZ(); - // world point of the tile marker - return new WorldPoint( - ((regionId >>> 8) << 6) + regionX, - ((regionId & 0xff) << 6) + regionY, - z - ); + return WorldPoint.fromRegion(regionId, regionX, regionY, z); }) .flatMap(wp -> WorldPoint.toLocalInstance(client, wp).stream()) .collect(Collectors.toList()); From 191feb94f6ceba1581eb513f073aa3aa9d41d938 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Mon, 18 Feb 2019 19:11:24 -0800 Subject: [PATCH 232/304] worldpoint: Add getRegionX() and getRegionY() --- .../net/runelite/api/coords/WorldPoint.java | 21 +++++++++++++++++++ .../groundmarkers/GroundMarkerPlugin.java | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index fc73be636c..bbacd1914a 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -337,4 +337,25 @@ public class WorldPoint ((regionId & 0xff) << 6) + regionY, plane); } + + /** + * Gets the X-axis coordinate of the region coordinate + */ + public int getRegionX() + { + return getRegionOffset(x); + } + + /** + * Gets the Y-axis coordinate of the region coordinate + */ + public int getRegionY() + { + return getRegionOffset(y); + } + + private static int getRegionOffset(final int position) + { + return position & 0x3f; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index c7916146d7..780158f96d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -257,7 +257,7 @@ public class GroundMarkerPlugin extends Plugin WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint); int regionId = worldPoint.getRegionID(); - GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getX() & 0x3f, worldPoint.getY() & 0x3f, client.getPlane()); + GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane()); log.debug("Updating point: {} - {}", point, worldPoint); List groundMarkerPoints = new ArrayList<>(getPoints(regionId)); From 11b578b7c25445778239859c56bf5f794be08adf Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sun, 17 Feb 2019 19:28:16 -0800 Subject: [PATCH 233/304] ground markers: Allow different colored markers This adds a color indicator per marker, saved to config, allowing multiple markers to be different colors. In addition, a configuration option is added to switch between per-tile color display or current configured color display. (that is, new or existing behavior) This change will set a color in config for old markers with null colors when those markers are loaded. Fixes runelite/runelite#3395 --- .../groundmarkers/ColorTileMarker.java | 40 ++++++++++++++++++ .../groundmarkers/GroundMarkerConfig.java | 10 +++++ .../groundmarkers/GroundMarkerOverlay.java | 23 +++++++---- .../groundmarkers/GroundMarkerPlugin.java | 41 ++++++++++--------- .../groundmarkers/GroundMarkerPoint.java | 7 ++++ 5 files changed, 95 insertions(+), 26 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java new file mode 100644 index 0000000000..6a6a30a065 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/ColorTileMarker.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.groundmarkers; + +import java.awt.Color; +import lombok.Value; +import net.runelite.api.coords.WorldPoint; + +/** + * Used to denote marked tiles and their colors. + * Note: This is not used for serialization of ground markers; see {@link GroundMarkerPoint} + */ +@Value +class ColorTileMarker +{ + private WorldPoint worldPoint; + private Color color; +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java index 394ffcf81b..ba8cb98e14 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java @@ -44,4 +44,14 @@ public interface GroundMarkerConfig extends Config { return Color.YELLOW; } + + @ConfigItem( + keyName = "rememberTileColors", + name = "Remember color per tile", + description = "Color tiles using the color from time of placement" + ) + default boolean rememberTileColors() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java index d2b64a81d0..768d90b51b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java @@ -25,10 +25,11 @@ */ package net.runelite.client.plugins.groundmarkers; +import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Polygon; -import java.util.List; +import java.util.Collection; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.Perspective; @@ -62,21 +63,29 @@ public class GroundMarkerOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - List points = plugin.getPoints(); - for (WorldPoint point : points) + final Collection points = plugin.getPoints(); + for (final ColorTileMarker point : points) { - if (point.getPlane() != client.getPlane()) + WorldPoint worldPoint = point.getWorldPoint(); + if (worldPoint.getPlane() != client.getPlane()) { continue; } - drawTile(graphics, point); + Color tileColor = point.getColor(); + if (tileColor == null || !config.rememberTileColors()) + { + // If this is an old tile which has no color, or rememberTileColors is off, use marker color + tileColor = config.markerColor(); + } + + drawTile(graphics, worldPoint, tileColor); } return null; } - private void drawTile(Graphics2D graphics, WorldPoint point) + private void drawTile(Graphics2D graphics, WorldPoint point, Color color) { WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); @@ -97,6 +106,6 @@ public class GroundMarkerOverlay extends Overlay return; } - OverlayUtil.renderPolygon(graphics, poly, config.markerColor()); + OverlayUtil.renderPolygon(graphics, poly, color); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 780158f96d..40e7ff72cf 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -78,11 +78,14 @@ public class GroundMarkerPlugin extends Plugin private boolean hotKeyPressed; @Getter(AccessLevel.PACKAGE) - private final List points = new ArrayList<>(); + private final List points = new ArrayList<>(); @Inject private Client client; + @Inject + private GroundMarkerConfig config; + @Inject private GroundMarkerInputListener inputListener; @@ -117,9 +120,10 @@ public class GroundMarkerPlugin extends Plugin { return Collections.emptyList(); } - return GSON.fromJson(json, new TypeToken>() - { - }.getType()); + + // CHECKSTYLE:OFF + return GSON.fromJson(json, new TypeToken>(){}.getType()); + // CHECKSTYLE:ON } @Provides @@ -144,18 +148,19 @@ public class GroundMarkerPlugin extends Plugin // load points for region log.debug("Loading points for region {}", regionId); Collection regionPoints = getPoints(regionId); - Collection worldPoints = translateToWorld(regionPoints); - points.addAll(worldPoints); + Collection colorTileMarkers = translateToColorTileMarker(regionPoints); + points.addAll(colorTileMarkers); } } /** - * Translate a collection of ground marker points to world points, accounting for instances + * Translate a collection of ground marker points to color tile markers, accounting for instances * - * @param points - * @return + * @param points {@link GroundMarkerPoint}s to be converted to {@link ColorTileMarker}s + * @return A collection of color tile markers, converted from the passed ground marker points, accounting for local + * instance points. See {@link WorldPoint#toLocalInstance(Client, WorldPoint)} */ - private Collection translateToWorld(Collection points) + private Collection translateToColorTileMarker(Collection points) { if (points.isEmpty()) { @@ -163,16 +168,14 @@ public class GroundMarkerPlugin extends Plugin } return points.stream() - .map(point -> + .map(point -> new ColorTileMarker( + WorldPoint.fromRegion(point.getRegionId(), point.getRegionX(), point.getRegionY(), point.getZ()), + point.getColor())) + .flatMap(colorTile -> { - int regionId = point.getRegionId(); - int regionX = point.getRegionX(); - int regionY = point.getRegionY(); - int z = point.getZ(); - - return WorldPoint.fromRegion(regionId, regionX, regionY, z); + final Collection localWorldPoints = WorldPoint.toLocalInstance(client, colorTile.getWorldPoint()); + return localWorldPoints.stream().map(wp -> new ColorTileMarker(wp, colorTile.getColor())); }) - .flatMap(wp -> WorldPoint.toLocalInstance(client, wp).stream()) .collect(Collectors.toList()); } @@ -257,7 +260,7 @@ public class GroundMarkerPlugin extends Plugin WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint); int regionId = worldPoint.getRegionID(); - GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane()); + GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), config.markerColor()); log.debug("Updating point: {} - {}", point, worldPoint); List groundMarkerPoints = new ArrayList<>(getPoints(regionId)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java index 396a2217cb..3e10a654c0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java @@ -25,13 +25,20 @@ */ package net.runelite.client.plugins.groundmarkers; +import java.awt.Color; +import lombok.EqualsAndHashCode; import lombok.Value; +/** + * Used for serialization of ground marker points. + */ @Value +@EqualsAndHashCode(exclude = { "color" }) class GroundMarkerPoint { private int regionId; private int regionX; private int regionY; private int z; + private Color color; } From 840bbeb2b0321516b5592b3fd29306e47ba7a95e Mon Sep 17 00:00:00 2001 From: Nate Brown Date: Sun, 10 Mar 2019 13:39:33 -0400 Subject: [PATCH 234/304] Change Chaos Fanatic's slayer task icon to match respawn timer icon (#8162) --- .../src/main/java/net/runelite/client/plugins/slayer/Task.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java index 594038aa27..5f2c7d3c2d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java @@ -65,7 +65,7 @@ enum Task CAVE_SLIMES("Cave slimes", ItemID.SWAMP_CAVE_SLIME), CERBERUS("Cerberus", ItemID.HELLPUPPY), CHAOS_ELEMENTAL("Chaos Elemental", ItemID.PET_CHAOS_ELEMENTAL), - CHAOS_FANATIC("Chaos Fanatic", ItemID.PET_CHAOS_ELEMENTAL), + CHAOS_FANATIC("Chaos Fanatic", ItemID.ANCIENT_STAFF), COCKATRICE("Cockatrice", ItemID.COCKATRICE, "Cockathrice"), COWS("Cows", ItemID.COW_MASK), CRAWLING_HANDS("Crawling hands", ItemID.CRAWLING_HAND, "Crushing hand"), From 9327d9704cc5b0384feb484f9297e54c3e42e1e1 Mon Sep 17 00:00:00 2001 From: Seven-Ate <48371716+Seven-Ate@users.noreply.github.com> Date: Sun, 10 Mar 2019 19:09:03 -0400 Subject: [PATCH 235/304] Add missing item mappings for hydra slayer helm --- .../src/main/java/net/runelite/client/game/ItemMapping.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java index 5eda167c17..f866d199ce 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java @@ -195,7 +195,7 @@ public enum ItemMapping BLACK_MASK, BLACK_MASK_I, BLACK_MASK_1, BLACK_MASK_1_I, BLACK_MASK_2, BLACK_MASK_2_I, BLACK_MASK_3, BLACK_MASK_3_I, BLACK_MASK_4, BLACK_MASK_4_I, BLACK_MASK_5, BLACK_MASK_5_I, BLACK_MASK_6, BLACK_MASK_6_I, BLACK_MASK_7, BLACK_MASK_7_I, BLACK_MASK_8, BLACK_MASK_8_I, BLACK_MASK_9, BLACK_MASK_9_I, BLACK_MASK_10_I, SLAYER_HELMET, SLAYER_HELMET_I, BLACK_SLAYER_HELMET, BLACK_SLAYER_HELMET_I, PURPLE_SLAYER_HELMET, PURPLE_SLAYER_HELMET_I, RED_SLAYER_HELMET, RED_SLAYER_HELMET_I, - GREEN_SLAYER_HELMET, GREEN_SLAYER_HELMET_I, TURQUOISE_SLAYER_HELMET, TURQUOISE_SLAYER_HELMET_I), + GREEN_SLAYER_HELMET, GREEN_SLAYER_HELMET_I, TURQUOISE_SLAYER_HELMET, TURQUOISE_SLAYER_HELMET_I, HYDRA_SLAYER_HELMET, HYDRA_SLAYER_HELMET_I), // Pharaoh's Sceptres ITEM_PHARAOHS_SCEPTRE_1(PHARAOHS_SCEPTRE, PHARAOHS_SCEPTRE_1), From 6371a7dd0b0d49259e2a3326c62e1f3e2c0f28ac Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Mar 2019 09:04:33 -0400 Subject: [PATCH 236/304] config manager: throttle config saves to file When the default config is applied it queues a lot of saves to disk that are unnecessary --- .../runelite/client/config/ConfigManager.java | 45 ++++++++----------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 54318b887a..dc3fc07e41 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -99,6 +99,9 @@ public class ConfigManager public final void switchSession(AccountSession session) { + // Ensure existing config is saved + sendConfig(); + if (session == null) { this.session = null; @@ -315,7 +318,7 @@ public class ConfigManager } } - private synchronized void saveToFile(final File propertiesFile) throws IOException + private void saveToFile(final File propertiesFile) throws IOException { propertiesFile.getParentFile().mkdirs(); @@ -392,19 +395,6 @@ public class ConfigManager pendingChanges.put(groupName + "." + key, value); } - Runnable task = () -> - { - try - { - saveToFile(propertiesFile); - } - catch (IOException ex) - { - log.warn("unable to save configuration file", ex); - } - }; - executor.execute(task); - ConfigChanged configChanged = new ConfigChanged(); configChanged.setGroup(groupName); configChanged.setKey(key); @@ -435,19 +425,6 @@ public class ConfigManager pendingChanges.put(groupName + "." + key, null); } - Runnable task = () -> - { - try - { - saveToFile(propertiesFile); - } - catch (IOException ex) - { - log.warn("unable to save configuration file", ex); - } - }; - executor.execute(task); - ConfigChanged configChanged = new ConfigChanged(); configChanged.setGroup(groupName); configChanged.setKey(key); @@ -653,6 +630,7 @@ public class ConfigManager public void sendConfig() { + boolean changed; synchronized (pendingChanges) { if (client != null) @@ -672,7 +650,20 @@ public class ConfigManager } } } + changed = !pendingChanges.isEmpty(); pendingChanges.clear(); } + + if (changed) + { + try + { + saveToFile(propertiesFile); + } + catch (IOException ex) + { + log.warn("unable to save configuration file", ex); + } + } } } From e73b969a4f5acd3cfa9e9fc70bab4dff071e6000 Mon Sep 17 00:00:00 2001 From: trimbe Date: Fri, 14 Dec 2018 13:24:56 -0500 Subject: [PATCH 237/304] add GE offer building script --- .../src/main/scripts/GEOffersSetupInit.hash | 1 + .../src/main/scripts/GEOffersSetupInit.rs2asm | 392 ++++++++++++++++++ 2 files changed, 393 insertions(+) create mode 100644 runelite-client/src/main/scripts/GEOffersSetupInit.hash create mode 100644 runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm diff --git a/runelite-client/src/main/scripts/GEOffersSetupInit.hash b/runelite-client/src/main/scripts/GEOffersSetupInit.hash new file mode 100644 index 0000000000..689d72d678 --- /dev/null +++ b/runelite-client/src/main/scripts/GEOffersSetupInit.hash @@ -0,0 +1 @@ +B370DDEEF61E0F420C1990DDA4FBBEDCEE8324F3750ABAC79B072A27268D887B \ No newline at end of file diff --git a/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm b/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm new file mode 100644 index 0000000000..422b76a7f7 --- /dev/null +++ b/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm @@ -0,0 +1,392 @@ +.id 779 +.int_stack_count 15 +.string_stack_count 0 +.int_var_count 16 +.string_var_count 1 + get_varbit 4397 + iconst 1 + if_icmpeq LABEL4 + jump LABEL65 +LABEL4: + iload 0 + iload 1 + cc_find + iconst 1 + if_icmpeq LABEL10 + jump LABEL12 +LABEL10: + iconst 1 + cc_sethide +LABEL12: + iload 0 + iload 6 + cc_find + iconst 1 + if_icmpeq LABEL18 + jump LABEL23 +LABEL18: + iconst 0 + cc_settrans + iconst -1 + sconst "" + cc_setontimer +LABEL23: + iload 0 + iload 12 + cc_find + iconst 1 + if_icmpeq LABEL29 + jump LABEL31 +LABEL29: + iconst 1 + cc_sethide +LABEL31: + iload 0 + iload 4 + cc_find + iconst 1 + if_icmpeq LABEL37 + jump LABEL39 +LABEL37: + sconst "Sell offer" + cc_settext +LABEL39: + iload 0 + iload 5 + cc_find + iconst 1 + if_icmpeq LABEL45 + jump LABEL47 +LABEL45: + iconst 1119 + cc_setgraphic +LABEL47: + iload 0 + iload 2 + cc_find + iconst 1 + if_icmpeq LABEL53 + jump LABEL56 +LABEL53: + iconst 1 + sconst "All" + cc_setop +LABEL56: + iload 0 + iload 3 + cc_find + iconst 1 + if_icmpeq LABEL62 + jump LABEL64 +LABEL62: + sconst "All" + cc_settext +LABEL64: + jump LABEL130 +LABEL65: + iload 0 + iload 1 + cc_find + iconst 1 + if_icmpeq LABEL71 + jump LABEL73 +LABEL71: + iconst 0 + cc_sethide +LABEL73: + iload 0 + iload 6 + cc_find + iconst 1 + if_icmpeq LABEL79 + jump LABEL89 +LABEL79: + iconst 100 + cc_settrans + iconst 811 + iconst -2147483645 + iconst -2147483643 + clientclock + iconst 100 + iconst 250 + sconst "Iiiii" + cc_setontimer +LABEL89: + iload 0 + iload 12 + cc_find + iconst 1 + if_icmpeq LABEL95 + jump LABEL97 +LABEL95: + iconst 0 + cc_sethide +LABEL97: + iload 0 + iload 4 + cc_find + iconst 1 + if_icmpeq LABEL103 + jump LABEL105 +LABEL103: + sconst "Buy offer" + cc_settext +LABEL105: + iload 0 + iload 5 + cc_find + iconst 1 + if_icmpeq LABEL111 + jump LABEL113 +LABEL111: + iconst 1118 + cc_setgraphic +LABEL113: + iload 0 + iload 2 + cc_find + iconst 1 + if_icmpeq LABEL119 + jump LABEL122 +LABEL119: + iconst 1 + sconst "+1K" + cc_setop +LABEL122: + iload 0 + iload 3 + cc_find + iconst 1 + if_icmpeq LABEL128 + jump LABEL130 +LABEL128: + sconst "+1K" + cc_settext +LABEL130: + sconst "," + sstore 0 + iconst 0 + istore 15 + get_varp 1151 + iconst -1 + if_icmpne LABEL138 + jump LABEL274 +LABEL138: + iload 0 + iload 7 + cc_find + iconst 1 + if_icmpeq LABEL144 + jump LABEL147 +LABEL144: + get_varp 1151 + get_varbit 4396 + cc_setobject_nonum +LABEL147: + iload 0 + iload 8 + cc_find + iconst 1 + if_icmpeq LABEL153 + jump LABEL156 +LABEL153: + get_varp 1151 + oc_name + cc_settext +LABEL156: + iload 0 + iload 9 + cc_find + iconst 1 + if_icmpeq LABEL162 + jump LABEL166 +LABEL162: + get_varbit 4396 + sload 0 + invoke 46 + cc_settext +LABEL166: + iload 0 + iload 10 + cc_find + iconst 1 + if_icmpeq LABEL172 + jump LABEL185 +LABEL172: + get_varbit 4398 + iconst 1 + if_icmpeq LABEL176 + jump LABEL179 +LABEL176: + sconst "1 coin" + cc_settext + jump LABEL185 +LABEL179: + get_varbit 4398 + sload 0 + invoke 46 + sconst " coins" + join_string 2 + cc_settext +LABEL185: + get_varbit 4396 + iconst 0 + if_icmpgt LABEL189 + jump LABEL211 +LABEL189: + iconst 2147483647 + get_varbit 4396 + div + get_varbit 4398 + if_icmplt LABEL195 + jump LABEL211 +LABEL195: + iload 0 + iload 11 + cc_find + iconst 1 + if_icmpeq LABEL201 + jump LABEL206 +LABEL201: + sconst "" + sconst "Too much money!" + sconst "" + join_string 3 + cc_settext +LABEL206: + iload 0 + iload 14 + iload 13 + invoke 780 + jump LABEL273 +LABEL211: + get_varbit 4396 + get_varbit 4398 + multiply + istore 15 + iload 0 + iload 11 + cc_find + iconst 1 + if_icmpeq LABEL221 + jump LABEL234 +LABEL221: + iload 15 + iconst 1 + if_icmpeq LABEL225 + jump LABEL228 +LABEL225: + sconst "1 coin" + cc_settext + jump LABEL234 +LABEL228: + iload 15 + sload 0 + invoke 46 + sconst " coins" + join_string 2 + cc_settext +LABEL234: + iload 15 + iconst 0 + if_icmpgt LABEL238 + jump LABEL269 +LABEL238: + iload 13 + invoke 208 + pop_int + iconst 772 + iconst -2147483645 + sconst "I" + iload 13 + if_setonmouserepeat + iconst 97 + iconst -2147483645 + sconst "I" + iload 13 + if_setonmouseleave + iconst 489 + iconst -2147483644 + iconst 2 + sconst "ii" + iload 13 + if_setonop + iload 0 + iload 14 + cc_find + iconst 1 + if_icmpeq LABEL263 + jump LABEL268 +LABEL263: + sconst "" + sconst "Confirm" + sconst "" + join_string 3 + cc_settext +LABEL268: + jump LABEL273 +LABEL269: + iload 0 + iload 14 + iload 13 + invoke 780 +LABEL273: + jump LABEL319 +LABEL274: + iload 0 + iload 7 + cc_find + iconst 1 + if_icmpeq LABEL280 + jump LABEL283 +LABEL280: + iconst 6512 + iconst 1 + cc_setobject_nonum +LABEL283: + iload 0 + iload 8 + cc_find + iconst 1 + if_icmpeq LABEL289 + jump LABEL291 +LABEL289: + sconst "Choose an item..." + cc_settext +LABEL291: + iload 0 + iload 9 + cc_find + iconst 1 + if_icmpeq LABEL297 + jump LABEL299 +LABEL297: + sconst "" + cc_settext +LABEL299: + iload 0 + iload 10 + cc_find + iconst 1 + if_icmpeq LABEL305 + jump LABEL307 +LABEL305: + sconst "" + cc_settext +LABEL307: + iload 0 + iload 11 + cc_find + iconst 1 + if_icmpeq LABEL313 + jump LABEL315 +LABEL313: + sconst "" + cc_settext +LABEL315: + iload 0 + iload 14 + iload 13 + invoke 780 +LABEL319: + return From d617d1960ffa9bc50aab478b3c4bef5ce9d35e7c Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Mar 2019 18:17:16 -0400 Subject: [PATCH 238/304] friend notes: replace nbsp from friend names in config keys --- .../friendnotes/FriendNotesPlugin.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java index beb56a171f..75cc26163c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java @@ -167,7 +167,7 @@ public class FriendNotesPlugin extends Plugin if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message")) { // Friends have color tags - setHoveredFriend(Text.removeTags(event.getTarget())); + setHoveredFriend(Text.toJagexName(Text.removeTags(event.getTarget()))); // Build "Add Note" or "Edit Note" menu entry final MenuEntry addNote = new MenuEntry(); @@ -197,13 +197,13 @@ public class FriendNotesPlugin extends Plugin return; } - //Friends have color tags - final String sanitizedTarget = Text.removeTags(event.getMenuTarget()); - // Handle clicks on "Add Note" or "Edit Note" if (event.getMenuOption().equals(ADD_NOTE) || event.getMenuOption().equals(EDIT_NOTE)) { event.consume(); + + //Friends have color tags + final String sanitizedTarget = Text.toJagexName(Text.removeTags(event.getMenuTarget())); final String note = getFriendNote(sanitizedTarget); // Open the new chatbox input dialog @@ -234,7 +234,16 @@ public class FriendNotesPlugin extends Plugin { // Migrate a friend's note to their new display name final Friend friend = (Friend) nameable; - migrateFriendNote(friend.getName(), friend.getPrevName()); + String name = friend.getName(); + String prevName = friend.getPrevName(); + + if (prevName != null) + { + migrateFriendNote( + Text.toJagexName(name), + Text.toJagexName(prevName) + ); + } } } @@ -242,7 +251,7 @@ public class FriendNotesPlugin extends Plugin public void onRemovedFriend(RemovedFriend event) { // Delete a friend's note if they are removed - final String displayName = event.getName(); + final String displayName = Text.toJagexName(event.getName()); log.debug("Remove friend: '{}'", displayName); setFriendNote(displayName, null); } From 5f0b7313379737149088545c8363ec943a810dc7 Mon Sep 17 00:00:00 2001 From: Dennis Date: Tue, 12 Mar 2019 01:37:26 +0100 Subject: [PATCH 239/304] wiki plugin: add deselect on shutdown --- .../java/net/runelite/client/plugins/wiki/WikiPlugin.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index aaf6a084e9..afbc30b766 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -131,6 +131,9 @@ public class WikiPlugin extends Plugin return; } children[0] = null; + + onDeselect(); + client.setSpellSelected(false); }); } @@ -186,7 +189,10 @@ public class WikiPlugin extends Plugin private void onDeselect() { wikiSelected = false; - icon.setSpriteId(WikiSprite.WIKI_ICON.getSpriteId()); + if (icon != null) + { + icon.setSpriteId(WikiSprite.WIKI_ICON.getSpriteId()); + } } @Subscribe From 0562e9e49e38007a7f2ea95143990e623fb45464 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 12 Mar 2019 08:29:16 -0400 Subject: [PATCH 240/304] chat commands: check message length before use If we don't check the length of the message before we access it with substring(command.length() + 1) we will get a string index out of range error. Co-authored-by: Paul Wendelboe --- .../chatcommands/ChatCommandsPlugin.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 7295577e34..e7e22cdae3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -366,6 +366,11 @@ public class ChatCommandsPlugin extends Plugin return; } + if (message.length() <= KILLCOUNT_COMMAND_STRING.length()) + { + return; + } + ChatMessageType type = chatMessage.getType(); String search = message.substring(KILLCOUNT_COMMAND_STRING.length() + 1); @@ -483,6 +488,11 @@ public class ChatCommandsPlugin extends Plugin return; } + if (message.length() <= PB_COMMAND.length()) + { + return; + } + ChatMessageType type = chatMessage.getType(); String search = message.substring(PB_COMMAND.length() + 1); @@ -574,6 +584,11 @@ public class ChatCommandsPlugin extends Plugin return; } + if (message.length() <= PRICE_COMMAND_STRING.length()) + { + return; + } + MessageNode messageNode = chatMessage.getMessageNode(); String search = message.substring(PRICE_COMMAND_STRING.length() + 1); @@ -637,6 +652,11 @@ public class ChatCommandsPlugin extends Plugin } else { + if (message.length() <= LEVEL_COMMAND_STRING.length()) + { + return; + } + search = message.substring(LEVEL_COMMAND_STRING.length() + 1); } From 60b3ed18c076885bc4591307ddb010d69a967c04 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Mar 2019 21:32:10 -0400 Subject: [PATCH 241/304] xptracker: fix initiailizing overall xp on login The isInitialized() check was not strict enough causing the xp events on login being calculated twords gained xp Also fix xp tracker not being initialized on accounts with 0 construction exp due to the result of updateSkill not being INITIALIZED Closes #8167 --- .../java/net/runelite/client/plugins/xptracker/XpState.java | 5 +++-- .../runelite/client/plugins/xptracker/XpTrackerPlugin.java | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java index d6a10df1b8..16602b0cb4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java @@ -79,7 +79,7 @@ class XpState if (state.getStartXp() == -1) { - if (currentXp > 0) + if (currentXp >= 0) { initializeSkill(skill, currentXp); return XpUpdateResult.INITIALIZED; @@ -198,7 +198,8 @@ class XpState boolean isInitialized(Skill skill) { - return xpSkills.containsKey(skill); + XpStateSingle xpStateSingle = xpSkills.get(skill); + return xpStateSingle != null && xpStateSingle.getStartXp() != -1; } @NonNull diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java index c66c409a16..f72bcd12f2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java @@ -305,7 +305,9 @@ public class XpTrackerPlugin extends Plugin if (skill == Skill.CONSTRUCTION && updateResult == XpUpdateResult.INITIALIZED) { // Construction is the last skill initialized on login, now initialize the total experience - xpState.initializeSkill(Skill.OVERALL, client.getOverallExperience()); + long overallXp = client.getOverallExperience(); + log.debug("Initializing XP tracker with {} overall exp", overallXp); + xpState.initializeSkill(Skill.OVERALL, overallXp); } else if (xpState.isInitialized(Skill.OVERALL)) { From 54912ca31c00f5e929ec5968f5326966c498fcae Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 2 Oct 2018 14:51:59 -0700 Subject: [PATCH 242/304] widgetinfo: Fix wilderness level definition --- .../src/main/java/net/runelite/api/widgets/WidgetInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 7808e06cba..bc8e6b3c36 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -446,7 +446,7 @@ public enum WidgetInfo PVP_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.PVP_WIDGET_CONTAINER), PVP_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL_CONTAINER), PVP_SKULL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL), - PVP_WILDERNESS_LEVEL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.ATTACK_RANGE), + PVP_WILDERNESS_LEVEL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.WILDERNESS_LEVEL), PVP_BOUNTY_HUNTER_INFO(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_INFO), PVP_BOUNTY_HUNTER_STATS(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_STATS), PVP_KILLDEATH_COUNTER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.KILLDEATH_RATIO), From 7a3b5dd3a9909894e9450a626134a9984be9616f Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Mon, 28 Jan 2019 19:37:38 -0800 Subject: [PATCH 243/304] Add pvp widget builder script --- .../src/main/scripts/PvpWidgetBuilder.hash | 1 + .../src/main/scripts/PvpWidgetBuilder.rs2asm | 117 ++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 runelite-client/src/main/scripts/PvpWidgetBuilder.hash create mode 100644 runelite-client/src/main/scripts/PvpWidgetBuilder.rs2asm diff --git a/runelite-client/src/main/scripts/PvpWidgetBuilder.hash b/runelite-client/src/main/scripts/PvpWidgetBuilder.hash new file mode 100644 index 0000000000..144ac0aea6 --- /dev/null +++ b/runelite-client/src/main/scripts/PvpWidgetBuilder.hash @@ -0,0 +1 @@ +08461B2A942D4D792EEB9D9BCCEB9B11256AD8B217B1EAF1BDBA71314F816D6F \ No newline at end of file diff --git a/runelite-client/src/main/scripts/PvpWidgetBuilder.rs2asm b/runelite-client/src/main/scripts/PvpWidgetBuilder.rs2asm new file mode 100644 index 0000000000..c7173c0632 --- /dev/null +++ b/runelite-client/src/main/scripts/PvpWidgetBuilder.rs2asm @@ -0,0 +1,117 @@ +.id 388 +.int_stack_count 1 +.string_stack_count 0 +.int_var_count 3 +.string_var_count 0 + invoke 384 + istore 1 + invoke 1138 + istore 2 + iload 2 + iconst 1 + if_icmpeq LABEL8 + jump LABEL74 +LABEL8: + get_varp 1676 + iconst 4 + if_icmpgt LABEL12 + jump LABEL31 +LABEL12: + iload 1 + iconst 0 + if_icmpgt LABEL16 + jump LABEL27 +LABEL16: + get_varbit 5954 + iconst 1 + if_icmpeq LABEL20 + jump LABEL27 +LABEL20: + sconst "Level: " + iload 1 + tostring + join_string 2 + iload 0 + if_settext + jump LABEL30 +LABEL27: + sconst "Deadman" + iload 0 + if_settext +LABEL30: + jump LABEL73 +LABEL31: + get_varbit 4965 + iconst 0 + if_icmpgt LABEL35 + jump LABEL39 +LABEL35: + sconst "Protection" + iload 0 + if_settext + jump LABEL73 +LABEL39: + iload 1 + iconst 0 + if_icmpgt LABEL43 + jump LABEL54 +LABEL43: + get_varbit 5954 + iconst 1 + if_icmpeq LABEL47 + jump LABEL54 +LABEL47: + sconst "Level: " + iload 1 + tostring + join_string 2 + iload 0 + if_settext + jump LABEL73 +LABEL54: + get_varc_int 78 + iconst 1 + if_icmpeq LABEL58 + jump LABEL62 +LABEL58: + sconst "Guarded" + iload 0 + if_settext + jump LABEL73 +LABEL62: + get_varc_int 78 + iconst 2 + if_icmpeq LABEL66 + jump LABEL70 +LABEL66: + sconst "No PvP" + iload 0 + if_settext + jump LABEL73 +LABEL70: + sconst "Deadman" + iload 0 + if_settext +LABEL73: + jump LABEL88 +LABEL74: + iload 1 + iconst 0 + if_icmpgt LABEL78 + jump LABEL85 +LABEL78: + sconst "Level: " + iload 1 + tostring + join_string 2 + iload 0 + if_settext + jump LABEL88 +LABEL85: + sconst "" + iload 0 + if_settext +LABEL88: + iload 1 + invoke 387 + return From 2a5756202229512f2c2a4da14c24cd26f642422c Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 2 Oct 2018 21:44:30 -0700 Subject: [PATCH 244/304] combat level plugin: Add attack level range option This commit adds a PVP-world-like combat level range text to the wilderness level in non-PVP worlds, displaying the range of combats you can attack at any given wilderness level. Closes runelite/runelite#3103 Closes runelite/runelite#3318 --- .../combatlevel/CombatLevelConfig.java | 10 ++ .../combatlevel/CombatLevelPlugin.java | 133 +++++++++++++++++- .../src/main/scripts/PvpWidgetBuilder.rs2asm | 2 + 3 files changed, 143 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelConfig.java index cf910192f2..cc82bcea65 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelConfig.java @@ -40,4 +40,14 @@ public interface CombatLevelConfig extends Config { return true; } + + @ConfigItem( + keyName = "wildernessAttackLevelRange", + name = "Show level range in wilderness", + description = "Displays a PVP-world-like attack level range in the wilderness" + ) + default boolean wildernessAttackLevelRange() + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelPlugin.java index a72e0bf2df..bbde15c2e0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelPlugin.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2017, Devin French + * Copyright (c) 2019, Jordan Atwood * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,14 +27,20 @@ package net.runelite.client.plugins.combatlevel; import com.google.inject.Provides; import java.text.DecimalFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.Experience; import net.runelite.api.GameState; import net.runelite.api.Skill; +import net.runelite.api.WorldType; +import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameTick; +import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; @@ -42,15 +49,31 @@ import net.runelite.client.ui.overlay.OverlayManager; @PluginDescriptor( name = "Combat Level", - description = "Show a more accurate combat level in Combat Options panel" + description = "Show a more accurate combat level in Combat Options panel and other combat level functions", + tags = {"wilderness", "attack", "range"} ) public class CombatLevelPlugin extends Plugin { - private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.###"); + private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.###"); + private static final String CONFIG_GROUP = "combatlevel"; + private static final String ATTACK_RANGE_CONFIG_KEY = "wildernessAttackLevelRange"; + private static final Pattern WILDERNESS_LEVEL_PATTERN = Pattern.compile("^Level: (\\d+)$"); + private static final int SKULL_CONTAINER_ADJUSTED_ORIGINAL_Y = 6; + private static final int WILDERNESS_LEVEL_TEXT_ADJUSTED_ORIGINAL_Y = 3; + private static final int MIN_COMBAT_LEVEL = 3; + + private int originalWildernessLevelTextPosition = -1; + private int originalSkullContainerPosition = -1; @Inject private Client client; + @Inject + private ClientThread clientThread; + + @Inject + private CombatLevelConfig config; + @Inject private CombatLevelOverlay overlay; @@ -67,6 +90,11 @@ public class CombatLevelPlugin extends Plugin protected void startUp() throws Exception { overlayManager.add(overlay); + + if (config.wildernessAttackLevelRange()) + { + appendAttackLevelRangeText(); + } } @Override @@ -84,6 +112,8 @@ public class CombatLevelPlugin extends Plugin combatLevelWidget.setText(widgetText.substring(0, widgetText.indexOf("."))); } } + + shutDownAttackLevelRange(); } @Subscribe @@ -112,4 +142,103 @@ public class CombatLevelPlugin extends Plugin combatLevelWidget.setText("Combat Lvl: " + DECIMAL_FORMAT.format(combatLevelPrecise)); } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (!CONFIG_GROUP.equals(event.getGroup()) || !ATTACK_RANGE_CONFIG_KEY.equals(event.getKey())) + { + return; + } + + if (config.wildernessAttackLevelRange()) + { + appendAttackLevelRangeText(); + } + else + { + shutDownAttackLevelRange(); + } + } + + @Subscribe + public void onScriptCallbackEvent(ScriptCallbackEvent event) + { + if (config.wildernessAttackLevelRange() + && "wildernessWidgetTextSet".equals(event.getEventName())) + { + appendAttackLevelRangeText(); + } + } + + 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 + "
" + 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); + } + + private void shutDownAttackLevelRange() + { + if (WorldType.isPvpWorld(client.getWorldType())) + { + return; + } + + final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL); + if (wildernessLevelWidget != null) + { + String wildernessLevelText = wildernessLevelWidget.getText(); + if (wildernessLevelText.contains("
")) + { + wildernessLevelWidget.setText(wildernessLevelText.substring(0, wildernessLevelText.indexOf("
"))); + } + wildernessLevelWidget.setOriginalY(originalWildernessLevelTextPosition); + clientThread.invoke(wildernessLevelWidget::revalidate); + } + originalWildernessLevelTextPosition = -1; + + final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER); + if (skullContainer != null) + { + skullContainer.setOriginalY(originalSkullContainerPosition); + clientThread.invoke(skullContainer::revalidate); + } + originalSkullContainerPosition = -1; + } + + private static String combatAttackRange(final int combatLevel, final int wildernessLevel) + { + return Math.max(MIN_COMBAT_LEVEL, combatLevel - wildernessLevel) + "-" + Math.min(Experience.MAX_COMBAT_LEVEL, combatLevel + wildernessLevel); + } } diff --git a/runelite-client/src/main/scripts/PvpWidgetBuilder.rs2asm b/runelite-client/src/main/scripts/PvpWidgetBuilder.rs2asm index c7173c0632..ba8bf2ec2f 100644 --- a/runelite-client/src/main/scripts/PvpWidgetBuilder.rs2asm +++ b/runelite-client/src/main/scripts/PvpWidgetBuilder.rs2asm @@ -114,4 +114,6 @@ LABEL85: LABEL88: iload 1 invoke 387 + sconst "wildernessWidgetTextSet" ; set callback name + runelite_callback ; invoke callback return From 849e044bb0f80ec849c4f30a000aebd846c25ca4 Mon Sep 17 00:00:00 2001 From: trimbe Date: Fri, 14 Dec 2018 15:50:56 -0500 Subject: [PATCH 245/304] item stats: add item information panel when buying items in the ge Co-authored-by: Tomas Slusny --- .../main/java/net/runelite/api/VarPlayer.java | 5 + .../main/java/net/runelite/api/Varbits.java | 9 +- .../net/runelite/api/widgets/WidgetID.java | 3 + .../net/runelite/api/widgets/WidgetInfo.java | 3 + .../plugins/itemstats/ItemStatConfig.java | 10 + .../plugins/itemstats/ItemStatPlugin.java | 365 ++++++++++++++++++ .../net/runelite/client/ui/JagexColors.java | 6 + .../src/main/scripts/GEOffersSetupInit.rs2asm | 4 +- 8 files changed, 403 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java index ed2f25e74e..62489df3f0 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java +++ b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java @@ -68,6 +68,11 @@ public enum VarPlayer */ THRONE_OF_MISCELLANIA(359), + /** + * Item currently active in the creation of a buy or sell offer + */ + CURRENT_GE_ITEM(1151), + /** * Experience tracker goal start. */ diff --git a/runelite-api/src/main/java/net/runelite/api/Varbits.java b/runelite-api/src/main/java/net/runelite/api/Varbits.java index f3ce1e6e12..ca053bd207 100644 --- a/runelite-api/src/main/java/net/runelite/api/Varbits.java +++ b/runelite-api/src/main/java/net/runelite/api/Varbits.java @@ -468,7 +468,14 @@ public enum Varbits BANK_TAB_SIX_COUNT(4176), BANK_TAB_SEVEN_COUNT(4177), BANK_TAB_EIGHT_COUNT(4178), - BANK_TAB_NINE_COUNT(4179); + BANK_TAB_NINE_COUNT(4179), + + /** + * Type of GE offer currently being created + * 0 = buy + * 1 = sell + */ + GE_OFFER_CREATION_TYPE(4397); /** * The raw varbit ID. diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index a8a1ec668e..0473179604 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -350,6 +350,7 @@ public class WidgetID static final int ROOT_INTERFACE_CONTAINER = 62; static final int BANK_CONTAINER = 64; static final int INTERFACE_CONTAINER = 65; + static final int INVENTORY_CONTAINER = 69; } static class ResizableViewport @@ -383,6 +384,7 @@ public class WidgetID static final int PRAYER_ICON = 63; static final int MAGIC_ICON = 64; static final int INTERFACE_CONTAINER = 65; + static final int INVENTORY_CONTAINER = 71; } static class ResizableViewportBottomLine @@ -415,6 +417,7 @@ public class WidgetID static final int MUSIC_TAB = 40; static final int MUSIC_ICON = 46; static final int MAGIC_ICON = 63; + static final int INVENTORY_CONTAINER = 71; } static class Chatbox diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 7808e06cba..83b335d6be 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -168,6 +168,7 @@ public enum WidgetInfo FIXED_VIEWPORT_ROOT_INTERFACE_CONTAINER(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.ROOT_INTERFACE_CONTAINER), FIXED_VIEWPORT_BANK_CONTAINER(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.BANK_CONTAINER), FIXED_VIEWPORT_INTERFACE_CONTAINER(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.INTERFACE_CONTAINER), + FIXED_VIEWPORT_INVENTORY_CONTAINER(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.INVENTORY_CONTAINER), FIXED_VIEWPORT_COMBAT_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.COMBAT_TAB), FIXED_VIEWPORT_STATS_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.STATS_TAB), FIXED_VIEWPORT_QUESTS_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.QUESTS_TAB), @@ -258,7 +259,9 @@ public enum WidgetInfo RESIZABLE_VIEWPORT_BOTTOM_LINE_OPTIONS_ICON(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID, WidgetID.ResizableViewportBottomLine.SETTINGS_ICON), RESIZABLE_VIEWPORT_BOTTOM_LINE_EMOTES_ICON(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID, WidgetID.ResizableViewportBottomLine.EMOTE_ICON), RESIZABLE_VIEWPORT_BOTTOM_LINE_MUSIC_ICON(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID, WidgetID.ResizableViewportBottomLine.MUSIC_ICON), + RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_CONTAINER(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID, WidgetID.ResizableViewportBottomLine.INVENTORY_CONTAINER), RESIZABLE_VIEWPORT_INTERFACE_CONTAINER(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.INTERFACE_CONTAINER), + RESIZABLE_VIEWPORT_INVENTORY_CONTAINER(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.INVENTORY_CONTAINER), RESIZABLE_VIEWPORT_BOTTOM_LINE_INTERFACE_CONTAINER(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID, WidgetID.ResizableViewport.INTERFACE_CONTAINER), PRAYER_THICK_SKIN(WidgetID.PRAYER_GROUP_ID, WidgetID.Prayer.THICK_SKIN), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java index c9fa8af82b..3c7d586a86 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java @@ -52,6 +52,16 @@ public interface ItemStatConfig extends Config return true; } + @ConfigItem( + keyName = "geStats", + name = "Enable GE item information", + description = "Shows an item information panel when buying items in the GE" + ) + default boolean geStats() + { + return true; + } + @ConfigItem( keyName = "relative", name = "Show Relative", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java index 250a6410cd..b32ddaf7bd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java @@ -24,13 +24,45 @@ */ package net.runelite.client.plugins.itemstats; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import com.google.inject.Binder; import com.google.inject.Inject; import com.google.inject.Provides; +import java.awt.FontMetrics; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.runelite.api.Client; +import net.runelite.api.FontID; +import net.runelite.api.InventoryID; +import net.runelite.api.Item; +import net.runelite.api.ItemContainer; +import net.runelite.api.ItemID; +import net.runelite.api.SpriteID; +import net.runelite.api.VarPlayer; +import net.runelite.api.Varbits; +import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.events.VarbitChanged; +import net.runelite.api.events.WidgetHiddenChanged; +import net.runelite.api.widgets.JavaScriptCallback; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetInfo; +import net.runelite.api.widgets.WidgetTextAlignment; +import net.runelite.api.widgets.WidgetType; import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.FontManager; +import net.runelite.client.ui.JagexColors; import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.util.StackFormatter; +import net.runelite.http.api.item.ItemEquipmentStats; +import net.runelite.http.api.item.ItemStats; @PluginDescriptor( name = "Item Stats", @@ -39,12 +71,27 @@ import net.runelite.client.ui.overlay.OverlayManager; ) public class ItemStatPlugin extends Plugin { + private static final int ORANGE_TEXT = JagexColors.DARK_ORANGE_INTERFACE_TEXT.getRGB(); + private static final int YELLOW_TEXT = JagexColors.YELLOW_INTERFACE_TEXT.getRGB(); + private static final int TEXT_HEIGHT = 11; + @Inject private OverlayManager overlayManager; @Inject private ItemStatOverlay overlay; + @Inject + private Client client; + + @Inject + private ItemManager itemManager; + + @Inject + private ItemStatConfig config; + + private Widget itemInformationTitle; + @Provides ItemStatConfig getConfig(ConfigManager configManager) { @@ -67,5 +114,323 @@ public class ItemStatPlugin extends Plugin protected void shutDown() throws Exception { overlayManager.remove(overlay); + resetGEInventory(); + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (event.getKey().equals("geStats")) + { + resetGEInventory(); + } + } + + @Subscribe + public void onWidgetHiddenChanged(WidgetHiddenChanged event) + { + if (!config.geStats()) + { + return; + } + + if (event.getWidget() == client.getWidget(WidgetInfo.INVENTORY)) + { + resetGEInventory(); + } + } + + @Subscribe + public void onVarbitChanged(VarbitChanged event) + { + if (client.getVar(VarPlayer.CURRENT_GE_ITEM) == -1 && config.geStats()) + { + resetGEInventory(); + } + } + + @Subscribe + public void onScriptCallbackEvent(ScriptCallbackEvent event) + { + if (event.getEventName().equals("geBuilt") && config.geStats()) + { + int currentGeItem = client.getVar(VarPlayer.CURRENT_GE_ITEM); + if (currentGeItem != -1 && client.getVar(Varbits.GE_OFFER_CREATION_TYPE) == 0) + { + createItemInformation(currentGeItem); + } + } + } + + private void createItemInformation(int id) + { + final ItemStats itemStats = itemManager.getItemStats(id, false); + + if (itemStats == null || !itemStats.isEquipable()) + { + return; + } + + final ItemEquipmentStats equipmentStats = itemStats.getEquipment(); + + if (equipmentStats == null) + { + return; + } + + final Widget geInv = client.getWidget(WidgetInfo.GRAND_EXCHANGE_INVENTORY_ITEMS_CONTAINER); + + if (geInv == null) + { + return; + } + + final Widget invContainer = getInventoryContainer(); + + if (invContainer == null) + { + return; + } + + invContainer.deleteAllChildren(); + geInv.setHidden(true); + + int yPos = 0; + + final FontMetrics smallFM = client.getCanvas().getFontMetrics(FontManager.getRunescapeSmallFont()); + + // HEADER + + itemInformationTitle = createText(invContainer, "Item Information", FontID.BOLD_12, ORANGE_TEXT, + 8, 8, invContainer.getWidth(), 16); + itemInformationTitle.setYTextAlignment(WidgetTextAlignment.CENTER); + + Widget closeButton = invContainer.createChild(-1, WidgetType.GRAPHIC); + closeButton.setOriginalY(8); + closeButton.setOriginalX(invContainer.getWidth() - 24); + closeButton.setOriginalHeight(16); + closeButton.setOriginalWidth(16); + closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL); + closeButton.setAction(0, "Close"); + closeButton.setOnMouseOverListener((JavaScriptCallback) (ev) -> + { + closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL_HOVERED); + }); + closeButton.setOnMouseLeaveListener((JavaScriptCallback) (ev) -> + { + closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL); + }); + closeButton.setOnOpListener((JavaScriptCallback) (ev) -> resetGEInventory()); + closeButton.setHasListener(true); + closeButton.revalidate(); + + yPos += 15; + + createSeparator(invContainer, yPos); + + // ICON AND TITLE + + yPos += 25; + + Widget icon = invContainer.createChild(-1, WidgetType.GRAPHIC); + icon.setOriginalX(8); + icon.setOriginalY(yPos); + icon.setOriginalWidth(36); + icon.setOriginalHeight(32); + icon.setItemId(id); + icon.setItemQuantityMode(0); + icon.setBorderType(1); + icon.revalidate(); + + Widget itemName = createText(invContainer, itemManager.getItemComposition(id).getName(), FontID.PLAIN_12, ORANGE_TEXT, + 50, yPos, invContainer.getWidth() - 40, 30); + itemName.setYTextAlignment(WidgetTextAlignment.CENTER); + + yPos += 20; + + createSeparator(invContainer, yPos); + + // STATS HEADER + + yPos += 25; + + createText(invContainer, "Attack", FontID.PLAIN_11, ORANGE_TEXT, 5, yPos, 50, -1); + + int defenceXPos = invContainer.getWidth() - (smallFM.stringWidth("Defence") + 5); + createText(invContainer, "Defence", FontID.PLAIN_11, ORANGE_TEXT, defenceXPos, yPos, 50, -1); + + // STYLE BONUSES + + final Set stats = ImmutableSet.of( + "Stab", + "Slash", + "Crush", + "Magic", + "Ranged" + ); + + final List attackStats = ImmutableList.of( + equipmentStats.getAstab(), + equipmentStats.getAslash(), + equipmentStats.getAcrush(), + equipmentStats.getAmagic(), + equipmentStats.getArange() + ); + + final List defenceStats = ImmutableList.of( + equipmentStats.getDstab(), + equipmentStats.getDslash(), + equipmentStats.getDcrush(), + equipmentStats.getDmagic(), + equipmentStats.getDrange() + ); + + int index = 0; + + for (final String stat : stats) + { + yPos += TEXT_HEIGHT + 2; + + // Style label + final Widget styleText = createText(invContainer, stat, FontID.PLAIN_11, ORANGE_TEXT, + 0, yPos, invContainer.getWidth(), -1); + styleText.setXTextAlignment(WidgetTextAlignment.CENTER); + + // Attack bonus + createText(invContainer, attackStats.get(index).toString(), FontID.PLAIN_11, YELLOW_TEXT, + 5, yPos, 50, -1); + + // Defence bonus + final int defenceX = invContainer.getWidth() - (smallFM.stringWidth(defenceStats.get(index).toString()) + 5); + createText(invContainer, defenceStats.get(index).toString(), FontID.PLAIN_11, YELLOW_TEXT, + defenceX, yPos, 50, -1); + + index++; + } + + // MISC BONUSES + + yPos += TEXT_HEIGHT + 8; + + final Map miscStats = ImmutableMap.of( + "Strength", equipmentStats.getStr(), + "Ranged Strength", equipmentStats.getRstr(), + "Magic Damage", equipmentStats.getMdmg(), + "Prayer Bonus", equipmentStats.getPrayer() + ); + + for (final Map.Entry miscStat : miscStats.entrySet()) + { + final String name = miscStat.getKey(); + final String value = miscStat.getValue().toString(); + + // Stat label + createText(invContainer, name, FontID.PLAIN_11, ORANGE_TEXT, 5, yPos, 50, -1); + + // Stat bonus + int valueXPos = invContainer.getWidth() - (smallFM.stringWidth(value) + 5); + createText(invContainer, value, FontID.PLAIN_11, YELLOW_TEXT, valueXPos, yPos, 50, -1); + + yPos += TEXT_HEIGHT + 2; + } + + // COINS + + createSeparator(invContainer, invContainer.getHeight() - 40); + + final String coinText = "You have " + StackFormatter.quantityToRSStackSize(getCurrentGP()) + + (getCurrentGP() == 1 ? " coin." : " coins."); + + final Widget coinWidget = createText(invContainer, coinText, FontID.PLAIN_12, ORANGE_TEXT, + 0, invContainer.getHeight() - 18, invContainer.getWidth(), -1); + + coinWidget.setXTextAlignment(WidgetTextAlignment.CENTER); + } + + private static Widget createText(Widget parent, String text, int fontId, int textColor, + int x, int y, int width, int height) + { + final Widget widget = parent.createChild(-1, WidgetType.TEXT); + widget.setText(text); + widget.setFontId(fontId); + widget.setTextColor(textColor); + widget.setTextShadowed(true); + widget.setOriginalHeight(height == -1 ? TEXT_HEIGHT : height); + widget.setOriginalWidth(width); + widget.setOriginalY(y); + widget.setOriginalX(x); + widget.revalidate(); + return widget; + } + + private static void createSeparator(Widget parent, int y) + { + Widget separator = parent.createChild(-1, WidgetType.GRAPHIC); + separator.setOriginalWidth(parent.getWidth()); + separator.setOriginalY(y); + separator.setOriginalHeight(32); + separator.setSpriteId(SpriteID.UNKNOWN_BORDER_EDGE_HORIZONTAL_995); + separator.revalidate(); + } + + private void resetGEInventory() + { + final Widget invContainer = getInventoryContainer(); + + if (invContainer == null) + { + return; + } + + if (itemInformationTitle != null && invContainer.getChild(0) == itemInformationTitle) + { + invContainer.deleteAllChildren(); + itemInformationTitle = null; + } + + final Widget geInv = client.getWidget(WidgetInfo.GRAND_EXCHANGE_INVENTORY_ITEMS_CONTAINER); + if (geInv != null) + { + geInv.setHidden(false); + } + } + + private int getCurrentGP() + { + final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); + + if (inventory == null) + { + return 0; + } + + for (final Item item : inventory.getItems()) + { + if (item.getId() == ItemID.COINS_995) + { + return item.getQuantity(); + } + } + + return 0; + } + + 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); + } } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/JagexColors.java b/runelite-client/src/main/java/net/runelite/client/ui/JagexColors.java index ac5fbeed6f..38b1ea657f 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/JagexColors.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/JagexColors.java @@ -62,4 +62,10 @@ public class JagexColors public static final Color TOOLTIP_BACKGROUND = new Color(255, 255, 160); public static final Color TOOLTIP_BORDER = Color.BLACK; public static final Color TOOLTIP_TEXT = Color.BLACK; + + /* + * Colors used in interfaces + */ + public static final Color DARK_ORANGE_INTERFACE_TEXT = new Color(255, 152, 31); + public static final Color YELLOW_INTERFACE_TEXT = Color.YELLOW; } diff --git a/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm b/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm index 422b76a7f7..e884731804 100644 --- a/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm +++ b/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm @@ -389,4 +389,6 @@ LABEL315: iload 13 invoke 780 LABEL319: - return + sconst "geBuilt" ; + runelite_callback ; + return From 8285bc80caf47ef9263a5f5546f5d487e9fe49b9 Mon Sep 17 00:00:00 2001 From: trimbe Date: Tue, 12 Mar 2019 12:41:42 -0400 Subject: [PATCH 246/304] mixins: use last non-null child to determine index for new widgets --- .../main/java/net/runelite/mixins/RSWidgetMixin.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java index 455c0c36a8..4130ce5930 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java @@ -519,7 +519,15 @@ public abstract class RSWidgetMixin implements RSWidget } else { - index = siblings.length; + index = 0; + for (int i = siblings.length - 1; i >= 0; i--) + { + if (siblings[i] != null) + { + index = i + 1; + break; + } + } } } From b9bf0e3639e2fbe872d900e9d2d6aac5b4fcec12 Mon Sep 17 00:00:00 2001 From: trimbe Date: Tue, 12 Mar 2019 17:54:17 -0400 Subject: [PATCH 247/304] item stats: use GameTick to determine when GE is closed --- .../client/plugins/itemstats/ItemStatPlugin.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java index b32ddaf7bd..b11ec4b5e3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java @@ -44,9 +44,9 @@ import net.runelite.api.SpriteID; import net.runelite.api.VarPlayer; import net.runelite.api.Varbits; import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.GameTick; import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetHiddenChanged; import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; @@ -127,14 +127,10 @@ public class ItemStatPlugin extends Plugin } @Subscribe - public void onWidgetHiddenChanged(WidgetHiddenChanged event) + public void onGameTick(GameTick event) { - if (!config.geStats()) - { - return; - } - - if (event.getWidget() == client.getWidget(WidgetInfo.INVENTORY)) + if (itemInformationTitle != null && config.geStats() + && client.getWidget(WidgetInfo.GRAND_EXCHANGE_WINDOW_CONTAINER) == null) { resetGEInventory(); } From 1a10215b1d003582e3a3dd6c62fecfa1ab550d28 Mon Sep 17 00:00:00 2001 From: trimbe Date: Tue, 12 Mar 2019 17:55:05 -0400 Subject: [PATCH 248/304] item stats: use ClientThread where necessary for resetting --- .../runelite/client/plugins/itemstats/ItemStatPlugin.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java index b11ec4b5e3..3a599cfa6e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java @@ -52,6 +52,7 @@ import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetTextAlignment; import net.runelite.api.widgets.WidgetType; +import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; @@ -90,6 +91,9 @@ public class ItemStatPlugin extends Plugin @Inject private ItemStatConfig config; + @Inject + private ClientThread clientThread; + private Widget itemInformationTitle; @Provides @@ -114,7 +118,7 @@ public class ItemStatPlugin extends Plugin protected void shutDown() throws Exception { overlayManager.remove(overlay); - resetGEInventory(); + clientThread.invokeLater(this::resetGEInventory); } @Subscribe @@ -122,7 +126,7 @@ public class ItemStatPlugin extends Plugin { if (event.getKey().equals("geStats")) { - resetGEInventory(); + clientThread.invokeLater(this::resetGEInventory); } } From 3b33685930e62cc8fb1cb95690d96e6258d1a08f Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 14 Mar 2019 11:33:25 +0000 Subject: [PATCH 249/304] Update Item IDs to 2019-03-14-rev178 --- runelite-api/src/main/java/net/runelite/api/ItemID.java | 8 ++++++-- .../src/main/java/net/runelite/api/NullItemID.java | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index f4d4362053..2e5b5b790c 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -6494,7 +6494,7 @@ public final class ItemID public static final int ZAMORAK_CHAPS = 10372; public static final int ZAMORAK_COIF = 10374; public static final int GUTHIX_BRACERS = 10376; - public static final int GUTHIX_DRAGONHIDE = 10378; + public static final int GUTHIX_DHIDE = 10378; public static final int GUTHIX_CHAPS = 10380; public static final int GUTHIX_COIF = 10382; public static final int SARADOMIN_BRACERS = 10384; @@ -6801,7 +6801,7 @@ public final class ItemID public static final int GUTHIX_ROBE_TOP_10788 = 10788; public static final int ZAMORAK_DHIDE_10790 = 10790; public static final int SARADOMIN_DHIDE_10792 = 10792; - public static final int GUTHIX_DRAGONHIDE_10794 = 10794; + public static final int GUTHIX_DRAGONHIDE = 10794; public static final int ROBIN_HOOD_HAT_10796 = 10796; public static final int RUNE_PLATEBODY_G_10798 = 10798; public static final int RUNE_PLATEBODY_T_10800 = 10800; @@ -10644,5 +10644,9 @@ public final class ItemID public static final int ORNATE_CAPE = 23099; public static final int ORNATE_HELM = 23101; public static final int BIRTHDAY_CAKE = 23108; + public static final int MYSTIC_SET_LIGHT = 23110; + public static final int MYSTIC_SET_BLUE = 23113; + public static final int MYSTIC_SET_DARK = 23116; + public static final int MYSTIC_SET_DUSK = 23119; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index b2d75645a9..6aa1699c1b 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -12279,5 +12279,13 @@ public final class NullItemID public static final int NULL_23106 = 23106; public static final int NULL_23107 = 23107; public static final int NULL_23109 = 23109; + public static final int NULL_23111 = 23111; + public static final int NULL_23112 = 23112; + public static final int NULL_23114 = 23114; + public static final int NULL_23115 = 23115; + public static final int NULL_23117 = 23117; + public static final int NULL_23118 = 23118; + public static final int NULL_23120 = 23120; + public static final int NULL_23121 = 23121; /* This file is automatically generated. Do not edit. */ } From a81374eff62ddc42442c0b80d833dbb6afe87304 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 14 Mar 2019 11:33:25 +0000 Subject: [PATCH 250/304] Update Item variations to 2019-03-14-rev178 --- .../src/main/resources/item_variations.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/resources/item_variations.json b/runelite-client/src/main/resources/item_variations.json index 194ea684f2..d196c9e9d2 100644 --- a/runelite-client/src/main/resources/item_variations.json +++ b/runelite-client/src/main/resources/item_variations.json @@ -6705,10 +6705,6 @@ 10370, 10790 ], - "guthix dragonhide": [ - 10378, - 10794 - ], "saradomin dhide": [ 10386, 10792 @@ -8908,5 +8904,11 @@ 23067, 23068, 23070 + ], + "mystic set": [ + 23110, + 23113, + 23116, + 23119 ] } \ No newline at end of file From 69be7f3962d492e318b84c7b6556788e8aaae8cd Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 14 Mar 2019 11:33:26 +0000 Subject: [PATCH 251/304] Update Object IDs to 2019-03-14-rev178 --- .../src/main/java/net/runelite/api/NullObjectID.java | 1 - runelite-api/src/main/java/net/runelite/api/ObjectID.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java index 9c09d4df61..c8234df8b1 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -11440,7 +11440,6 @@ public final class NullObjectID public static final int NULL_24552 = 24552; public static final int NULL_24553 = 24553; public static final int NULL_24554 = 24554; - public static final int NULL_24558 = 24558; public static final int NULL_24570 = 24570; public static final int NULL_24604 = 24604; public static final int NULL_24623 = 24623; diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index dcc21803c3..2b5a2d9633 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -13120,8 +13120,9 @@ public final class ObjectID public static final int DISPLAY_CASE_24551 = 24551; public static final int SPECIMEN_TABLE_24555 = 24555; public static final int SPECIMEN_TABLE_24556 = 24556; - public static final int ROCKS_24557 = 24557; - public static final int DIG_SITE_SPECIMEN_ROCKS = 24559; + public static final int DIG_SITE_SPECIMEN_ROCKS = 24557; + public static final int DIG_SITE_SPECIMEN_ROCKS_24558 = 24558; + public static final int DIG_SITE_SPECIMEN_ROCKS_24559 = 24559; public static final int GATE_24560 = 24560; public static final int GATE_24561 = 24561; public static final int GAP_24562 = 24562; @@ -13890,6 +13891,7 @@ public final class ObjectID public static final int CHEST_26193 = 26193; public static final int LEVER_26194 = 26194; public static final int BIRTHDAY_CAKE = 26198; + public static final int GRINDER = 26199; public static final int TABLE_26201 = 26201; public static final int TABLE_26202 = 26202; public static final int TABLE_26203 = 26203; From 228a9d0831583e995587c53d0560f259c7eab803 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 14 Mar 2019 11:33:26 +0000 Subject: [PATCH 252/304] Update NPC IDs to 2019-03-14-rev178 --- runelite-api/src/main/java/net/runelite/api/NpcID.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index 0b6f19815a..a483290e88 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -6207,6 +6207,7 @@ public final class NpcID public static final int SPAWN_6768 = 6768; public static final int OSTEN = 6769; public static final int ARCIS = 6770; + public static final int DREW = 6771; public static final int LOVADA = 6772; public static final int DOOMSAYER = 6773; public static final int DOOMSAYER_6774 = 6774; From 68a18a77c2a8e295aafa4eea5cfdb753e87e3419 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 14 Mar 2019 11:33:32 +0000 Subject: [PATCH 253/304] Update Widget IDs to 2019-03-14-rev178 --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 8 ++++---- .../main/java/net/runelite/api/widgets/WidgetInfo.java | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 0473179604..2d6551e5f1 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -692,7 +692,7 @@ public class WidgetID static class Minigames { - static final int TELEPORT_BUTTON = 31; + static final int TELEPORT_BUTTON = 26; } static class StandardSpellBook @@ -756,8 +756,8 @@ public class WidgetID static class QuestList { - static final int FREE_CONTAINER = 9; - static final int MEMBERS_CONTAINER = 10; - static final int MINIQUEST_CONTAINER = 11; + static final int FREE_CONTAINER = 6; + static final int MEMBERS_CONTAINER = 7; + static final int MINIQUEST_CONTAINER = 8; } } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 83b335d6be..43e03dde4a 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -76,8 +76,6 @@ public enum WidgetInfo EMOTE_WINDOW(WidgetID.EMOTES_GROUP_ID, WidgetID.Emotes.EMOTE_WINDOW), EMOTE_CONTAINER(WidgetID.EMOTES_GROUP_ID, WidgetID.Emotes.EMOTE_CONTAINER), - DIARY_LIST(WidgetID.DIARY_GROUP_ID, 10), - DIARY_QUEST_WIDGET_TITLE(WidgetID.DIARY_QUEST_GROUP_ID, WidgetID.Diary.DIARY_TITLE), DIARY_QUEST_WIDGET_TEXT(WidgetID.DIARY_QUEST_GROUP_ID, WidgetID.Diary.DIARY_TEXT), From b4ad0532726b146bf342ffd19089acf3d79f8485 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 14 Mar 2019 05:45:00 -0600 Subject: [PATCH 254/304] Fix Guthix D'hide body --- .../java/net/runelite/client/plugins/prayer/PrayerItems.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerItems.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerItems.java index dbc5fb031b..24ffbc5a56 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerItems.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerItems.java @@ -148,8 +148,8 @@ enum PrayerItems ANCIENT_DHIDE(ItemID.ANCIENT_DHIDE, 1), ARMADYL_DHIDE(ItemID.ARMADYL_DHIDE, 1), BANDOS_DHIDE(ItemID.BANDOS_DHIDE, 1), - GUTHIX_DRAGONHIDE(ItemID.GUTHIX_DRAGONHIDE, 1), - GUTHIX_DRAGONHIDE_10794(ItemID.GUTHIX_DRAGONHIDE_10794, 1), + GUTHIX_DRAGONHIDE(ItemID.GUTHIX_DHIDE, 1), + GUTHIX_DRAGONHIDE_10794(ItemID.GUTHIX_DRAGONHIDE, 1), SARADOMIN_DHIDE(ItemID.SARADOMIN_DHIDE, 1), SARADOMIN_DHIDE_10792(ItemID.SARADOMIN_DHIDE_10792, 1), ZAMORAK_DHIDE(ItemID.ZAMORAK_DHIDE, 1), From c9acdb177fbf7c270e448b3aa2b3bcdd8b2454e0 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 14 Mar 2019 12:14:00 +0000 Subject: [PATCH 255/304] [maven-release-plugin] prepare release runelite-parent-1.5.16 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 94e5d7579f..9bbb74b37f 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 4cccfd84ad..54258aef18 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 308bdc1359..4bf32edaba 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 9a8bb7805c..dc993530ed 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 5301855666..da5478adaf 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 Web Service diff --git a/pom.xml b/pom.xml index b0e9cf092f..c466c74d42 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.16 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 52f2914ae8..657d3ae8e3 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 7981a5ad43..da0c4b6fc6 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 0456b0fdcd..cadd3379bb 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 9e118b44f0..f09907f086 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 5a230785a0..6106d2538e 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 3860a4a34c..e2c67ade23 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index e74de3f44f..ec3b454d03 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16-SNAPSHOT + 1.5.16 net.runelite.rs From a9a63ca732ee614deb5d2576673fec8440247dbf Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 14 Mar 2019 12:14:08 +0000 Subject: [PATCH 256/304] [maven-release-plugin] prepare for next development iteration --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 9bbb74b37f..637fd80c1f 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 54258aef18..0dfc42aee6 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 4bf32edaba..1d120e5a7b 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index dc993530ed..1faffff7e3 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index da5478adaf..b63c8f77e4 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index c466c74d42..c77d7701e8 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.16 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 657d3ae8e3..45f5cb501d 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index da0c4b6fc6..b5e0f7184a 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index cadd3379bb..6337af0c02 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index f09907f086..528774f347 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 6106d2538e..ebd3311ff8 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index e2c67ade23..a168700652 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index ec3b454d03..f7a1af8997 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.16 + 1.5.17-SNAPSHOT net.runelite.rs From ef39411cfd02d648dbcc99e1532713fbb417f360 Mon Sep 17 00:00:00 2001 From: Jason Xie Date: Fri, 15 Mar 2019 15:50:31 +0100 Subject: [PATCH 257/304] Change produce image of maple and yew trees to their respective logs (#8222) To stay consistent with rest of trees displayed in farming tracker switch from icons from construction guide to respective tree logs. Before: ![image](https://user-images.githubusercontent.com/8947593/54437786-b65e8f80-4735-11e9-9723-eb25a0a80625.png) After; ![image](https://user-images.githubusercontent.com/8947593/54437797-ba8aad00-4735-11e9-84ec-c0972d125168.png) --- .../runelite/client/plugins/timetracking/farming/Produce.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java index 6be6414259..66883eedba 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java @@ -93,8 +93,8 @@ public enum Produce // Tree crops OAK("Oak", ItemID.OAK_LOGS, 40, 5), WILLOW("Willow", ItemID.WILLOW_LOGS, 40, 7), - MAPLE("Maple", ItemID.MAPLE_TREE, 40, 9), - YEW("Yew", ItemID.YEW_TREE, 40, 11), + MAPLE("Maple", ItemID.MAPLE_LOGS, 40, 9), + YEW("Yew", ItemID.YEW_LOGS, 40, 11), MAGIC("Magic", ItemID.MAGIC_LOGS, 40, 13), // Fruit tree crops From 14088cb66e104cbb8f37b7c7398f96bb39a27b62 Mon Sep 17 00:00:00 2001 From: whartd Date: Fri, 15 Mar 2019 14:26:22 -0400 Subject: [PATCH 258/304] slayer plugin: fix task name for Crazy Archaeologists --- .../src/main/java/net/runelite/client/plugins/slayer/Task.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java index 5f2c7d3c2d..d3663a7def 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java @@ -69,7 +69,7 @@ enum Task COCKATRICE("Cockatrice", ItemID.COCKATRICE, "Cockathrice"), COWS("Cows", ItemID.COW_MASK), CRAWLING_HANDS("Crawling hands", ItemID.CRAWLING_HAND, "Crushing hand"), - CRAZY_ARCHAEOLOGIST("Crazy Archaeologist", ItemID.FEDORA), + CRAZY_ARCHAEOLOGIST("Crazy Archaeologists", ItemID.FEDORA, "Crazy Archaeologist"), CROCODILES("Crocodiles", ItemID.SWAMP_LIZARD), DAGANNOTH("Dagannoth", ItemID.DAGANNOTH), DAGANNOTH_KINGS("Dagannoth Kings", ItemID.PET_DAGANNOTH_PRIME), From e78fe7189272074169b71dd2b6520323516a5194 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Fri, 15 Mar 2019 17:08:42 -0700 Subject: [PATCH 259/304] boosts plugin: Fix overlay below-threshold color This patch updates the boosts overlay to match the threshold color comparison used in the plugin (for notifications) and in the indicator infobox. --- .../java/net/runelite/client/plugins/boosts/BoostsOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java index a02ee25e94..bebfcee730 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java @@ -137,7 +137,7 @@ class BoostsOverlay extends Overlay return new Color(238, 51, 51); } - return boost < config.boostThreshold() ? Color.YELLOW : Color.GREEN; + return boost <= config.boostThreshold() ? Color.YELLOW : Color.GREEN; } } From b98b7aebb9a8c1a01e1cabc129be5f3e3f924220 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 15 Mar 2019 21:20:11 -0400 Subject: [PATCH 260/304] travis: add openjdk11 Fix build for Java 11 --- .travis.yml | 1 + http-service/pom.xml | 8 ++++++++ pom.xml | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/.travis.yml b/.travis.yml index bcf4ad9e9f..6766833ee3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ cache: - $HOME/.m2 jdk: - oraclejdk8 +- openjdk11 install: true script: ./travis/build.sh notifications: diff --git a/http-service/pom.xml b/http-service/pom.xml index eba29dfe40..8d8ffa6803 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -184,6 +184,14 @@ com.github.kongchen swagger-maven-plugin 3.1.8 + + + + javax.xml.bind + jaxb-api + 2.3.1 + + diff --git a/pom.xml b/pom.xml index c77d7701e8..bf6afd34fa 100644 --- a/pom.xml +++ b/pom.xml @@ -186,6 +186,10 @@ org.apache.maven.plugins maven-javadoc-plugin 3.0.0-M1 + + + 8 + attach-javadocs From ea8dbeece23a42cecadd8370154cea7de76c0c1a Mon Sep 17 00:00:00 2001 From: trimbe Date: Sat, 16 Mar 2019 12:44:54 -0400 Subject: [PATCH 261/304] item stats: check if GE container is hidden when detecting GE close When the GE is closed with esc, the container is hidden rather than unloaded. --- .../net/runelite/client/plugins/itemstats/ItemStatPlugin.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java index 3a599cfa6e..d8facce32a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java @@ -134,7 +134,8 @@ public class ItemStatPlugin extends Plugin public void onGameTick(GameTick event) { if (itemInformationTitle != null && config.geStats() - && client.getWidget(WidgetInfo.GRAND_EXCHANGE_WINDOW_CONTAINER) == null) + && (client.getWidget(WidgetInfo.GRAND_EXCHANGE_WINDOW_CONTAINER) == null + || client.getWidget(WidgetInfo.GRAND_EXCHANGE_WINDOW_CONTAINER).isHidden())) { resetGEInventory(); } From 6d6867c2f0d54bb0c40a27009e9fd2ca7d6613de Mon Sep 17 00:00:00 2001 From: Juan Ortiz Date: Sun, 17 Mar 2019 13:15:03 -0400 Subject: [PATCH 262/304] npc highlight: remove tags from npc names --- .../client/plugins/npchighlight/NpcSceneOverlay.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java index d4c8c356ec..6c41b2f24d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java @@ -46,6 +46,7 @@ import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayUtil; +import net.runelite.client.util.Text; public class NpcSceneOverlay extends Overlay { @@ -87,7 +88,7 @@ public class NpcSceneOverlay extends Overlay for (NPC npc : plugin.getHighlightedNpcs()) { - renderNpcOverlay(graphics, npc, npc.getName(), config.getHighlightColor()); + renderNpcOverlay(graphics, npc, config.getHighlightColor()); } return null; @@ -143,7 +144,7 @@ public class NpcSceneOverlay extends Overlay } } - private void renderNpcOverlay(Graphics2D graphics, NPC actor, String name, Color color) + private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color) { switch (config.renderStyle()) { @@ -176,11 +177,12 @@ public class NpcSceneOverlay extends Overlay if (config.drawNames()) { - Point textLocation = actor.getCanvasTextLocation(graphics, name, actor.getLogicalHeight() + 40); + String npcName = Text.removeTags(actor.getName()); + Point textLocation = actor.getCanvasTextLocation(graphics, npcName, actor.getLogicalHeight() + 40); if (textLocation != null) { - OverlayUtil.renderTextLocation(graphics, textLocation, name, color); + OverlayUtil.renderTextLocation(graphics, textLocation, npcName, color); } } } From c8eeeaf9b246661f819f74ee7ed4a921c8c3392f Mon Sep 17 00:00:00 2001 From: WoneTooPhree <45672110+WoneTooPhree@users.noreply.github.com> Date: Sun, 17 Mar 2019 18:36:25 +0100 Subject: [PATCH 263/304] Add location description to coordinate clues (#8148) Closes #7135 --- .../cluescrolls/clues/CoordinateClue.java | 161 +++++++++++++++++- 1 file changed, 160 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java index 654f31e977..7d3b98dcb4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.cluescrolls.clues; +import com.google.common.collect.ImmutableMap; import java.awt.Color; import java.awt.Graphics2D; import lombok.AllArgsConstructor; @@ -43,6 +44,154 @@ import net.runelite.client.ui.overlay.components.TitleComponent; @AllArgsConstructor public class CoordinateClue extends ClueScroll implements TextClueScroll, LocationClueScroll { + private static final ImmutableMap CLUES = new ImmutableMap.Builder() + // Medium + .put(new WorldPoint(2479, 3158, 0), "South of fruit tree patch, west of Tree Gnome Village.") + .put(new WorldPoint(2887, 3154, 0), "West of Banana plantation on Karamja.") + .put(new WorldPoint(2743, 3151, 0), "Entrance of Brimhaven dungeon.") + .put(new WorldPoint(3184, 3150, 0), "South of Lumbridge Swamp.") + .put(new WorldPoint(3217, 3177, 0), "East of Lumbridge Swamp.") + .put(new WorldPoint(3007, 3144, 0), "Near the entrance to the Asgarnian Ice Dungeon, south of Port Sarim (AIQ).") + .put(new WorldPoint(2896, 3119, 0), "Near Karambwan fishing spot (DKP).") + .put(new WorldPoint(2697, 3207, 0), "Centre of Moss Giant Island, west of Brimhaven.") + .put(new WorldPoint(2679, 3110, 0), "North of Hazelmere's house (CLS).") + .put(new WorldPoint(3510, 3074, 0), "East of Uzer (DLQ).") + .put(new WorldPoint(3160, 3251, 0), "West of trapdoor leading to H.A.M Hideout.") + .put(new WorldPoint(2643, 3252, 0), "South of Ardougne Zoo, North of Tower of Life (DJP).") + .put(new WorldPoint(2322, 3061, 0), "South-west of Castle wars (BKP).") + .put(new WorldPoint(2875, 3046, 0), "North of nature altar, north of Shilo Village (CKR).") + .put(new WorldPoint(2849, 3033, 0), "West of nature altar, north of Shilo Village (CKR).") + .put(new WorldPoint(2848, 3296, 0), "North of Crandor island.") + .put(new WorldPoint(2583, 2990, 0), "Feldip Hills, south-east of Gu'Thanoth (AKS).") + .put(new WorldPoint(3179, 3344, 0), "South of the Champions' Guild, opposite side of the River Lum.") + .put(new WorldPoint(2383, 3370, 0), "South-west of Tree Gnome Stronghold.") + .put(new WorldPoint(3312, 3375, 0), "North-west of Exam Centre, on the hill.") + .put(new WorldPoint(3121, 3384, 0), "North-east of Draynor Manor, near River Lum.") + .put(new WorldPoint(3430, 3388, 0), "West of Mort Myre Swamp.") + .put(new WorldPoint(2920, 3403, 0), "South-east of Taverley, near Lady of the Lake.") + .put(new WorldPoint(2594, 2899, 0), "South-east of Feldip Hills, by the crimson swifts (AKS).") + .put(new WorldPoint(2387, 3435, 0), "West of Tree Gnome Stronghold, near the pen containing terrorbirds.") + .put(new WorldPoint(2512, 3467, 0), "Baxtorian Falls (Bring rope).") + .put(new WorldPoint(2381, 3468, 0), "West of Tree Gnome Stronghold, north of the pen with terrorbirds.") + .put(new WorldPoint(3005, 3475, 0), "Ice Mountain, west of Edgeville.") + .put(new WorldPoint(2585, 3505, 0), "By the shore line north of the Coal Trucks.") + .put(new WorldPoint(3443, 3515, 0), "South of Slayer Tower.") + .put(new WorldPoint(2416, 3516, 0), "Tree Gnome Stronghold, west of Grand Tree, near swamp.") + .put(new WorldPoint(3429, 3523, 0), "South of Slayer Tower.") + .put(new WorldPoint(2363, 3531, 0), "North-east of Eagles' Peak.") + .put(new WorldPoint(2919, 3535, 0), "East of Burthorpe pub.") + .put(new WorldPoint(3548, 3560, 0), "Inside Fenkenstrain's Castle.") + .put(new WorldPoint(1456, 3620, 0), "Graveyard west of Shayzien House.") + .put(new WorldPoint(2735, 3638, 0), "East of Rellekka, north-west of Golden Apple Tree (AJR).") + .put(new WorldPoint(2681, 3653, 0), "Rellekka, in the garden of the south-east house.") + .put(new WorldPoint(2537, 3881, 0), "Miscellania.") + // Hard + .put(new WorldPoint(2209, 3161, 0), "North-east of Tyras Camp.") + .put(new WorldPoint(2181, 3206, 0), "South of Elf Camp.") + .put(new WorldPoint(3081, 3209, 0), "Small Island (CLP).") + .put(new WorldPoint(3374, 3250, 0), "Duel Arena combat area.") + .put(new WorldPoint(2699, 3251, 0), "Little island (AIR).") + .put(new WorldPoint(3546, 3251, 0), "North-east of Burgh de Rott.") + .put(new WorldPoint(3544, 3256, 0), "North-east of Burgh de Rott.") + .put(new WorldPoint(2841, 3267, 0), "Crandor island.") + .put(new WorldPoint(3168, 3041, 0), "Bedabin Camp.") + .put(new WorldPoint(2542, 3031, 0), "Gu'Tanoth.") + .put(new WorldPoint(2581, 3030, 0), "Gu'Tanoth island, enter cave north-west of Feldip Hills (AKS).") + .put(new WorldPoint(2961, 3024, 0), "Ship yard (DKP).") + .put(new WorldPoint(2339, 3311, 0), "East of Tirannwn on Arandar mountain pass.") + .put(new WorldPoint(3440, 3341, 0), "Nature Spirit's grotto.") + .put(new WorldPoint(2763, 2974, 0), "Cairn Isle, west of Shilo Village.") + .put(new WorldPoint(3138, 2969, 0), "West of Bandid Camp.") + .put(new WorldPoint(2924, 2963, 0), "On the southern part of eastern Karamja.") + .put(new WorldPoint(2838, 2914, 0), "Kharazi Jungle, near water pool.") + .put(new WorldPoint(3441, 3419, 0), "Mort Myre Swamp.") + .put(new WorldPoint(2950, 2902, 0), "South-east of Kharazi Jungle.") + .put(new WorldPoint(2775, 2891, 0), "South-west of Kharazi Jungle.") + .put(new WorldPoint(3113, 3602, 0), "Wilderness. North of Edgeville (level 11).") + .put(new WorldPoint(2892, 3675, 0), "On the summit of Trollheim.") + .put(new WorldPoint(3168, 3677, 0), "Wilderness. Graveyard of Shadows.") + .put(new WorldPoint(2853, 3690, 0), "Entrance to the troll Stronghold.") + .put(new WorldPoint(3305, 3692, 0), "Wilderness. West of eastern green dragon.") + .put(new WorldPoint(3055, 3696, 0), "Wilderness. Bandid Camp.") + .put(new WorldPoint(3302, 3696, 0), "Wilderness. West of eastern green dragon.") + .put(new WorldPoint(1479, 3696, 0), "Lizardman Canyon.") + .put(new WorldPoint(2712, 3732, 0), "North-east of Rellekka.") + .put(new WorldPoint(2970, 3749, 0), "Wilderness. Forgotten Cemetery.") + .put(new WorldPoint(3094, 3764, 0), "Wilderness. Mining site north of Bandit Camp.") + .put(new WorldPoint(3311, 3769, 0), "Wilderness. North of Venenatis.") + .put(new WorldPoint(1460, 3782, 0), "Lovakengj, near burning man.") + .put(new WorldPoint(3244, 3792, 0), "Wilderness. South-east of Lava Dragon Isle by some Chaos Dwarves.") + .put(new WorldPoint(3140, 3804, 0), "Wilderness. North of Ruins.") + .put(new WorldPoint(2946, 3819, 0), "Wilderness. Chaos Temple (level 38).") + .put(new WorldPoint(3771, 3825, 0), "Fossil Island. East of Museum Camp.") + .put(new WorldPoint(3013, 3846, 0), "Wilderness. West of Lava Maze, before KBD's lair.") + .put(new WorldPoint(3058, 3884, 0), "Wilderness. Near runite ore north of Lava Maze.") + .put(new WorldPoint(3290, 3889, 0), "Wilderness. Demonic Ruins.") + .put(new WorldPoint(3770, 3897, 0), "Small Island north of Fossil Island.") + .put(new WorldPoint(2505, 3899, 0), "Small Island north-east of Miscellania (AJS).") + .put(new WorldPoint(3285, 3942, 0), "Wilderness. Rogues' Castle.") + .put(new WorldPoint(3159, 3959, 0), "Wilderness. North of Deserted Keep, west of Resource Area.") + .put(new WorldPoint(3039, 3960, 0), "Wilderness. Pirates' Hideout.") + .put(new WorldPoint(2987, 3963, 0), "Wilderness. West of Wilderness Agility Course.") + .put(new WorldPoint(3189, 3963, 0), "Wilderness. North of Resource Area, near magic axe hut.") + // Elite + .put(new WorldPoint(2357, 3151, 0), "Lletya.") + .put(new WorldPoint(3587, 3180, 0), "Meiyerditch.") + .put(new WorldPoint(2820, 3078, 0), "Tai Bwo Wannai. Hardwood Grove.") + .put(new WorldPoint(3811, 3060, 0), "Small island north-east of Mos Le'Harmless.") + .put(new WorldPoint(2180, 3282, 0), "North of Elf Camp.") + .put(new WorldPoint(2870, 2997, 0), "North-east of Shilo Village.") + .put(new WorldPoint(3302, 2988, 0), "On top of a cliff to the west of Pollnivneach.") + .put(new WorldPoint(2511, 2980, 0), "Just south of Gu'Tanoth, west of gnome glider.") + .put(new WorldPoint(2732, 3372, 0), "Legends' Guild.") + .put(new WorldPoint(3573, 3425, 0), "North of Dessous's tomb from Desert Treasure.") + .put(new WorldPoint(3828, 2848, 0), "East of Harmony Island.") + .put(new WorldPoint(3225, 2838, 0), "South of Desert Treasure pyramid.") + .put(new WorldPoint(1773, 3510, 0), "Between magic trees South of Tithe Farm.") + .put(new WorldPoint(3822, 3562, 0), "North-east of Dragontooth Island.") + .put(new WorldPoint(3603, 3564, 0), "North of the wrecked ship, outside of Port Phasmatys.") + .put(new WorldPoint(2936, 2721, 0), "Eastern shore of Crash Island.") + .put(new WorldPoint(2697, 2705, 0), "South-west of Ape Atoll.") + .put(new WorldPoint(2778, 3678, 0), "Mountain Camp.") + .put(new WorldPoint(2827, 3740, 0), "West of the entrance to the Ice Path, where the Troll child resides.") + .put(new WorldPoint(2359, 3799, 0), "Neitiznot.") + .put(new WorldPoint(2194, 3807, 0), "Pirates' Cove.") + .put(new WorldPoint(2700, 3808, 0), "Northwestern part of the Trollweiss and Rellekka Hunter area (DKS).") + .put(new WorldPoint(3215, 3835, 0), "Wilderness. Lava Dragon Isle.") + .put(new WorldPoint(3369, 3894, 0), "Wilderness. Fountain of Rune.") + .put(new WorldPoint(2065, 3923, 0), "Outside the western wall on Lunar Isle.") + .put(new WorldPoint(3188, 3933, 0), "Wilderness. Resource Area.") + .put(new WorldPoint(2997, 3953, 0), "Wilderness. Inside Agility Training Area.") + .put(new WorldPoint(3380, 3963, 0), "Wilderness. North of Volcano.") + // Master + .put(new WorldPoint(2178, 3209, 0), "South of Elf Camp.") + .put(new WorldPoint(2155, 3100, 0), "South of Port Tyras (BJS).") + .put(new WorldPoint(2217, 3092, 0), "Poison Waste island (DLR).") + .put(new WorldPoint(3830, 3060, 0), "Small island located north-east of Mos Le'Harmless.") + .put(new WorldPoint(2834, 3271, 0), "Crandor island.") + .put(new WorldPoint(2732, 3284, 0), "Witchaven.") + .put(new WorldPoint(3622, 3320, 0), "Meiyerditch. Outside mine.") + .put(new WorldPoint(2303, 3328, 0), "East of Prifddinas.") + .put(new WorldPoint(3570, 3405, 0), "North of Dessous's tomb from Desert Treasure.") + .put(new WorldPoint(2840, 3423, 0), "Water Obelisk Island.") + .put(new WorldPoint(3604, 3564, 0), "North of the wrecked ship, outside of Port Phasmatys (ALQ).") + .put(new WorldPoint(3085, 3569, 0), "Wilderness. Obelisk of Air.") + .put(new WorldPoint(2934, 2727, 0), "Eastern shore of Crash Island.") + .put(new WorldPoint(1451, 3695, 0), "West side of Lizardman Canyon with Lizardman shaman.") + .put(new WorldPoint(2538, 3739, 0), "Waterbirth Island.") + .put(new WorldPoint(1248, 3751, 0), "Farming Guild.") + .put(new WorldPoint(1698, 3792, 0), "Arceuus church.") + .put(new WorldPoint(2951, 3820, 0), "Wilderness. Chaos Temple (level 38).") + .put(new WorldPoint(2202, 3825, 0), "Pirates' Cove, between Lunar Isle and Rellekka.") + .put(new WorldPoint(1761, 3853, 0), "Arceuus essence mine.") + .put(new WorldPoint(2090, 3863, 0), "South of Lunar Isle, west of Astral altar.") + .put(new WorldPoint(1442, 3878, 0), "Sulphur Mine.") + .put(new WorldPoint(3380, 3929, 0), "Wilderness. Near Volcano.") + .put(new WorldPoint(3188, 3939, 0), "Wilderness. Resource Area.") + .put(new WorldPoint(3304, 3941, 0), "Wilderness. East of Rogues' Castle.") + .put(new WorldPoint(2994, 3961, 0), "Wilderness. Inside Agility Training Area.") + .build(); + private String text; private WorldPoint location; private static final ItemRequirement HAS_SPADE = new SingleItemRequirement(ItemID.SPADE); @@ -52,8 +201,18 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati { panelComponent.getChildren().add(TitleComponent.builder().text("Coordinate Clue").build()); + String solution = CLUES.get(location); + + if (solution != null) + { + panelComponent.getChildren().add(LineComponent.builder() + .left(solution) + .build()); + panelComponent.getChildren().add(LineComponent.builder().build()); + } + panelComponent.getChildren().add(LineComponent.builder() - .left("Click the clue scroll along the edge of your world map to see where you should dig.") + .left("Click the clue scroll on your world map to see dig location.") .build()); if (plugin.getInventoryItems() != null) From b288a4899d1f34f0521937b530ba60eeb86a2109 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 17 Mar 2019 13:53:21 -0400 Subject: [PATCH 264/304] client: load jagex config and client over https This has only recently started working, but I am not sure when. --- .../java/net/runelite/client/rs/ClientConfigLoader.java | 2 +- .../src/main/java/net/runelite/client/rs/ClientLoader.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientConfigLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientConfigLoader.java index 9d3804ebab..be355cbd7e 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientConfigLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientConfigLoader.java @@ -38,7 +38,7 @@ import okhttp3.Response; @Singleton class ClientConfigLoader { - private static final String CONFIG_URL = "http://oldschool.runescape.com/jav_config.ws"; + private static final String CONFIG_URL = "https://oldschool.runescape.com/jav_config.ws"; private final OkHttpClient httpClient; @Inject diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index 9e81d59b00..3755be2398 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -37,7 +37,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.URL; import java.util.HashMap; import java.util.Map; import java.util.jar.JarEntry; @@ -48,6 +47,7 @@ import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import static net.runelite.client.rs.ClientUpdateCheckMode.*; import net.runelite.http.api.RuneLiteAPI; +import okhttp3.HttpUrl; import okhttp3.Request; import okhttp3.Response; import org.apache.commons.compress.compressors.CompressorException; @@ -83,7 +83,10 @@ public class ClientLoader { String codebase = config.getCodeBase(); String initialJar = config.getInitialJar(); - URL url = new URL(codebase + initialJar); + HttpUrl url = HttpUrl.parse(codebase).newBuilder() + .scheme("https") + .addPathSegment(initialJar) + .build(); Request request = new Request.Builder() .url(url) .build(); From 11993150b3b185a2dcefa61443d3bf4b8d29be3f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 17 Mar 2019 13:59:58 -0400 Subject: [PATCH 265/304] news service: load news over https https was not supported before, but it seems to be working now. --- .../runelite/http/service/feed/osrsnews/OSRSNewsService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/feed/osrsnews/OSRSNewsService.java b/http-service/src/main/java/net/runelite/http/service/feed/osrsnews/OSRSNewsService.java index 951e4da551..6936109343 100644 --- a/http-service/src/main/java/net/runelite/http/service/feed/osrsnews/OSRSNewsService.java +++ b/http-service/src/main/java/net/runelite/http/service/feed/osrsnews/OSRSNewsService.java @@ -50,7 +50,7 @@ import org.xml.sax.SAXException; @Service public class OSRSNewsService { - private static final HttpUrl RSS_URL = HttpUrl.parse("http://services.runescape.com/m=news/latest_news.rss?oldschool=true"); + private static final HttpUrl RSS_URL = HttpUrl.parse("https://services.runescape.com/m=news/latest_news.rss?oldschool=true"); private static final SimpleDateFormat PUB_DATE_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy '00:00:00 GMT'", Locale.US); public List getNews() throws IOException From be98ced0f5a27525ed54c5089ec5db165ba8e419 Mon Sep 17 00:00:00 2001 From: gregg1494 Date: Sun, 17 Mar 2019 22:04:46 -0500 Subject: [PATCH 266/304] menu swapper: add contract for farming guildmaster Jane --- .../menuentryswapper/MenuEntrySwapperConfig.java | 10 ++++++++++ .../menuentryswapper/MenuEntrySwapperPlugin.java | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index f2030bd47d..23ab63df16 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -92,6 +92,16 @@ public interface MenuEntrySwapperConfig extends Config return false; } + @ConfigItem( + keyName = "swapContract", + name = "Contract", + description = "Swap Talk-to with Contract on Guildmaster Jane" + ) + default boolean swapContract() + { + return true; + } + @ConfigItem( keyName = "swapChase", name = "Chase", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index ca62eca65e..b164d10b86 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -388,6 +388,11 @@ public class MenuEntrySwapperPlugin extends Plugin swap("bank", option, target, true); } + if (config.swapContract()) + { + swap("contract", option, target, true); + } + if (config.swapExchange()) { swap("exchange", option, target, true); From 84009901cba1ac9856eb43a5ebd76879053632c9 Mon Sep 17 00:00:00 2001 From: Nathaniel Ngo Date: Mon, 18 Mar 2019 20:58:46 -0400 Subject: [PATCH 267/304] Log whole HTTP response instead of just message (#8126) Response message is usually either empty or not useful. Closes #8042 --- .../java/net/runelite/http/api/feed/FeedClient.java | 2 +- .../net/runelite/http/api/hiscore/HiscoreClient.java | 2 +- .../java/net/runelite/http/api/item/ItemClient.java | 12 ++++++------ .../http/api/loottracker/LootTrackerClient.java | 2 +- .../http/api/osbuddy/OSBGrandExchangeClient.java | 2 +- .../net/runelite/http/api/worlds/WorldClient.java | 2 +- .../runelite/http/service/feed/blog/BlogService.java | 2 +- .../http/service/feed/osrsnews/OSRSNewsService.java | 2 +- .../http/service/feed/twitter/TwitterService.java | 6 +++--- .../net/runelite/http/service/item/ItemService.java | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/feed/FeedClient.java b/http-api/src/main/java/net/runelite/http/api/feed/FeedClient.java index ea1fe18fd6..6b05ad20ba 100644 --- a/http-api/src/main/java/net/runelite/http/api/feed/FeedClient.java +++ b/http-api/src/main/java/net/runelite/http/api/feed/FeedClient.java @@ -55,7 +55,7 @@ public class FeedClient { if (!response.isSuccessful()) { - logger.debug("Error looking up feed: {}", response.message()); + logger.debug("Error looking up feed: {}", response); return null; } diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreClient.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreClient.java index 3f3f968d83..a725089de4 100644 --- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreClient.java +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreClient.java @@ -106,7 +106,7 @@ public class HiscoreClient case 404: return null; default: - throw new IOException("Error retrieving data from Jagex Hiscores: " + okresponse.message()); + throw new IOException("Error retrieving data from Jagex Hiscores: " + okresponse); } } diff --git a/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java b/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java index 2aa8b5c678..17784dd67b 100644 --- a/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java +++ b/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java @@ -63,7 +63,7 @@ public class ItemClient { if (!response.isSuccessful()) { - logger.debug("Error looking up item {}: {}", itemId, response.message()); + logger.debug("Error looking up item {}: {}", itemId, response); return null; } @@ -99,7 +99,7 @@ public class ItemClient { if (!response.isSuccessful()) { - logger.debug("Error looking up items {}: {}", Arrays.toString(itemIds), response.message()); + logger.debug("Error looking up items {}: {}", Arrays.toString(itemIds), response); return null; } @@ -130,7 +130,7 @@ public class ItemClient { if (!response.isSuccessful()) { - logger.debug("Error grabbing icon {}: {}", itemId, response.message()); + logger.debug("Error grabbing icon {}: {}", itemId, response); return null; } @@ -160,7 +160,7 @@ public class ItemClient { if (!response.isSuccessful()) { - logger.debug("Error looking up item {}: {}", itemName, response.message()); + logger.debug("Error looking up item {}: {}", itemName, response); return null; } @@ -191,7 +191,7 @@ public class ItemClient { if (!response.isSuccessful()) { - logger.warn("Error looking up prices: {}", response.message()); + logger.warn("Error looking up prices: {}", response); return null; } @@ -223,7 +223,7 @@ public class ItemClient { if (!response.isSuccessful()) { - logger.warn("Error looking up item stats: {}", response.message()); + logger.warn("Error looking up item stats: {}", response); return null; } diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java index 0d9ec845b3..d250620905 100644 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java +++ b/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java @@ -97,7 +97,7 @@ public class LootTrackerClient { if (!response.isSuccessful()) { - log.debug("Error looking up loot: {}", response.message()); + log.debug("Error looking up loot: {}", response); return null; } diff --git a/http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeClient.java b/http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeClient.java index ffdfad2035..c01337fdc0 100644 --- a/http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeClient.java +++ b/http-api/src/main/java/net/runelite/http/api/osbuddy/OSBGrandExchangeClient.java @@ -55,7 +55,7 @@ public class OSBGrandExchangeClient { if (!response.isSuccessful()) { - throw new IOException("Error looking up item id: " + response.message()); + throw new IOException("Error looking up item id: " + response); } final InputStream in = response.body().byteStream(); diff --git a/http-api/src/main/java/net/runelite/http/api/worlds/WorldClient.java b/http-api/src/main/java/net/runelite/http/api/worlds/WorldClient.java index 1ac8195cce..668e088404 100644 --- a/http-api/src/main/java/net/runelite/http/api/worlds/WorldClient.java +++ b/http-api/src/main/java/net/runelite/http/api/worlds/WorldClient.java @@ -57,7 +57,7 @@ public class WorldClient { if (!response.isSuccessful()) { - logger.debug("Error looking up worlds: {}", response.message()); + logger.debug("Error looking up worlds: {}", response); return null; } diff --git a/http-service/src/main/java/net/runelite/http/service/feed/blog/BlogService.java b/http-service/src/main/java/net/runelite/http/service/feed/blog/BlogService.java index 6b94b609d5..9da6cc171b 100644 --- a/http-service/src/main/java/net/runelite/http/service/feed/blog/BlogService.java +++ b/http-service/src/main/java/net/runelite/http/service/feed/blog/BlogService.java @@ -63,7 +63,7 @@ public class BlogService { if (!response.isSuccessful()) { - throw new IOException("Error getting blog posts: " + response.message()); + throw new IOException("Error getting blog posts: " + response); } try diff --git a/http-service/src/main/java/net/runelite/http/service/feed/osrsnews/OSRSNewsService.java b/http-service/src/main/java/net/runelite/http/service/feed/osrsnews/OSRSNewsService.java index 6936109343..0ae08bc85c 100644 --- a/http-service/src/main/java/net/runelite/http/service/feed/osrsnews/OSRSNewsService.java +++ b/http-service/src/main/java/net/runelite/http/service/feed/osrsnews/OSRSNewsService.java @@ -63,7 +63,7 @@ public class OSRSNewsService { if (!response.isSuccessful()) { - throw new IOException("Error getting OSRS news: " + response.message()); + throw new IOException("Error getting OSRS news: " + response); } try diff --git a/http-service/src/main/java/net/runelite/http/service/feed/twitter/TwitterService.java b/http-service/src/main/java/net/runelite/http/service/feed/twitter/TwitterService.java index 3ac032dc63..9bb9dc8595 100644 --- a/http-service/src/main/java/net/runelite/http/service/feed/twitter/TwitterService.java +++ b/http-service/src/main/java/net/runelite/http/service/feed/twitter/TwitterService.java @@ -103,9 +103,9 @@ public class TwitterService { return getTweets(true); } - throw new InternalServerErrorException("Could not auth to Twitter after trying once: " + response.message()); + throw new InternalServerErrorException("Could not auth to Twitter after trying once: " + response); default: - throw new IOException("Error getting Twitter list: " + response.message()); + throw new IOException("Error getting Twitter list: " + response); } } @@ -146,7 +146,7 @@ public class TwitterService { if (!response.isSuccessful()) { - throw new IOException("Error authing to Twitter: " + response.message()); + throw new IOException("Error authing to Twitter: " + response); } InputStream in = response.body().byteStream(); diff --git a/http-service/src/main/java/net/runelite/http/service/item/ItemService.java b/http-service/src/main/java/net/runelite/http/service/item/ItemService.java index 32569b0517..72a0fe85aa 100644 --- a/http-service/src/main/java/net/runelite/http/service/item/ItemService.java +++ b/http-service/src/main/java/net/runelite/http/service/item/ItemService.java @@ -377,7 +377,7 @@ public class ItemService { if (!response.isSuccessful()) { - throw new IOException("Unsuccessful http response: " + response.message()); + throw new IOException("Unsuccessful http response: " + response); } InputStream in = response.body().byteStream(); @@ -401,7 +401,7 @@ public class ItemService { if (!response.isSuccessful()) { - throw new IOException("Unsuccessful http response: " + response.message()); + throw new IOException("Unsuccessful http response: " + response); } return response.body().bytes(); From fc786e334b534c9086cbf45994e0692f87d80531 Mon Sep 17 00:00:00 2001 From: RyBo Date: Mon, 18 Mar 2019 20:53:08 -0600 Subject: [PATCH 268/304] achievement diary: add or correct various requirements * Add fishing requirement to ardougne easy diary, Change fremmy quest requirement to started * Kandarin Diary: Add quest and skill requirement * Morytania diary: Add quest requirement and change skill requirement * Falador diary: add quest requirement * Kandarin diary: fix typo in task description * Fremmy diary: Add period at end of task description * Ardougne diary: Add period in task description * Western diary: change agility requirement from 50 to 56 --- .../achievementdiary/diaries/ArdougneDiaryRequirement.java | 2 ++ .../achievementdiary/diaries/FaladorDiaryRequirement.java | 2 ++ .../achievementdiary/diaries/FremennikDiaryRequirement.java | 4 ++-- .../achievementdiary/diaries/KandarinDiaryRequirement.java | 5 ++++- .../achievementdiary/diaries/MorytaniaDiaryRequirement.java | 4 +++- .../achievementdiary/diaries/WesternDiaryRequirement.java | 2 +- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java index 0ef1683447..85adb4db7b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java @@ -42,6 +42,8 @@ public class ArdougneDiaryRequirement extends GenericDiaryRequirement new SkillRequirement(Skill.THIEVING, 5)); add("Enter the Combat Training Camp north of W. Ardougne.", new QuestRequirement(Quest.BIOHAZARD)); + add("Go out fishing on the Fishing Trawler.", + new SkillRequirement(Skill.FISHING, 15)); // MEDIUM add("Enter the Unicorn pen in Ardougne zoo using Fairy rings.", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FaladorDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FaladorDiaryRequirement.java index 3111b0d6e1..30f7843199 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FaladorDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FaladorDiaryRequirement.java @@ -94,6 +94,8 @@ public class FaladorDiaryRequirement extends GenericDiaryRequirement new SkillRequirement(Skill.AGILITY, 50)); add("Enter the mining guild wearing full prospector.", new SkillRequirement(Skill.MINING, 60)); + add("Kill the Blue Dragon under the Heroes' Guild.", + new QuestRequirement(Quest.HEROES_QUEST)); add("Crack a wall safe within Rogues Den.", new SkillRequirement(Skill.THIEVING, 50)); add("Recharge your prayer in the Port Sarim church while wearing full Proselyte.", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FremennikDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FremennikDiaryRequirement.java index 130432035b..46c708efbb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FremennikDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FremennikDiaryRequirement.java @@ -50,9 +50,9 @@ public class FremennikDiaryRequirement extends GenericDiaryRequirement add("Steal from the Keldagrim crafting or baker's stall.", new SkillRequirement(Skill.THIEVING, 5), new QuestRequirement(Quest.THE_GIANT_DWARF, true)); - add("Enter the Troll Stronghold", + add("Enter the Troll Stronghold.", new QuestRequirement(Quest.DEATH_PLATEAU), - new QuestRequirement(Quest.TROLL_STRONGHOLD)); + new QuestRequirement(Quest.TROLL_STRONGHOLD, true)); add("Chop and burn some oak logs in the Fremennik Province.", new SkillRequirement(Skill.WOODCUTTING, 15), new SkillRequirement(Skill.FIREMAKING, 15)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KandarinDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KandarinDiaryRequirement.java index 0b775a0dba..ef9df50ce2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KandarinDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KandarinDiaryRequirement.java @@ -40,7 +40,7 @@ public class KandarinDiaryRequirement extends GenericDiaryRequirement new SkillRequirement(Skill.FISHING, 16)); add("Plant some Jute seeds in the patch north of McGrubor's Wood.", new SkillRequirement(Skill.FARMING, 13)); - add("Defeat on of each elemental in the workshop.", + add("Defeat one of each elemental in the workshop.", new QuestRequirement(Quest.ELEMENTAL_WORKSHOP_I, true)); add("Cross the Coal truck log shortcut.", new SkillRequirement(Skill.AGILITY, 20)); @@ -96,6 +96,9 @@ public class KandarinDiaryRequirement extends GenericDiaryRequirement new SkillRequirement(Skill.MAGIC, 56)); add("Burn some Maple logs with a bow in Seers' Village.", new SkillRequirement(Skill.FIREMAKING, 65)); + add("Kill a Shadow Hound in the Shadow dungeon.", + new SkillRequirement(Skill.THIEVING, 53), + new QuestRequirement(Quest.DESERT_TREASURE, true)); add("Purchase and equip a granite body from Barbarian Assault.", new SkillRequirement(Skill.STRENGTH, 50), new SkillRequirement(Skill.DEFENCE, 50)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/MorytaniaDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/MorytaniaDiaryRequirement.java index 9b9a861779..826b1a8410 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/MorytaniaDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/MorytaniaDiaryRequirement.java @@ -48,6 +48,8 @@ public class MorytaniaDiaryRequirement extends GenericDiaryRequirement new SkillRequirement(Skill.SLAYER, 15)); add("Place a Scarecrow in the Morytania flower patch.", new SkillRequirement(Skill.FARMING, 23)); + add("Kill a werewolf in its human form using the Wolfbane Dagger.", + new QuestRequirement(Quest.PRIEST_IN_PERIL)); add("Restore your prayer points at the nature altar.", new QuestRequirement(Quest.NATURE_SPIRIT)); @@ -74,7 +76,7 @@ public class MorytaniaDiaryRequirement extends GenericDiaryRequirement add("Use an ectophial to return to Port Phasmatys.", new QuestRequirement(Quest.GHOSTS_AHOY)); add("Mix a Guthix Balance potion while in Morytania.", - new SkillRequirement(Skill.HERBLORE, 36), + new SkillRequirement(Skill.HERBLORE, 22), new QuestRequirement(Quest.IN_AID_OF_THE_MYREQUE, true)); // HARD diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WesternDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WesternDiaryRequirement.java index be612338e8..ee67f45132 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WesternDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WesternDiaryRequirement.java @@ -88,7 +88,7 @@ public class WesternDiaryRequirement extends GenericDiaryRequirement // HARD add("Kill an Elf with a Crystal bow.", new SkillRequirement(Skill.RANGED, 70), - new SkillRequirement(Skill.AGILITY, 50), + new SkillRequirement(Skill.AGILITY, 56), new QuestRequirement(Quest.ROVING_ELVES)); add("Catch and cook a Monkfish in Piscatoris.", new SkillRequirement(Skill.FISHING, 62), From cb574a1fb0726e5d5bdfb3ec17fe7f36eca918ae Mon Sep 17 00:00:00 2001 From: Magic fTail Date: Thu, 20 Dec 2018 04:29:54 +0100 Subject: [PATCH 269/304] api: rename getOverhead to getOverheadText --- runelite-api/src/main/java/net/runelite/api/Actor.java | 2 +- runescape-api/src/main/java/net/runelite/rs/api/RSActor.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Actor.java b/runelite-api/src/main/java/net/runelite/api/Actor.java index 14763d51a1..70ba1ae85c 100644 --- a/runelite-api/src/main/java/net/runelite/api/Actor.java +++ b/runelite-api/src/main/java/net/runelite/api/Actor.java @@ -238,5 +238,5 @@ public interface Actor extends Renderable * * @return the overhead text */ - String getOverhead(); + String getOverheadText(); } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSActor.java b/runescape-api/src/main/java/net/runelite/rs/api/RSActor.java index 225d62b72e..decded8761 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSActor.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSActor.java @@ -34,7 +34,7 @@ public interface RSActor extends RSRenderable, Actor @Import("overhead") @Override - String getOverhead(); + String getOverheadText(); @Import("x") int getX(); From ee9806573569a651ec5ee208c9d405ac7a9de092 Mon Sep 17 00:00:00 2001 From: Magic fTail Date: Thu, 20 Dec 2018 04:31:59 +0100 Subject: [PATCH 270/304] api: add overhead text changed event and setOverheadText --- .../src/main/java/net/runelite/api/Actor.java | 7 ++++ .../api/events/OverheadTextChanged.java | 39 +++++++++++++++++++ .../net/runelite/mixins/RSActorMixin.java | 13 +++++++ .../java/net/runelite/rs/api/RSActor.java | 4 ++ 4 files changed, 63 insertions(+) create mode 100644 runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java diff --git a/runelite-api/src/main/java/net/runelite/api/Actor.java b/runelite-api/src/main/java/net/runelite/api/Actor.java index 70ba1ae85c..6357a91ebc 100644 --- a/runelite-api/src/main/java/net/runelite/api/Actor.java +++ b/runelite-api/src/main/java/net/runelite/api/Actor.java @@ -239,4 +239,11 @@ public interface Actor extends Renderable * @return the overhead text */ String getOverheadText(); + + /** + * Sets the overhead text that is displayed above the actor + * + * @param overheadText the overhead text + */ + void setOverheadText(String overheadText); } diff --git a/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java b/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java new file mode 100644 index 0000000000..a366eb297a --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018, Magic fTail + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.events; + +import lombok.Value; +import net.runelite.api.Actor; + +/** + * Event fired when an actors overhead text is changed. + */ +@Value +public class OverheadTextChanged +{ + private final Actor actor; + + private final String overheadText; +} \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java index 437e2a76d9..cc72387a6d 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSActorMixin.java @@ -43,6 +43,7 @@ import net.runelite.api.events.GraphicChanged; import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.LocalPlayerDeath; +import net.runelite.api.events.OverheadTextChanged; import net.runelite.api.mixins.FieldHook; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.MethodHook; @@ -208,6 +209,18 @@ public abstract class RSActorMixin implements RSActor client.getCallbacks().post(interactingChanged); } + @FieldHook("overhead") + @Inject + public void overheadTextChanged(int idx) + { + String overheadText = getOverheadText(); + if (overheadText != null) + { + OverheadTextChanged overheadTextChanged = new OverheadTextChanged(this, overheadText); + client.getCallbacks().post(overheadTextChanged); + } + } + @Inject @Override public Polygon getConvexHull() diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSActor.java b/runescape-api/src/main/java/net/runelite/rs/api/RSActor.java index decded8761..801cf4413a 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSActor.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSActor.java @@ -36,6 +36,10 @@ public interface RSActor extends RSRenderable, Actor @Override String getOverheadText(); + @Import("overhead") + @Override + void setOverheadText(String overheadText); + @Import("x") int getX(); From 68196a45f7b64e81eb624df363d3c3459b16f4b2 Mon Sep 17 00:00:00 2001 From: WooxSolo Date: Tue, 19 Mar 2019 15:36:48 -0400 Subject: [PATCH 271/304] config manager: add support for WorldPoint --- .../net/runelite/client/config/ConfigManager.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index dc3fc07e41..fbf2c296cf 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -59,6 +59,7 @@ import java.util.stream.Collectors; import javax.inject.Inject; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; +import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ConfigChanged; import net.runelite.client.RuneLite; import net.runelite.client.account.AccountSession; @@ -588,6 +589,14 @@ public class ConfigManager } return new Keybind(code, mods); } + if (type == WorldPoint.class) + { + String[] splitStr = str.split(":"); + int x = Integer.parseInt(splitStr[0]); + int y = Integer.parseInt(splitStr[1]); + int plane = Integer.parseInt(splitStr[2]); + return new WorldPoint(x, y, plane); + } return str; } @@ -625,6 +634,11 @@ public class ConfigManager Keybind k = (Keybind) object; return k.getKeyCode() + ":" + k.getModifiers(); } + if (object instanceof WorldPoint) + { + WorldPoint wp = (WorldPoint) object; + return wp.getX() + ":" + wp.getY() + ":" + wp.getPlane(); + } return object.toString(); } From 5008ecefaa40858f6c8a931edc17ab544308e5f6 Mon Sep 17 00:00:00 2001 From: WooxSolo Date: Tue, 19 Mar 2019 15:37:39 -0400 Subject: [PATCH 272/304] config manager: add support for Duration --- .../java/net/runelite/client/config/ConfigManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index fbf2c296cf..87f63d3826 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -45,6 +45,7 @@ import java.nio.channels.FileLock; import java.nio.charset.Charset; import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.time.Duration; import java.time.Instant; import java.util.Arrays; import java.util.Date; @@ -597,6 +598,10 @@ public class ConfigManager int plane = Integer.parseInt(splitStr[2]); return new WorldPoint(x, y, plane); } + if (type == Duration.class) + { + return Duration.ofMillis(Long.parseLong(str)); + } return str; } @@ -639,6 +644,10 @@ public class ConfigManager WorldPoint wp = (WorldPoint) object; return wp.getX() + ":" + wp.getY() + ":" + wp.getPlane(); } + if (object instanceof Duration) + { + return Long.toString(((Duration) object).toMillis()); + } return object.toString(); } From c74b3b9ab5ccbdba1216ddc0e54dfbf5cc8f7994 Mon Sep 17 00:00:00 2001 From: WooxSolo Date: Tue, 19 Mar 2019 15:38:31 -0400 Subject: [PATCH 273/304] Add NPC unaggression timer --- .../net/runelite/api/coords/WorldArea.java | 26 +- .../net/runelite/api/geometry/Geometry.java | 454 +++++++++++++++++ .../npcunaggroarea/AggressionTimer.java | 68 +++ .../npcunaggroarea/NpcAggroAreaConfig.java | 95 ++++ .../NpcAggroAreaNotWorkingOverlay.java | 66 +++ .../npcunaggroarea/NpcAggroAreaOverlay.java | 119 +++++ .../npcunaggroarea/NpcAggroAreaPlugin.java | 474 ++++++++++++++++++ 7 files changed, 1300 insertions(+), 2 deletions(-) create mode 100644 runelite-api/src/main/java/net/runelite/api/geometry/Geometry.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/AggressionTimer.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaNotWorkingOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java index ea96884f72..9abb3aeac8 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java @@ -114,8 +114,7 @@ public class WorldArea return Integer.MAX_VALUE; } - Point distances = getAxisDistances(other); - return Math.max(distances.getX(), distances.getY()); + return distanceTo2D(other); } /** @@ -129,6 +128,29 @@ public class WorldArea return distanceTo(new WorldArea(other, 1, 1)); } + /** + * Computes the shortest distance to another area while ignoring the plane. + * + * @param other the passed area + * @return the distance + */ + public int distanceTo2D(WorldArea other) + { + Point distances = getAxisDistances(other); + return Math.max(distances.getX(), distances.getY()); + } + + /** + * Computes the shortest distance to a world coordinate. + * + * @param other the passed coordinate + * @return the distance + */ + public int distanceTo2D(WorldPoint other) + { + return distanceTo2D(new WorldArea(other, 1, 1)); + } + /** * Checks whether this area is within melee distance of another. *

diff --git a/runelite-api/src/main/java/net/runelite/api/geometry/Geometry.java b/runelite-api/src/main/java/net/runelite/api/geometry/Geometry.java new file mode 100644 index 0000000000..39efa74afa --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/geometry/Geometry.java @@ -0,0 +1,454 @@ +/* + * Copyright (c) 2018, Woox + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.geometry; + +import java.awt.Shape; +import java.awt.geom.AffineTransform; +import java.awt.geom.GeneralPath; +import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; +import java.util.LinkedList; +import java.util.List; +import java.util.function.BiPredicate; +import java.util.function.Consumer; + +public class Geometry +{ + /** + * Find the point where two lines intersect. + * + * @param x1 X coordinate of the first endpoint of the first line. + * @param y1 Y coordinate of the first endpoint of the first line. + * @param x2 X coordinate of the second endpoint of the first line. + * @param y2 Y coordinate of the second endpoint of the first line. + * @param x3 X coordinate of the first endpoint of the second line. + * @param y3 Y coordinate of the first endpoint of the second line. + * @param x4 X coordinate of the second endpoint of the second line. + * @param y4 Y coordinate of the second endpoint of the second line. + * @return The intersection point of the lines, or null if the lines don't intersect. + */ + public static Point2D.Float lineIntersectionPoint( + float x1, float y1, float x2, float y2, + float x3, float y3, float x4, float y4) + { + // https://stackoverflow.com/a/1968345 + + float p1x = x2 - x1; + float p1y = y2 - y1; + float p2x = x4 - x3; + float p2y = y4 - y3; + + float s = (-p1y * (x1 - x3) + p1x * (y1 - y3)) / (-p2x * p1y + p1x * p2y); + float t = ( p2x * (y1 - y3) - p2y * (x1 - x3)) / (-p2x * p1y + p1x * p2y); + + if (s >= 0 && s <= 1 && t >= 0 && t <= 1) + { + float x = x1 + (t * p1x); + float y = y1 + (t * p1y); + return new Point2D.Float(x, y); + } + + // No intersection + return null; + } + + /** + * Find the intersection points between a Shape and a line. + * + * @param shape The shape. + * @param x1 X coordinate of the first endpoint of the line. + * @param y1 Y coordinate of the first endpoint of the line. + * @param x2 X coordinate of the second endpoint of the line. + * @param y2 Y coordinate of the second endpoint of the line. + * @return A list with the intersection points. + */ + public static List intersectionPoints(Shape shape, float x1, float y1, float x2, float y2) + { + List intersections = new LinkedList<>(); + + PathIterator it = shape.getPathIterator(new AffineTransform()); + float[] coords = new float[2]; + float[] prevCoords = new float[2]; + float[] start = new float[2]; + while (!it.isDone()) + { + int type = it.currentSegment(coords); + if (type == PathIterator.SEG_MOVETO) + { + start[0] = coords[0]; + start[1] = coords[1]; + prevCoords[0] = coords[0]; + prevCoords[1] = coords[1]; + } + else if (type == PathIterator.SEG_LINETO) + { + Point2D.Float intersection = lineIntersectionPoint( + prevCoords[0], prevCoords[1], coords[0], coords[1], x1, y1, x2, y2); + if (intersection != null) + { + intersections.add(intersection); + } + prevCoords[0] = coords[0]; + prevCoords[1] = coords[1]; + } + else if (type == PathIterator.SEG_CLOSE) + { + Point2D.Float intersection = lineIntersectionPoint( + coords[0], coords[1], start[0], start[1], x1, y1, x2, y2); + if (intersection != null) + { + intersections.add(intersection); + } + } + it.next(); + } + + return intersections; + } + + /** + * Transforms the points in a path according to a method. + * + * @param it The iterator of the path to change the points on. + * @param method The method to use to transform the points. Takes a float[2] array with x and y coordinates as parameter. + * @return The transformed path. + */ + public static GeneralPath transformPath(PathIterator it, Consumer method) + { + GeneralPath path = new GeneralPath(); + float[] coords = new float[2]; + while (!it.isDone()) + { + int type = it.currentSegment(coords); + if (type == PathIterator.SEG_MOVETO) + { + method.accept(coords); + path.moveTo(coords[0], coords[1]); + } + else if (type == PathIterator.SEG_LINETO) + { + method.accept(coords); + path.lineTo(coords[0], coords[1]); + } + else if (type == PathIterator.SEG_CLOSE) + { + path.closePath(); + } + it.next(); + } + + return path; + } + + /** + * Transforms the points in a path according to a method. + * + * @param path The path to change the points on. + * @param method The method to use to transform the points. Takes a float[2] array with x and y coordinates as parameter. + * @return The transformed path. + */ + public static GeneralPath transformPath(GeneralPath path, Consumer method) + { + return transformPath(path.getPathIterator(new AffineTransform()), method); + } + + /** + * Splits a line into smaller segments and appends the segments to a path. + * + * @param path The path to append lines to. + * @param segmentLength The desired length to use for the segmented lines. + * @param x1 X coordinate of the first endpoint of the line. + * @param y1 Y coordinate of the first endpoint of the line. + * @param x2 X coordinate of the second endpoint of the line. + * @param y2 Y coordinate of the second endpoint of the line. + */ + private static void appendSegmentLines(GeneralPath path, float segmentLength, + float x1, float y1, float x2, float y2) + { + float x = x1; + float y = y1; + float angle = (float)Math.atan2(y2 - y1, x2 - x1); + float dx = (float)Math.cos(angle) * segmentLength; + float dy = (float)Math.sin(angle) * segmentLength; + float length = (float)Math.hypot(x2 - x1, y2 - y1); + int steps = (int)((length - 1e-4) / segmentLength); + for (int i = 0; i < steps; i++) + { + x += dx; + y += dy; + path.lineTo(x, y); + } + } + + /** + * Splits a path into smaller segments. + * For example, calling this on a path with a line of length 6, with desired + * segment length of 2, would split the path into 3 consecutive lines of length 2. + * + * @param it The iterator of the path to modify. + * @param segmentLength The desired length to use for the segments. + * @return The modified path. + */ + public static GeneralPath splitIntoSegments(PathIterator it, float segmentLength) + { + GeneralPath newPath = new GeneralPath(); + float[] prevCoords = new float[2]; + float[] coords = new float[2]; + float[] startCoords = new float[2]; + while (!it.isDone()) + { + int type = it.currentSegment(coords); + if (type == PathIterator.SEG_MOVETO) + { + startCoords[0] = coords[0]; + startCoords[1] = coords[1]; + newPath.moveTo(coords[0], coords[1]); + prevCoords[0] = coords[0]; + prevCoords[1] = coords[1]; + } + else if (type == PathIterator.SEG_LINETO) + { + appendSegmentLines(newPath, segmentLength, prevCoords[0], prevCoords[1], coords[0], coords[1]); + newPath.lineTo(coords[0], coords[1]); + prevCoords[0] = coords[0]; + prevCoords[1] = coords[1]; + } + else if (type == PathIterator.SEG_CLOSE) + { + appendSegmentLines(newPath, segmentLength, coords[0], coords[1], startCoords[0], startCoords[1]); + newPath.closePath(); + } + it.next(); + } + + return newPath; + } + + /** + * Splits a path into smaller segments. + * For example, calling this on a path with a line of length 6, with desired + * segment length of 2, would split the path into 3 consecutive lines of length 2. + * + * @param path The path to modify. + * @param segmentLength The desired length to use for the segments. + * @return The modified path. + */ + public static GeneralPath splitIntoSegments(GeneralPath path, float segmentLength) + { + return splitIntoSegments(path.getPathIterator(new AffineTransform()), segmentLength); + } + + /** + * Removes lines from a path according to a method. + * + * @param it The iterator of the path to filter. + * @param method The method to use to decide which lines to remove. Takes two float[2] arrays with x and y coordinates of the endpoints of the line. Lines for which the predicate returns false are removed. + * @return The filtered path. + */ + public static GeneralPath filterPath(PathIterator it, BiPredicate method) + { + GeneralPath newPath = new GeneralPath(); + float[] prevCoords = new float[2]; + float[] coords = new float[2]; + float[] start = new float[2]; + boolean shouldMoveNext = false; + while (!it.isDone()) + { + int type = it.currentSegment(coords); + if (type == PathIterator.SEG_MOVETO) + { + start[0] = coords[0]; + start[1] = coords[1]; + prevCoords[0] = coords[0]; + prevCoords[1] = coords[1]; + shouldMoveNext = true; + } + else if (type == PathIterator.SEG_LINETO) + { + if (method.test(prevCoords, coords)) + { + if (shouldMoveNext) + { + newPath.moveTo(prevCoords[0], prevCoords[1]); + shouldMoveNext = false; + } + newPath.lineTo(coords[0], coords[1]); + } + else + { + shouldMoveNext = true; + } + prevCoords[0] = coords[0]; + prevCoords[1] = coords[1]; + } + else if (type == PathIterator.SEG_CLOSE) + { + if (shouldMoveNext) + { + newPath.moveTo(prevCoords[0], prevCoords[1]); + } + if (method.test(prevCoords, start)) + { + newPath.lineTo(start[0], start[1]); + } + shouldMoveNext = false; + } + it.next(); + } + + return newPath; + } + + /** + * Removes lines from a path according to a method. + * + * @param path The path to filter. + * @param method The method to use to decide which lines to remove. Takes two float[2] arrays with x and y coordinates of the endpoints of the line. Lines for which the predicate returns false are removed. + * @return The filtered path. + */ + public static GeneralPath filterPath(GeneralPath path, BiPredicate method) + { + return filterPath(path.getPathIterator(new AffineTransform()), method); + } + + /** + * Removes lines from a path that lie outside the clipping area and cuts + * lines intersecting with the clipping area so the resulting lines + * lie within the clipping area. + * + * @param it The iterator of the path to clip. + * @param shape The clipping area to clip with. + * @return The clipped path. + */ + public static GeneralPath clipPath(PathIterator it, Shape shape) + { + GeneralPath newPath = new GeneralPath(); + float[] prevCoords = new float[2]; + float[] coords = new float[2]; + float[] start = new float[2]; + float[] nextMove = new float[2]; + boolean shouldMove = false; + boolean wasInside = false; + while (!it.isDone()) + { + int type = it.currentSegment(coords); + if (type == PathIterator.SEG_MOVETO) + { + start[0] = coords[0]; + start[1] = coords[1]; + wasInside = shape.contains(coords[0], coords[1]); + if (wasInside) + { + nextMove[0] = coords[0]; + nextMove[1] = coords[1]; + shouldMove = true; + } + prevCoords[0] = coords[0]; + prevCoords[1] = coords[1]; + } + else if (type == PathIterator.SEG_LINETO || type == PathIterator.SEG_CLOSE) + { + if (type == PathIterator.SEG_CLOSE) + { + coords[0] = start[0]; + coords[1] = start[1]; + } + + List intersections = intersectionPoints(shape, prevCoords[0], prevCoords[1], coords[0], coords[1]); + intersections.sort((a, b) -> + { + double diff = a.distance(prevCoords[0], prevCoords[1]) - b.distance(prevCoords[0], prevCoords[1]); + if (diff < 0) + { + return -1; + } + if (diff > 0) + { + return 1; + } + return 0; + }); + + for (Point2D.Float intersection : intersections) + { + if (wasInside) + { + if (shouldMove) + { + newPath.moveTo(nextMove[0], nextMove[1]); + shouldMove = false; + } + newPath.lineTo(intersection.getX(), intersection.getY()); + } + else + { + nextMove[0] = intersection.x; + nextMove[1] = intersection.y; + shouldMove = true; + } + wasInside = !wasInside; + prevCoords[0] = intersection.x; + prevCoords[1] = intersection.y; + } + + wasInside = shape.contains(coords[0], coords[1]); + if (wasInside) + { + if (shouldMove) + { + newPath.moveTo(nextMove[0], nextMove[1]); + shouldMove = false; + } + newPath.lineTo(coords[0], coords[1]); + } + else + { + nextMove[0] = coords[0]; + nextMove[1] = coords[1]; + shouldMove = true; + } + + prevCoords[0] = coords[0]; + prevCoords[1] = coords[1]; + } + it.next(); + } + return newPath; + } + + /** + * Removes lines from a path that lie outside the clipping area and cuts + * lines intersecting with the clipping area so the resulting lines + * lie within the clipping area. + * + * @param path The path to clip. + * @param shape The clipping area to clip with. + * @return The clipped path. + */ + public static GeneralPath clipPath(GeneralPath path, Shape shape) + { + return clipPath(path.getPathIterator(new AffineTransform()), shape); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/AggressionTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/AggressionTimer.java new file mode 100644 index 0000000000..7194d2ddd6 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/AggressionTimer.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2018, Woox + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcunaggroarea; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import java.time.Duration; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import lombok.Getter; +import lombok.Setter; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.ui.overlay.infobox.Timer; + +class AggressionTimer extends Timer +{ + @Getter + @Setter + private boolean visible; + + AggressionTimer(Duration duration, BufferedImage image, Plugin plugin, boolean visible) + { + super(duration.toMillis(), ChronoUnit.MILLIS, image, plugin); + setTooltip("Time until NPCs become unaggressive"); + this.visible = visible; + } + + @Override + public Color getTextColor() + { + Duration timeLeft = Duration.between(Instant.now(), getEndTime()); + + if (timeLeft.getSeconds() < 60) + { + return Color.RED.brighter(); + } + + return Color.WHITE; + } + + @Override + public boolean render() + { + return visible && super.render(); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java new file mode 100644 index 0000000000..a0e4992e31 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2018, Woox + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcunaggroarea; + +import java.awt.Color; +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("npcUnaggroArea") +public interface NpcAggroAreaConfig extends Config +{ + String CONFIG_GROUP = "npcUnaggroArea"; + String CONFIG_CENTER1 = "center1"; + String CONFIG_CENTER2 = "center2"; + String CONFIG_LOCATION = "location"; + String CONFIG_DURATION = "duration"; + + @ConfigItem( + keyName = "npcUnaggroAlwaysActive", + name = "Always active", + description = "Always show this plugins overlays
Otherwise, they will only be shown when any NPC name matches the list", + position = 1 + ) + default boolean alwaysActive() + { + return false; + } + + @ConfigItem( + keyName = "npcUnaggroNames", + name = "NPC names", + description = "Enter names of NPCs where you wish to use this plugin", + position = 2 + ) + default String npcNamePatterns() + { + return ""; + } + + @ConfigItem( + keyName = "npcUnaggroShowTimer", + name = "Show timer", + description = "Display a timer until NPCs become unaggressive", + position = 3 + ) + default boolean showTimer() + { + return true; + } + + @ConfigItem( + keyName = "npcUnaggroShowAreaLines", + name = "Show area lines", + description = "Display lines, when walked past, the unaggressive timer resets", + position = 4 + ) + default boolean showAreaLines() + { + return false; + } + + @ConfigItem( + keyName = "npcUnaggroAreaColor", + name = "Area lines colour", + description = "Choose colour to use for marking NPC unaggressive area", + position = 5 + ) + default Color aggroAreaColor() + { + return Color.YELLOW; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaNotWorkingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaNotWorkingOverlay.java new file mode 100644 index 0000000000..0a9dedb357 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaNotWorkingOverlay.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2018, Woox + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcunaggroarea; + +import com.google.inject.Inject; +import java.awt.Dimension; +import java.awt.Graphics2D; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.components.LineComponent; +import net.runelite.client.ui.overlay.components.PanelComponent; + +class NpcAggroAreaNotWorkingOverlay extends Overlay +{ + private final NpcAggroAreaPlugin plugin; + private final PanelComponent panelComponent; + + @Inject + private NpcAggroAreaNotWorkingOverlay(NpcAggroAreaPlugin plugin) + { + this.plugin = plugin; + + panelComponent = new PanelComponent(); + panelComponent.setPreferredSize(new Dimension(150, 0)); + panelComponent.getChildren().add(LineComponent.builder() + .left("Unaggressive NPC timers will start working when you teleport far away or enter a dungeon.") + .build()); + + setPriority(OverlayPriority.LOW); + setPosition(OverlayPosition.TOP_LEFT); + } + + @Override + public Dimension render(Graphics2D graphics) + { + if (!plugin.isActive() || plugin.getSafeCenters()[1] != null) + { + return null; + } + + return panelComponent.render(graphics); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaOverlay.java new file mode 100644 index 0000000000..811952de57 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaOverlay.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2018, Woox + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcunaggroarea; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.geom.GeneralPath; +import java.time.Instant; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.Perspective; +import net.runelite.api.Point; +import net.runelite.api.coords.LocalPoint; +import net.runelite.api.geometry.Geometry; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayLayer; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.OverlayPriority; + +class NpcAggroAreaOverlay extends Overlay +{ + private static final int MAX_LOCAL_DRAW_LENGTH = 20 * Perspective.LOCAL_TILE_SIZE; + + private final Client client; + private final NpcAggroAreaConfig config; + private final NpcAggroAreaPlugin plugin; + + @Inject + private NpcAggroAreaOverlay(Client client, NpcAggroAreaConfig config, NpcAggroAreaPlugin plugin) + { + this.client = client; + this.config = config; + this.plugin = plugin; + + setLayer(OverlayLayer.ABOVE_SCENE); + setPriority(OverlayPriority.LOW); + setPosition(OverlayPosition.DYNAMIC); + } + + @Override + public Dimension render(Graphics2D graphics) + { + if (!plugin.isActive() || plugin.getSafeCenters()[1] == null) + { + return null; + } + + GeneralPath lines = plugin.getLinesToDisplay()[client.getPlane()]; + if (lines == null) + { + return null; + } + + Color outlineColor = config.aggroAreaColor(); + AggressionTimer timer = plugin.getCurrentTimer(); + if (timer == null || Instant.now().compareTo(timer.getEndTime()) < 0) + { + outlineColor = new Color( + outlineColor.getRed(), + outlineColor.getGreen(), + outlineColor.getBlue(), + 100); + } + + renderPath(graphics, lines, outlineColor); + return null; + } + + private void renderPath(Graphics2D graphics, GeneralPath path, Color color) + { + LocalPoint playerLp = client.getLocalPlayer().getLocalLocation(); + Rectangle viewArea = new Rectangle( + playerLp.getX() - MAX_LOCAL_DRAW_LENGTH, + playerLp.getY() - MAX_LOCAL_DRAW_LENGTH, + MAX_LOCAL_DRAW_LENGTH * 2, + MAX_LOCAL_DRAW_LENGTH * 2); + + graphics.setColor(color); + graphics.setStroke(new BasicStroke(1)); + + path = Geometry.clipPath(path, viewArea); + path = Geometry.filterPath(path, (p1, p2) -> + Perspective.localToCanvas(client, new LocalPoint((int)p1[0], (int)p1[1]), client.getPlane()) != null && + Perspective.localToCanvas(client, new LocalPoint((int)p2[0], (int)p2[1]), client.getPlane()) != null); + path = Geometry.transformPath(path, coords -> + { + Point point = Perspective.localToCanvas(client, new LocalPoint((int)coords[0], (int)coords[1]), client.getPlane()); + coords[0] = point.getX(); + coords[1] = point.getY(); + }); + + graphics.draw(path); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java new file mode 100644 index 0000000000..0020d54d25 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java @@ -0,0 +1,474 @@ +/* + * Copyright (c) 2018, Woox + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.npcunaggroarea; + +import com.google.common.base.Splitter; +import com.google.common.base.Strings; +import com.google.inject.Provides; +import java.awt.Polygon; +import java.awt.Rectangle; +import java.awt.geom.Area; +import java.awt.geom.GeneralPath; +import java.awt.image.BufferedImage; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import javax.inject.Inject; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; +import net.runelite.api.Constants; +import net.runelite.api.ItemID; +import net.runelite.api.NPC; +import net.runelite.api.NPCComposition; +import net.runelite.api.Perspective; +import net.runelite.api.coords.LocalPoint; +import net.runelite.api.coords.WorldArea; +import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.GameStateChanged; +import net.runelite.api.events.GameTick; +import net.runelite.api.events.NpcSpawned; +import net.runelite.api.geometry.Geometry; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.ItemManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.ui.overlay.infobox.InfoBoxManager; +import net.runelite.client.util.WildcardMatcher; + +@Slf4j +@PluginDescriptor( + name = "Unaggressive NPC timer", + description = "Highlights the unaggressive area of NPCs nearby and timer until it becomes active", + tags = {"highlight", "lines", "unaggro", "aggro", "aggressive", "npcs", "area", "timer", "slayer"}, + enabledByDefault = false +) +public class NpcAggroAreaPlugin extends Plugin +{ + /* + How it works: The game remembers 2 tiles. When the player goes >10 steps + away from both tiles, the oldest one is moved to under the player and the + NPC aggression timer resets. + So to first figure out where the 2 tiles are, we wait until the player teleports + a long enough distance. At that point it's very likely that the player + moved out of the radius of both tiles, which resets one of them. The other + should reset shortly after as the player starts moving around. + */ + + private static final int SAFE_AREA_RADIUS = 10; + private static final int UNKNOWN_AREA_RADIUS = SAFE_AREA_RADIUS * 2; + private static final int AGGRESSIVE_TIME_SECONDS = 600; + private static final Splitter NAME_SPLITTER = Splitter.on(',').omitEmptyStrings().trimResults(); + private static final WorldArea WILDERNESS_ABOVE_GROUND = new WorldArea(2944, 3523, 448, 448, 0); + private static final WorldArea WILDERNESS_UNDERGROUND = new WorldArea(2944, 9918, 320, 442, 0); + + @Inject + private Client client; + + @Inject + private NpcAggroAreaConfig config; + + @Inject + private NpcAggroAreaOverlay overlay; + + @Inject + private NpcAggroAreaNotWorkingOverlay notWorkingOverlay; + + @Inject + private OverlayManager overlayManager; + + @Inject + private ItemManager itemManager; + + @Inject + private InfoBoxManager infoBoxManager; + + @Inject + private ConfigManager configManager; + + @Getter + private final WorldPoint[] safeCenters = new WorldPoint[2]; + + @Getter + private final GeneralPath[] linesToDisplay = new GeneralPath[Constants.MAX_Z]; + + @Getter + private boolean active; + + @Getter + private AggressionTimer currentTimer; + + private WorldPoint lastPlayerLocation; + private WorldPoint previousUnknownCenter; + private boolean loggingIn; + private List npcNamePatterns; + + @Provides + NpcAggroAreaConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(NpcAggroAreaConfig.class); + } + + @Override + protected void startUp() throws Exception + { + overlayManager.add(overlay); + overlayManager.add(notWorkingOverlay); + npcNamePatterns = NAME_SPLITTER.splitToList(config.npcNamePatterns()); + } + + @Override + protected void shutDown() throws Exception + { + removeTimer(); + overlayManager.remove(overlay); + overlayManager.remove(notWorkingOverlay); + Arrays.fill(safeCenters, null); + lastPlayerLocation = null; + currentTimer = null; + loggingIn = false; + npcNamePatterns = null; + active = false; + + Arrays.fill(linesToDisplay, null); + } + + private Area generateSafeArea() + { + final Area area = new Area(); + + for (WorldPoint wp : safeCenters) + { + if (wp == null) + { + continue; + } + + Polygon poly = new Polygon(); + poly.addPoint(wp.getX() - SAFE_AREA_RADIUS, wp.getY() - SAFE_AREA_RADIUS); + poly.addPoint(wp.getX() - SAFE_AREA_RADIUS, wp.getY() + SAFE_AREA_RADIUS + 1); + poly.addPoint(wp.getX() + SAFE_AREA_RADIUS + 1, wp.getY() + SAFE_AREA_RADIUS + 1); + poly.addPoint(wp.getX() + SAFE_AREA_RADIUS + 1, wp.getY() - SAFE_AREA_RADIUS); + area.add(new Area(poly)); + } + + return area; + } + + private void transformWorldToLocal(float[] coords) + { + final LocalPoint lp = LocalPoint.fromWorld(client, (int)coords[0], (int)coords[1]); + coords[0] = lp.getX() - Perspective.LOCAL_TILE_SIZE / 2f; + coords[1] = lp.getY() - Perspective.LOCAL_TILE_SIZE / 2f; + } + + private void reevaluateActive() + { + if (currentTimer != null) + { + currentTimer.setVisible(active && config.showTimer()); + } + + calculateLinesToDisplay(); + } + + private void calculateLinesToDisplay() + { + if (!active || !config.showAreaLines()) + { + Arrays.fill(linesToDisplay, null); + return; + } + + Rectangle sceneRect = new Rectangle( + client.getBaseX() + 1, client.getBaseY() + 1, + Constants.SCENE_SIZE - 2, Constants.SCENE_SIZE - 2); + + for (int i = 0; i < linesToDisplay.length; i++) + { + GeneralPath lines = new GeneralPath(generateSafeArea()); + lines = Geometry.clipPath(lines, sceneRect); + lines = Geometry.splitIntoSegments(lines, 1); + lines = Geometry.transformPath(lines, this::transformWorldToLocal); + linesToDisplay[i] = lines; + } + } + + private void removeTimer() + { + infoBoxManager.removeInfoBox(currentTimer); + currentTimer = null; + } + + private void createTimer(Duration duration) + { + removeTimer(); + BufferedImage image = itemManager.getImage(ItemID.ENSOULED_DEMON_HEAD); + currentTimer = new AggressionTimer(duration, image, this, active && config.showTimer()); + infoBoxManager.addInfoBox(currentTimer); + } + + private void resetTimer() + { + createTimer(Duration.ofSeconds(AGGRESSIVE_TIME_SECONDS)); + } + + private static boolean isInWilderness(WorldPoint location) + { + return WILDERNESS_ABOVE_GROUND.distanceTo2D(location) == 0 || WILDERNESS_UNDERGROUND.distanceTo2D(location) == 0; + } + + private boolean isNpcMatch(NPC npc) + { + NPCComposition composition = npc.getTransformedComposition(); + if (composition == null) + { + return false; + } + + if (Strings.isNullOrEmpty(composition.getName())) + { + return false; + } + + // Most NPCs stop aggroing when the player has more than double + // its combat level. + int playerLvl = client.getLocalPlayer().getCombatLevel(); + int npcLvl = composition.getCombatLevel(); + String npcName = composition.getName().toLowerCase(); + if (npcLvl > 0 && playerLvl > npcLvl * 2 && !isInWilderness(npc.getWorldLocation())) + { + return false; + } + + for (String pattern : npcNamePatterns) + { + if (WildcardMatcher.matches(pattern, npcName)) + { + return true; + } + } + + return false; + } + + private void checkAreaNpcs(final NPC... npcs) + { + for (NPC npc : npcs) + { + if (npc == null) + { + continue; + } + + if (isNpcMatch(npc)) + { + active = true; + break; + } + } + + reevaluateActive(); + } + + private void recheckActive() + { + active = config.alwaysActive(); + checkAreaNpcs(client.getCachedNPCs()); + } + + @Subscribe + public void onNpcSpawned(NpcSpawned event) + { + if (config.alwaysActive()) + { + return; + } + + checkAreaNpcs(event.getNpc()); + } + + @Subscribe + public void onGameTick(GameTick event) + { + WorldPoint newLocation = client.getLocalPlayer().getWorldLocation(); + if (lastPlayerLocation != null) + { + if (safeCenters[1] == null && newLocation.distanceTo2D(lastPlayerLocation) > SAFE_AREA_RADIUS * 4) + { + safeCenters[0] = null; + safeCenters[1] = newLocation; + resetTimer(); + calculateLinesToDisplay(); + + // We don't know where the previous area was, so if the player e.g. + // entered a dungeon and then goes back out, he/she may enter the previous + // area which is unknown and would make the plugin inaccurate + previousUnknownCenter = lastPlayerLocation; + } + } + + if (safeCenters[0] == null && previousUnknownCenter != null && + previousUnknownCenter.distanceTo2D(newLocation) <= UNKNOWN_AREA_RADIUS) + { + // Player went back to their previous unknown area before the 2nd + // center point was found, which means we don't know where it is again. + safeCenters[1] = null; + removeTimer(); + calculateLinesToDisplay(); + } + + if (safeCenters[1] != null) + { + if (Arrays.stream(safeCenters).noneMatch( + x -> x != null && x.distanceTo2D(newLocation) <= SAFE_AREA_RADIUS)) + { + safeCenters[0] = safeCenters[1]; + safeCenters[1] = newLocation; + resetTimer(); + calculateLinesToDisplay(); + previousUnknownCenter = null; + } + } + + lastPlayerLocation = newLocation; + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + String key = event.getKey(); + switch (key) + { + case "npcUnaggroAlwaysActive": + recheckActive(); + break; + case "npcUnaggroShowTimer": + if (currentTimer != null) + { + currentTimer.setVisible(active && config.showTimer()); + } + break; + case "npcUnaggroCollisionDetection": + case "npcUnaggroShowAreaLines": + calculateLinesToDisplay(); + break; + case "npcUnaggroNames": + npcNamePatterns = NAME_SPLITTER.splitToList(config.npcNamePatterns()); + recheckActive(); + break; + } + } + + private void loadConfig() + { + safeCenters[0] = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER1, WorldPoint.class); + safeCenters[1] = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2, WorldPoint.class); + lastPlayerLocation = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION, WorldPoint.class); + + Duration timeLeft = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION, Duration.class); + if (timeLeft != null) + { + createTimer(timeLeft); + } + } + + private void resetConfig() + { + configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER1); + configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2); + configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION); + configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION); + } + + private void saveConfig() + { + if (safeCenters[0] == null || safeCenters[1] == null || lastPlayerLocation == null || currentTimer == null) + { + resetConfig(); + } + else + { + configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER1, safeCenters[0]); + configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2, safeCenters[1]); + configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION, lastPlayerLocation); + configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION, Duration.between(Instant.now(), currentTimer.getEndTime())); + } + } + + private void onLogin() + { + loadConfig(); + resetConfig(); + + WorldPoint newLocation = client.getLocalPlayer().getWorldLocation(); + assert newLocation != null; + + // If the player isn't at the location he/she logged out at, + // the safe unaggro area probably changed, and should be disposed. + if (lastPlayerLocation == null || newLocation.distanceTo(lastPlayerLocation) != 0) + { + safeCenters[0] = null; + safeCenters[1] = null; + lastPlayerLocation = newLocation; + } + } + + @Subscribe + public void onGameStateChanged(GameStateChanged event) + { + switch (event.getGameState()) + { + case LOGGED_IN: + if (loggingIn) + { + loggingIn = false; + onLogin(); + } + + recheckActive(); + break; + + case LOGGING_IN: + loggingIn = true; + break; + + case LOGIN_SCREEN: + if (lastPlayerLocation != null) + { + saveConfig(); + } + + safeCenters[0] = null; + safeCenters[1] = null; + lastPlayerLocation = null; + break; + } + } +} From b7944bcee4f5ff70dc80d0042623b66ca1fd942e Mon Sep 17 00:00:00 2001 From: Magic fTail Date: Mon, 18 Mar 2019 18:00:35 +0100 Subject: [PATCH 274/304] Add chat filter plugin Add a plugin that censors user defined words/sentences, changes the message, or removes the entire message containing them. Co-authored-by: Adam --- .../plugins/chatfilter/ChatFilterConfig.java | 66 ++++++ .../plugins/chatfilter/ChatFilterPlugin.java | 214 ++++++++++++++++++ .../plugins/chatfilter/ChatFilterType.java | 43 ++++ .../chatfilter/JagexPrintableCharMatcher.java | 39 ++++ .../src/main/scripts/ChatBuilder.rs2asm | 13 +- .../src/main/scripts/ChatSplitBuilder.rs2asm | 13 +- .../chatfilter/ChatFilterPluginTest.java | 113 +++++++++ 7 files changed, 499 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterType.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/JagexPrintableCharMatcher.java create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java new file mode 100644 index 0000000000..abc1747b4a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2018, Magic fTail + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.chatfilter; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("chatfilter") +public interface ChatFilterConfig extends Config +{ + @ConfigItem( + keyName = "filterType", + name = "Filter type", + description = "Configures how the messages are filtered", + position = 1 + ) + default ChatFilterType filterType() + { + return ChatFilterType.CENSOR_WORDS; + } + + @ConfigItem( + keyName = "filteredWords", + name = "Filtered Words", + description = "List of filtered words, separated by commas", + position = 2 + ) + default String filteredWords() + { + return ""; + } + + @ConfigItem( + keyName = "filteredRegex", + name = "Filtered Regex", + description = "List of regular expressions to filter, one per line", + position = 3 + ) + default String filteredRegex() + { + return ""; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java new file mode 100644 index 0000000000..fab8a1f668 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2018, Magic fTail + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.chatfilter; + +import com.google.common.base.Splitter; +import com.google.inject.Provides; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; +import javax.inject.Inject; +import net.runelite.api.ChatMessageType; +import net.runelite.api.Client; +import net.runelite.api.Player; +import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.OverheadTextChanged; +import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.util.Text; +import org.apache.commons.lang3.StringUtils; + +@PluginDescriptor( + name = "Chat Filter", + description = "Censor user configurable words or patterns from chat", + enabledByDefault = false +) +public class ChatFilterPlugin extends Plugin +{ + private static final Splitter NEWLINE_SPLITTER = Splitter + .on("\n") + .omitEmptyStrings() + .trimResults(); + + private static final String CENSOR_MESSAGE = "Hey, everyone, I just tried to say something very silly!"; + + private final JagexPrintableCharMatcher jagexPrintableCharMatcher = new JagexPrintableCharMatcher(); + private final List filteredPatterns = new ArrayList<>(); + + @Inject + private Client client; + + @Inject + private ChatFilterConfig config; + + @Provides + ChatFilterConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(ChatFilterConfig.class); + } + + @Override + protected void startUp() throws Exception + { + updateFilteredPatterns(); + } + + @Override + protected void shutDown() throws Exception + { + filteredPatterns.clear(); + } + + @Subscribe + public void onScriptCallbackEvent(ScriptCallbackEvent event) + { + if (!"chatFilterCheck".equals(event.getEventName())) + { + return; + } + + int[] intStack = client.getIntStack(); + int intStackSize = client.getIntStackSize(); + ChatMessageType chatMessageType = ChatMessageType.of(intStack[intStackSize - 1]); + + // Only filter public chat and private messages + switch (chatMessageType) + { + case PUBLIC: + case PUBLIC_MOD: + case AUTOCHAT: + case PRIVATE_MESSAGE_RECEIVED: + case PRIVATE_MESSAGE_RECEIVED_MOD: + case CLANCHAT: + break; + default: + return; + } + + String[] stringStack = client.getStringStack(); + int stringStackSize = client.getStringStackSize(); + + String message = stringStack[stringStackSize - 1]; + String censoredMessage = censorMessage(message); + + if (censoredMessage == null) + { + // Block the message + intStack[intStackSize - 2] = 0; + } + else + { + // Replace the message + stringStack[stringStackSize - 1] = censoredMessage; + } + } + + @Subscribe + public void onOverheadTextChanged(OverheadTextChanged event) + { + if (!(event.getActor() instanceof Player)) + { + return; + } + + String message = censorMessage(event.getOverheadText()); + + event.getActor().setOverheadText(message); + } + + String censorMessage(final String message) + { + String strippedMessage = jagexPrintableCharMatcher.retainFrom(message) + .replace('\u00A0', ' '); + boolean filtered = false; + for (Pattern pattern : filteredPatterns) + { + Matcher m = pattern.matcher(strippedMessage); + + StringBuffer sb = new StringBuffer(); + + while (m.find()) + { + switch (config.filterType()) + { + case CENSOR_WORDS: + m.appendReplacement(sb, StringUtils.repeat("*", m.group(0).length())); + filtered = true; + break; + case CENSOR_MESSAGE: + return CENSOR_MESSAGE; + case REMOVE_MESSAGE: + return null; + } + } + m.appendTail(sb); + + strippedMessage = sb.toString(); + } + + return filtered ? strippedMessage : message; + } + + void updateFilteredPatterns() + { + filteredPatterns.clear(); + + Text.fromCSV(config.filteredWords()).stream() + .map(s -> Pattern.compile(Pattern.quote(s), Pattern.CASE_INSENSITIVE)) + .forEach(filteredPatterns::add); + + NEWLINE_SPLITTER.splitToList(config.filteredRegex()).stream() + .map(s -> + { + try + { + return Pattern.compile(s, Pattern.CASE_INSENSITIVE); + } + catch (PatternSyntaxException ex) + { + return null; + } + }) + .filter(Objects::nonNull) + .forEach(filteredPatterns::add); + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (!"chatfilter".equals(event.getGroup())) + { + return; + } + + updateFilteredPatterns(); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterType.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterType.java new file mode 100644 index 0000000000..cf52fa969f --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterType.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2018, Magic fTail + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.chatfilter; + +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public enum ChatFilterType +{ + CENSOR_WORDS("Censor words"), + CENSOR_MESSAGE("Censor message"), + REMOVE_MESSAGE("Remove message"); + + private final String name; + + @Override + public String toString() + { + return name; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/JagexPrintableCharMatcher.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/JagexPrintableCharMatcher.java new file mode 100644 index 0000000000..53b76cbc19 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/JagexPrintableCharMatcher.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.chatfilter; + +import com.google.common.base.CharMatcher; + +class JagexPrintableCharMatcher extends CharMatcher +{ + @Override + public boolean matches(char c) + { + // Characters which are printable + return (c >= 32 && c <= 126) + || c == 128 + || (c >= 161 && c <= 255); + } +} diff --git a/runelite-client/src/main/scripts/ChatBuilder.rs2asm b/runelite-client/src/main/scripts/ChatBuilder.rs2asm index ccc78a7195..c30307da67 100644 --- a/runelite-client/src/main/scripts/ChatBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatBuilder.rs2asm @@ -183,7 +183,18 @@ LABEL157: iload 12 invoke 193 iconst 1 - if_icmpeq LABEL172 + if_icmpeq CHAT_FILTER ; Jump to our new label instead + jump LABEL641 +CHAT_FILTER: + sload 11 ; Load the message + iconst 1 ; Gets changed to 0 if message is blocked + iload 10 ; Load the messageType + sconst "chatFilterCheck" + runelite_callback + pop_int ; Pop the messageType + iconst 1 ; 2nd half of conditional + sstore 11 ; Override the message with our filtered message + if_icmpeq LABEL172 ; Check if we are building this message jump LABEL641 LABEL172: iload 10 diff --git a/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm b/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm index 8c48e849dd..51fa25b373 100644 --- a/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm @@ -353,7 +353,18 @@ LABEL311: iload 14 invoke 91 iconst 1 - if_icmpeq LABEL327 + if_icmpeq CHAT_FILTER ; Jump to our new label instead + jump LABEL475 +CHAT_FILTER: + sload 0 ; Load the message + iconst 1 ; Gets changed to 0 if message is blocked + iload 15 ; Load the messageType + sconst "chatFilterCheck" + runelite_callback + pop_int ; Pop the messageType + iconst 1 ; 2nd half of conditional + sstore 0 ; Override the message with our filtered message + if_icmpeq LABEL327 ; Check if we are building this message jump LABEL475 LABEL327: iload 15 diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java new file mode 100644 index 0000000000..2fe4d88e05 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.chatfilter; + +import com.google.inject.Guice; +import com.google.inject.testing.fieldbinder.Bind; +import com.google.inject.testing.fieldbinder.BoundFieldModule; +import javax.inject.Inject; +import net.runelite.api.Client; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import static org.mockito.Mockito.when; +import org.mockito.runners.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class ChatFilterPluginTest +{ + @Mock + @Bind + private Client client; + + @Mock + @Bind + private ChatFilterConfig chatFilterConfig; + + @Inject + private ChatFilterPlugin chatFilterPlugin; + + @Before + public void before() + { + Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); + + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_WORDS); + when(chatFilterConfig.filteredWords()).thenReturn(""); + when(chatFilterConfig.filteredRegex()).thenReturn(""); + } + + @Test + public void testCensorWords() + { + when(chatFilterConfig.filteredWords()).thenReturn("hat"); + + chatFilterPlugin.updateFilteredPatterns(); + assertEquals("w***s up", chatFilterPlugin.censorMessage("whats up")); + } + + @Test + public void testCensorRegex() + { + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE); + when(chatFilterConfig.filteredRegex()).thenReturn("5[0-9]x2\n("); + + chatFilterPlugin.updateFilteredPatterns(); + assertNull(chatFilterPlugin.censorMessage("55X2 Dicing | Trusted Ranks | Huge Pay Outs!")); + } + + @Test + public void testBrokenRegex() + { + when(chatFilterConfig.filteredRegex()).thenReturn("Test\n)\n73"); + + chatFilterPlugin.updateFilteredPatterns(); + assertEquals("** isn't funny", chatFilterPlugin.censorMessage("73 isn't funny")); + } + + @Test + public void testCaseSensitivity() + { + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_MESSAGE); + when(chatFilterConfig.filteredWords()).thenReturn("ReGeX!!!"); + + chatFilterPlugin.updateFilteredPatterns(); + assertEquals("Hey, everyone, I just tried to say something very silly!", + chatFilterPlugin.censorMessage("I love regex!!!!!!!!")); + } + + @Test + public void testNonPrintableCharacters() + { + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE); + when(chatFilterConfig.filteredWords()).thenReturn("test"); + + chatFilterPlugin.updateFilteredPatterns(); + assertNull(chatFilterPlugin.censorMessage("te\u008Cst")); + } +} \ No newline at end of file From 9249129383299de6dcb43b6875897204ade67e87 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 20 Mar 2019 09:13:52 -0400 Subject: [PATCH 275/304] twitch: fix race in connect establishing multiple connections --- .../client/plugins/twitch/TwitchPlugin.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java index c87ca1ad32..d70c3b7ed6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java @@ -96,7 +96,7 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput return configManager.getConfig(TwitchConfig.class); } - private void connect() + private synchronized void connect() { if (twitchConfig.username() != null && twitchConfig.oauthToken() != null @@ -108,6 +108,13 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput channel = "#" + channel; } + log.debug("Connecting to Twitch as {}", twitchConfig.username()); + + if (twitchIRCClient != null) + { + twitchIRCClient.close(); + } + twitchIRCClient = new TwitchIRCClient( this, twitchConfig.username(), @@ -145,12 +152,6 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput return; } - if (twitchIRCClient != null) - { - twitchIRCClient.close(); - twitchIRCClient = null; - } - connect(); } From 4e47a25438a649ab7a7b9fb8a6f8275316e2b146 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 20 Mar 2019 14:21:31 +0100 Subject: [PATCH 276/304] Check for empty strings when initializing twitch client When setting is cleared via user its value is set to empty string and never to null again. Signed-off-by: Tomas Slusny --- .../net/runelite/client/plugins/twitch/TwitchPlugin.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java index d70c3b7ed6..7cd617a8cc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.twitch; +import com.google.common.base.Strings; import com.google.inject.Provides; import java.time.temporal.ChronoUnit; import java.util.Map; @@ -98,9 +99,9 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput private synchronized void connect() { - if (twitchConfig.username() != null - && twitchConfig.oauthToken() != null - && twitchConfig.channel() != null) + if (!Strings.isNullOrEmpty(twitchConfig.username()) + && !Strings.isNullOrEmpty(twitchConfig.oauthToken()) + && !Strings.isNullOrEmpty(twitchConfig.channel())) { String channel = twitchConfig.channel().toLowerCase(); if (!channel.startsWith("#")) From 25b50953759c75adb89ea193b31506c26fc28d28 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 20 Mar 2019 14:23:46 +0100 Subject: [PATCH 277/304] Always close twitch client in connect() method In case user cleared their crendentials this method should still at least close the client so it will not be running forever. Signed-off-by: Tomas Slusny --- .../runelite/client/plugins/twitch/TwitchPlugin.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java index 7cd617a8cc..275eea5d54 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java @@ -99,6 +99,13 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput private synchronized void connect() { + if (twitchIRCClient != null) + { + log.debug("Terminating Twitch client {}", twitchIRCClient); + twitchIRCClient.close(); + twitchIRCClient = null; + } + if (!Strings.isNullOrEmpty(twitchConfig.username()) && !Strings.isNullOrEmpty(twitchConfig.oauthToken()) && !Strings.isNullOrEmpty(twitchConfig.channel())) @@ -111,11 +118,6 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput log.debug("Connecting to Twitch as {}", twitchConfig.username()); - if (twitchIRCClient != null) - { - twitchIRCClient.close(); - } - twitchIRCClient = new TwitchIRCClient( this, twitchConfig.username(), From 327986fc56d3b6e5f166803fd769fed912b26eb3 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 20 Mar 2019 17:26:39 -0400 Subject: [PATCH 278/304] npc aggro plugin: rename plugin name to be more consistent with other plugins --- .../client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java index 0020d54d25..e1c1704762 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java @@ -64,9 +64,9 @@ import net.runelite.client.util.WildcardMatcher; @Slf4j @PluginDescriptor( - name = "Unaggressive NPC timer", + name = "NPC Aggression Timer", description = "Highlights the unaggressive area of NPCs nearby and timer until it becomes active", - tags = {"highlight", "lines", "unaggro", "aggro", "aggressive", "npcs", "area", "timer", "slayer"}, + tags = {"highlight", "lines", "unaggro", "aggro", "aggressive", "npcs", "area", "slayer"}, enabledByDefault = false ) public class NpcAggroAreaPlugin extends Plugin From 4ccefd23a4b3e1384aababfeceb6735ffb0f0abb Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 20 Mar 2019 18:37:50 -0400 Subject: [PATCH 279/304] config service: convert backing database to use mongodb This is a much more natural fit for the config service which is really a key value store, and has been abusing SQL. This will let us expand the config stuff later to support profiles and per-account config values. I have left in the SQL code for now so config changes are still being sent there in the event of catastrophic mongodb failure. --- http-service/pom.xml | 5 + .../service/SpringBootWebApplication.java | 9 ++ .../http/service/config/ConfigService.java | 146 +++++++++++++++++- .../src/main/resources/application.yaml | 3 + 4 files changed, 156 insertions(+), 7 deletions(-) diff --git a/http-service/pom.xml b/http-service/pom.xml index 8d8ffa6803..5358a2300c 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -116,6 +116,11 @@ + + org.mongodb + mongodb-driver-sync + 3.10.1 + org.springframework.boot diff --git a/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java b/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java index d0103d89f8..376ef11ec7 100644 --- a/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java +++ b/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java @@ -26,6 +26,8 @@ package net.runelite.http.service; import ch.qos.logback.classic.LoggerContext; import com.google.common.base.Strings; +import com.mongodb.client.MongoClient; +import com.mongodb.client.MongoClients; import java.io.IOException; import java.time.Instant; import java.util.HashMap; @@ -43,6 +45,7 @@ import okhttp3.OkHttpClient; import org.slf4j.ILoggerFactory; import org.slf4j.impl.StaticLoggerBinder; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @@ -156,6 +159,12 @@ public class SpringBootWebApplication extends SpringBootServletInitializer return createSql2oFromDataSource(dataSource); } + @Bean + public MongoClient mongoClient(@Value("${mongo.host}") String host) + { + return MongoClients.create(host); + } + private static DataSource getDataSource(DataSourceProperties dataSourceProperties) { if (!Strings.isNullOrEmpty(dataSourceProperties.getJndiName())) diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java index ed96f36cf4..87aae06c1b 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Adam + * Copyright (c) 2017-2019, Adam * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,10 +24,26 @@ */ package net.runelite.http.service.config; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.mongodb.client.MongoClient; +import com.mongodb.client.MongoCollection; +import com.mongodb.client.MongoDatabase; +import static com.mongodb.client.model.Filters.eq; +import com.mongodb.client.model.IndexOptions; +import com.mongodb.client.model.Indexes; +import static com.mongodb.client.model.Updates.set; +import static com.mongodb.client.model.Updates.unset; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import java.util.Map; import javax.annotation.Nullable; +import lombok.extern.slf4j.Slf4j; +import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.config.ConfigEntry; import net.runelite.http.api.config.Configuration; +import org.bson.Document; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; @@ -36,6 +52,7 @@ import org.sql2o.Sql2o; import org.sql2o.Sql2oException; @Service +@Slf4j public class ConfigService { private static final String CREATE_CONFIG = "CREATE TABLE IF NOT EXISTS `config` (\n" @@ -49,10 +66,14 @@ public class ConfigService + " ADD CONSTRAINT `user_fk` FOREIGN KEY (`user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;"; private final Sql2o sql2o; + private final Gson GSON = RuneLiteAPI.GSON; + + private final MongoCollection mongoCollection; @Autowired public ConfigService( - @Qualifier("Runelite SQL2O") Sql2o sql2o + @Qualifier("Runelite SQL2O") Sql2o sql2o, + MongoClient mongoClient ) { this.sql2o = sql2o; @@ -72,17 +93,61 @@ public class ConfigService // Ignore, happens when index already exists } } + + MongoDatabase database = mongoClient.getDatabase("config"); + MongoCollection collection = database.getCollection("config"); + this.mongoCollection = collection; + + // Create unique index on _userId + IndexOptions indexOptions = new IndexOptions().unique(true); + collection.createIndex(Indexes.ascending("_userId"), indexOptions); + } + + private Document getConfig(int userId) + { + return mongoCollection.find(eq("_userId", userId)).first(); } public Configuration get(int userId) { - List config; + Map configMap = getConfig(userId); - try (Connection con = sql2o.open()) + if (configMap == null || configMap.isEmpty()) { - config = con.createQuery("select `key`, value from config where user = :user") - .addParameter("user", userId) - .executeAndFetch(ConfigEntry.class); + return null; + } + + List config = new ArrayList<>(); + + for (String group : configMap.keySet()) + { + // Reserved keys + if (group.startsWith("_") || group.startsWith("$")) + { + continue; + } + + Map groupMap = (Map) configMap.get(group); + + for (Map.Entry entry : groupMap.entrySet()) + { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (value instanceof Map || value instanceof Collection) + { + value = GSON.toJson(entry.getValue()); + } + else if (value == null) + { + continue; + } + + ConfigEntry configEntry = new ConfigEntry(); + configEntry.setKey(group + "." + key.replace(':', '.')); + configEntry.setValue(value.toString()); + config.add(configEntry); + } } return new Configuration(config); @@ -102,6 +167,21 @@ public class ConfigService .addParameter("value", value != null ? value : "") .executeUpdate(); } + + if (key.startsWith("$") || key.startsWith("_")) + { + return; + } + + String[] split = key.split("\\.", 2); + if (split.length != 2) + { + return; + } + + Object jsonValue = parseJsonString(value); + mongoCollection.updateOne(eq("_userId", userId), + set(split[0] + "." + split[1].replace('.', ':'), jsonValue)); } public void unsetKey( @@ -116,5 +196,57 @@ public class ConfigService .addParameter("key", key) .executeUpdate(); } + + if (key.startsWith("$") || key.startsWith("_")) + { + return; + } + + String[] split = key.split("\\.", 2); + if (split.length != 2) + { + return; + } + + mongoCollection.updateOne(eq("_userId", userId), + unset(split[0] + "." + split[1].replace('.', ':'))); + } + + private static Object parseJsonString(String value) + { + Object jsonValue; + try + { + jsonValue = RuneLiteAPI.GSON.fromJson(value, Object.class); + + if (jsonValue instanceof Double || jsonValue instanceof Float) + { + Number number = (Number) jsonValue; + if (Math.floor(number.doubleValue()) == number.doubleValue() && !Double.isInfinite(number.doubleValue())) + { + // value is an int or long. 'number' might be truncated so parse it from 'value' + try + { + jsonValue = Integer.parseInt(value); + } + catch (NumberFormatException ex) + { + try + { + jsonValue = Long.parseLong(value); + } + catch (NumberFormatException ex2) + { + + } + } + } + } + } + catch (JsonSyntaxException ex) + { + jsonValue = value; + } + return jsonValue; } } diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml index 271b190a90..a6437b36d7 100644 --- a/http-service/src/main/resources/application.yaml +++ b/http-service/src/main/resources/application.yaml @@ -29,6 +29,9 @@ redis: pool.size: 10 host: http://localhost:6379 +mongo: + host: mongodb://localhost:27017 + # Twitter client for feed runelite: twitter: From d31f5a130f9d75170a16e088a0e2eea995b047c2 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 21 Mar 2019 11:33:24 +0000 Subject: [PATCH 280/304] Update Item IDs to 2019-03-21-rev178 --- runelite-api/src/main/java/net/runelite/api/ItemID.java | 1 + runelite-api/src/main/java/net/runelite/api/NullItemID.java | 1 + 2 files changed, 2 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index 2e5b5b790c..f272260eec 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -10648,5 +10648,6 @@ public final class ItemID public static final int MYSTIC_SET_BLUE = 23113; public static final int MYSTIC_SET_DARK = 23116; public static final int MYSTIC_SET_DUSK = 23119; + public static final int OILY_PEARL_FISHING_ROD = 23122; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index 6aa1699c1b..32141ef820 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -12287,5 +12287,6 @@ public final class NullItemID public static final int NULL_23118 = 23118; public static final int NULL_23120 = 23120; public static final int NULL_23121 = 23121; + public static final int NULL_23123 = 23123; /* This file is automatically generated. Do not edit. */ } From d74c1d04938618fb36c86ee7e7c7f39401f2c571 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 21 Mar 2019 11:33:25 +0000 Subject: [PATCH 281/304] Update Object IDs to 2019-03-21-rev178 --- runelite-api/src/main/java/net/runelite/api/NullObjectID.java | 4 ++++ runelite-api/src/main/java/net/runelite/api/ObjectID.java | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java index c8234df8b1..c44dee1a9a 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -1184,6 +1184,7 @@ public final class NullObjectID public static final int NULL_2566 = 2566; public static final int NULL_2567 = 2567; public static final int NULL_2568 = 2568; + public static final int NULL_2630 = 2630; public static final int NULL_2637 = 2637; public static final int NULL_2638 = 2638; public static final int NULL_2639 = 2639; @@ -6204,6 +6205,7 @@ public final class NullObjectID public static final int NULL_14425 = 14425; public static final int NULL_14426 = 14426; public static final int NULL_14427 = 14427; + public static final int NULL_14428 = 14428; public static final int NULL_14429 = 14429; public static final int NULL_14430 = 14430; public static final int NULL_14432 = 14432; @@ -12311,6 +12313,8 @@ public final class NullObjectID public static final int NULL_26195 = 26195; public static final int NULL_26196 = 26196; public static final int NULL_26197 = 26197; + public static final int NULL_26200 = 26200; + public static final int NULL_26204 = 26204; public static final int NULL_26208 = 26208; public static final int NULL_26209 = 26209; public static final int NULL_26245 = 26245; diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index 2b5a2d9633..f4c746ca3b 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -1452,7 +1452,6 @@ public final class ObjectID public static final int DOOR_2627 = 2627; public static final int DOOR_2628 = 2628; public static final int WALL_2629 = 2629; - public static final int FISHING_SPOT_2630 = 2630; public static final int DOOR_2631 = 2631; public static final int CHEST_2632 = 2632; public static final int CHEST_2633 = 2633; @@ -8227,7 +8226,6 @@ public final class ObjectID public static final int MYSTERIOUS_RUINS_14413 = 14413; public static final int MYSTERIOUS_RUINS_14414 = 14414; public static final int STUDY_DESK_14415 = 14415; - public static final int FISHING_SPOT_14428 = 14428; public static final int RIFT_14431 = 14431; public static final int GAS_BUBBLE = 14434; public static final int CAVE_ENTRANCE_14436 = 14436; @@ -13895,6 +13893,7 @@ public final class ObjectID public static final int TABLE_26201 = 26201; public static final int TABLE_26202 = 26202; public static final int TABLE_26203 = 26203; + public static final int DOOR_26205 = 26205; public static final int LARGE_DOOR_26207 = 26207; public static final int WOODEN_BENCH_26210 = 26210; public static final int OAK_BENCH_26211 = 26211; From fe441679d8d147d4e87d1ea442043136f3fd7ebc Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 21 Mar 2019 11:33:26 +0000 Subject: [PATCH 282/304] Update NPC IDs to 2019-03-21-rev178 --- runelite-api/src/main/java/net/runelite/api/NpcID.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index a483290e88..3a5363de22 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -6217,6 +6217,7 @@ public final class NpcID public static final int MAZE_GUARDIAN_6779 = 6779; public static final int PILIAR = 6780; public static final int SHAYDA = 6781; + public static final int FISHING_SPOT_6784 = 6784; public static final int HOSA = 6785; public static final int HELLRAT_BEHEMOTH = 6793; public static final int MONKEY_ARCHER_6794 = 6794; From 776d27cc4772d9ad3c779a2799ecef9a12aa0904 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 21 Mar 2019 11:33:31 +0000 Subject: [PATCH 283/304] Update Scripts to 2019-03-21-rev178 --- runelite-client/src/main/scripts/ChatSplitBuilder.hash | 2 +- runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm | 8 ++++---- runelite-client/src/main/scripts/ResetChatboxInput.hash | 2 +- runelite-client/src/main/scripts/ResetChatboxInput.rs2asm | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/scripts/ChatSplitBuilder.hash b/runelite-client/src/main/scripts/ChatSplitBuilder.hash index e71389fb55..9e67531c83 100644 --- a/runelite-client/src/main/scripts/ChatSplitBuilder.hash +++ b/runelite-client/src/main/scripts/ChatSplitBuilder.hash @@ -1 +1 @@ -008FA4B7983DF14899909AF361AD2DE955DE552E78FAF8C6604E848D1776B4F0 \ No newline at end of file +5BCAA21926CF079794AAF3DA80E512297DD6F8353741929302FE6490D17DDF8C \ No newline at end of file diff --git a/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm b/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm index 51fa25b373..45b420248d 100644 --- a/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm @@ -43,7 +43,7 @@ LABEL24: istore 2 LABEL36: get_varc_int 41 - iconst -1 + iconst 1337 if_icmpeq LABEL40 jump LABEL49 LABEL40: @@ -315,7 +315,7 @@ LABEL282: jump LABEL479 LABEL290: get_varc_int 41 - iconst -1 + iconst 1337 if_icmpne LABEL297 get_varbit 4089 iconst 0 @@ -360,8 +360,8 @@ CHAT_FILTER: iconst 1 ; Gets changed to 0 if message is blocked iload 15 ; Load the messageType sconst "chatFilterCheck" - runelite_callback - pop_int ; Pop the messageType + runelite_callback + pop_int ; Pop the messageType iconst 1 ; 2nd half of conditional sstore 0 ; Override the message with our filtered message if_icmpeq LABEL327 ; Check if we are building this message diff --git a/runelite-client/src/main/scripts/ResetChatboxInput.hash b/runelite-client/src/main/scripts/ResetChatboxInput.hash index d60aa7f20e..12bd3c5bb1 100644 --- a/runelite-client/src/main/scripts/ResetChatboxInput.hash +++ b/runelite-client/src/main/scripts/ResetChatboxInput.hash @@ -1 +1 @@ -9D609388EF5AADA2ECA24164199191CF2A7C0098C19F798CCCAE4F6CCF73A041 \ No newline at end of file +E8B1910003198AB024BADC89831AF1735A2C77256C23551212105F25439E022D \ No newline at end of file diff --git a/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm b/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm index 4aeb36de78..40f4b02c6f 100644 --- a/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm +++ b/runelite-client/src/main/scripts/ResetChatboxInput.rs2asm @@ -163,7 +163,7 @@ LABEL40: iconst 10616880 if_setonclick get_varc_int 41 - iconst -1 + iconst 1337 if_icmpeq LABEL154 jump LABEL156 LABEL154: From 9d2988858272c41025a34a31b371fc647bfa31ab Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 21 Mar 2019 11:33:32 +0000 Subject: [PATCH 284/304] Update Widget IDs to 2019-03-21-rev178 --- .../java/net/runelite/api/widgets/WidgetID.java | 15 +++++---------- .../java/net/runelite/api/widgets/WidgetInfo.java | 11 ++--------- .../client/plugins/timers/TimersPlugin.java | 3 ++- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 2d6551e5f1..e6a73dc211 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -717,16 +717,11 @@ public class WidgetID static class Pvp { - static final int BOUNTY_HUNTER_INFO = 6; - static final int KILLDEATH_RATIO = 9; - static final int BOUNTY_HUNTER_STATS = 28; - static final int PVP_WIDGET_CONTAINER = 54; - static final int SKULL_CONTAINER = 55; - static final int SKULL = 56; - static final int SAFE_ZONE = 57; - static final int ATTACK_RANGE = 59; - static final int WILDERNESS_LEVEL = 60; // this can also be the Deadman Mode "Protection" text - static final int DEADMAN_PROTECTION_TIME = 61; + static final int BOUNTY_HUNTER_INFO = 19; + static final int KILLDEATH_RATIO = 15; + static final int SKULL_CONTAINER = 62; + static final int SAFE_ZONE = 64; + static final int WILDERNESS_LEVEL = 67; // this can also be the Deadman Mode "Protection" text } static class KourendFavour diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index f1daefab90..fb9b005bb5 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -444,20 +444,13 @@ public enum WidgetInfo SPELL_LUNAR_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.LunarSpellBook.LUNAR_HOME_TELEPORT), SPELL_ARCEUUS_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.ArceuusSpellBook.ARCEUUS_HOME_TELEPORT), - PVP_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.PVP_WIDGET_CONTAINER), PVP_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL_CONTAINER), - PVP_SKULL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL), + PVP_WORLD_SAFE_ZONE(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SAFE_ZONE), + PVP_WILDERNESS_LEVEL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.WILDERNESS_LEVEL), PVP_BOUNTY_HUNTER_INFO(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_INFO), - PVP_BOUNTY_HUNTER_STATS(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_STATS), PVP_KILLDEATH_COUNTER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.KILLDEATH_RATIO), - PVP_WORLD_SAFE_ZONE(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SAFE_ZONE), - PVP_WORLD_ATTACK_RANGE(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.ATTACK_RANGE), - - DEADMAN_PROTECTION_TEXT(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.WILDERNESS_LEVEL), - DEADMAN_PROTECTION_TIME(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.DEADMAN_PROTECTION_TIME), - KOUREND_FAVOUR_OVERLAY(WidgetID.KOUREND_FAVOUR_GROUP_ID, WidgetID.KourendFavour.KOUREND_FAVOUR_OVERLAY), ZEAH_MESS_HALL_COOKING_DISPLAY(WidgetID.ZEAH_MESS_HALL_GROUP_ID, WidgetID.Zeah.MESS_HALL_COOKING_DISPLAY), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index 1a039c008f..2a76b949be 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -59,6 +59,7 @@ import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.WidgetHiddenChanged; import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import static net.runelite.api.widgets.WidgetInfo.PVP_WORLD_SAFE_ZONE; import net.runelite.client.config.ConfigManager; @@ -217,7 +218,7 @@ public class TimersPlugin extends Plugin { Widget widget = event.getWidget(); if (WorldType.isPvpWorld(client.getWorldType()) - && WidgetInfo.TO_GROUP(widget.getId()) == WidgetInfo.PVP_CONTAINER.getGroupId()) + && WidgetInfo.TO_GROUP(widget.getId()) == WidgetID.PVP_GROUP_ID) { widgetHiddenChangedOnPvpWorld = true; } From 9979cf6818b2d0de99da9e79d892660aac086e1b Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 21 Mar 2019 12:40:14 +0000 Subject: [PATCH 285/304] [maven-release-plugin] prepare release runelite-parent-1.5.17 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 637fd80c1f..bf2b464659 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 0dfc42aee6..3f178c7836 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 1d120e5a7b..25581bd7e9 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 1faffff7e3..4a3cbc36fc 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 5358a2300c..e695f45b69 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 Web Service diff --git a/pom.xml b/pom.xml index bf6afd34fa..4228b3f59f 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.17 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 45f5cb501d..8db82cc68a 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index b5e0f7184a..b7ff93f64c 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 6337af0c02..a3c1a056a8 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 528774f347..1051aa8ca0 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index ebd3311ff8..910a69d533 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index a168700652..fc97492da2 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index f7a1af8997..6f4bb75b81 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17-SNAPSHOT + 1.5.17 net.runelite.rs From 7af89342b447435e0871d9214038ff5056581433 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 21 Mar 2019 12:40:20 +0000 Subject: [PATCH 286/304] [maven-release-plugin] prepare for next development iteration --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index bf2b464659..faeae7c994 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 3f178c7836..f6c268d3fa 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 25581bd7e9..03da240165 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 4a3cbc36fc..a9ef3569d7 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index e695f45b69..e2c6296431 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index 4228b3f59f..c76f91fd68 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.17 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 8db82cc68a..f09edc8cb5 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index b7ff93f64c..62dfa0997c 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index a3c1a056a8..2fa7d58969 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 1051aa8ca0..9198253015 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 910a69d533..31cc93c5d4 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index fc97492da2..a83d595c1c 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 6f4bb75b81..fb65af2e3f 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.17 + 1.5.18-SNAPSHOT net.runelite.rs From f7a937463991e193d52752302b5604d317455339 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 21 Mar 2019 07:09:55 -0600 Subject: [PATCH 287/304] ChatboxPanelManager: Be more resilient when scripts mismatch If RESET_CHATBOX_INPUT doesn't invoke runelite_callback resetChatboxInput because the script hash mismatches panels never get killed, so they a) break jagex inputs, and b) can be lost and not get unregistered, so they will record passwords on the login screen --- .../client/game/chatbox/ChatboxPanelManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxPanelManager.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxPanelManager.java index 35e42a617e..ff23bb2cda 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxPanelManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxPanelManager.java @@ -93,6 +93,10 @@ public class ChatboxPanelManager 0, 1 ); + if (currentInput != null) + { + killCurrentPanel(); + } } private void unsafeOpenInput(ChatboxInput input) @@ -113,6 +117,11 @@ public class ChatboxPanelManager mouseManager.registerMouseWheelListener((MouseWheelListener) input); } + if (currentInput != null) + { + killCurrentPanel(); + } + currentInput = input; client.setVar(VarClientInt.INPUT_TYPE, InputType.RUNELITE_CHATBOX_PANEL.getType()); client.getWidget(WidgetInfo.CHATBOX_TITLE).setHidden(true); From 6f2359a7d8a9a23c86f0011de47cfcb67df37229 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 21 Mar 2019 10:46:35 -0400 Subject: [PATCH 288/304] Revert "client: load jagex config and client over https" This reverts commit b288a4899d1f34f0521937b530ba60eeb86a2109. --- .../java/net/runelite/client/rs/ClientConfigLoader.java | 2 +- .../src/main/java/net/runelite/client/rs/ClientLoader.java | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientConfigLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientConfigLoader.java index be355cbd7e..9d3804ebab 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientConfigLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientConfigLoader.java @@ -38,7 +38,7 @@ import okhttp3.Response; @Singleton class ClientConfigLoader { - private static final String CONFIG_URL = "https://oldschool.runescape.com/jav_config.ws"; + private static final String CONFIG_URL = "http://oldschool.runescape.com/jav_config.ws"; private final OkHttpClient httpClient; @Inject diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index 3755be2398..9e81d59b00 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -37,6 +37,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.net.URL; import java.util.HashMap; import java.util.Map; import java.util.jar.JarEntry; @@ -47,7 +48,6 @@ import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import static net.runelite.client.rs.ClientUpdateCheckMode.*; import net.runelite.http.api.RuneLiteAPI; -import okhttp3.HttpUrl; import okhttp3.Request; import okhttp3.Response; import org.apache.commons.compress.compressors.CompressorException; @@ -83,10 +83,7 @@ public class ClientLoader { String codebase = config.getCodeBase(); String initialJar = config.getInitialJar(); - HttpUrl url = HttpUrl.parse(codebase).newBuilder() - .scheme("https") - .addPathSegment(initialJar) - .build(); + URL url = new URL(codebase + initialJar); Request request = new Request.Builder() .url(url) .build(); From d3fa29cab477cdbb94ac7fb90e34010a03a35282 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Thu, 21 Mar 2019 20:57:02 +0000 Subject: [PATCH 289/304] chat filter: Fix issue where special attack overheads crashed the game --- .../runelite/client/plugins/chatfilter/ChatFilterPlugin.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java index fab8a1f668..355ed29b28 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java @@ -141,6 +141,11 @@ public class ChatFilterPlugin extends Plugin String message = censorMessage(event.getOverheadText()); + if (message == null) + { + message = " "; + } + event.getActor().setOverheadText(message); } From b50b3fc07b8e7643a55fd7357b59cfbe74006dee Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 21 Mar 2019 21:27:07 -0400 Subject: [PATCH 290/304] config service: return an empty config if no config is found Returning an empty body breaks the client as it deserializes the response to null. --- .../java/net/runelite/http/service/config/ConfigService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java index 87aae06c1b..de665fc44f 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java @@ -36,6 +36,7 @@ import static com.mongodb.client.model.Updates.set; import static com.mongodb.client.model.Updates.unset; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Map; import javax.annotation.Nullable; @@ -114,7 +115,7 @@ public class ConfigService if (configMap == null || configMap.isEmpty()) { - return null; + return new Configuration(Collections.emptyList()); } List config = new ArrayList<>(); From ddd2b6951d4c8dceddea3b59ca93fba959683176 Mon Sep 17 00:00:00 2001 From: Kevin Zita Date: Fri, 22 Mar 2019 05:57:07 -0400 Subject: [PATCH 291/304] Fix "Bandind" typo in coordinate clue descriptions (#8287) --- .../client/plugins/cluescrolls/clues/CoordinateClue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java index 7d3b98dcb4..f352115c1e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java @@ -101,7 +101,7 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati .put(new WorldPoint(2339, 3311, 0), "East of Tirannwn on Arandar mountain pass.") .put(new WorldPoint(3440, 3341, 0), "Nature Spirit's grotto.") .put(new WorldPoint(2763, 2974, 0), "Cairn Isle, west of Shilo Village.") - .put(new WorldPoint(3138, 2969, 0), "West of Bandid Camp.") + .put(new WorldPoint(3138, 2969, 0), "West of Bandit Camp.") .put(new WorldPoint(2924, 2963, 0), "On the southern part of eastern Karamja.") .put(new WorldPoint(2838, 2914, 0), "Kharazi Jungle, near water pool.") .put(new WorldPoint(3441, 3419, 0), "Mort Myre Swamp.") @@ -112,7 +112,7 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati .put(new WorldPoint(3168, 3677, 0), "Wilderness. Graveyard of Shadows.") .put(new WorldPoint(2853, 3690, 0), "Entrance to the troll Stronghold.") .put(new WorldPoint(3305, 3692, 0), "Wilderness. West of eastern green dragon.") - .put(new WorldPoint(3055, 3696, 0), "Wilderness. Bandid Camp.") + .put(new WorldPoint(3055, 3696, 0), "Wilderness. Bandit Camp.") .put(new WorldPoint(3302, 3696, 0), "Wilderness. West of eastern green dragon.") .put(new WorldPoint(1479, 3696, 0), "Lizardman Canyon.") .put(new WorldPoint(2712, 3732, 0), "North-east of Rellekka.") From 460c203229fcb94f5acd903b89466d3c07d9d17c Mon Sep 17 00:00:00 2001 From: xDemoN Date: Fri, 22 Mar 2019 05:59:12 -0400 Subject: [PATCH 292/304] Remove incorrect farming guild location (#8250) Two farming guild locations were listed, although only 1 exists Per the wiki, the western location is correct. Closes #7570 --- .../plugins/cluescrolls/clues/hotcold/HotColdLocation.java | 1 - 1 file changed, 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java index 4f7253da7d..17fe16453b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java @@ -170,7 +170,6 @@ public enum HotColdLocation ZEAH_MESS_HALL(new WorldPoint(1658, 3621, 0), ZEAH, "East of Mess hall."), ZEAH_WATSONS_HOUSE(new WorldPoint(1653, 3573, 0), ZEAH, "East of Watson's house."), ZEAH_VANNAHS_FARM_STORE(new WorldPoint(1806, 3521, 0), ZEAH, "North of Vannah's Farm Store, between the chicken coop and willow trees."), - ZEAH_FARMING_GUILD_SW(new WorldPoint(1227, 3712, 0), ZEAH, "South-west of the Farming Guild."), ZEAH_FARMING_GUILD_W(new WorldPoint(1209, 3737, 0), ZEAH, "West of the Farming Guild."), ZEAH_DAIRY_COW(new WorldPoint(1320, 3718, 0), ZEAH, "North-east of the Kebos Lowlands, east of the dairy cow."), ZEAH_CRIMSON_SWIFTS(new WorldPoint(1186, 3583, 0), ZEAH, "South-west of the Kebos Swamp, below the crimson swifts."); From d8d6e5e5f106766f87001b13f589f70f06137a07 Mon Sep 17 00:00:00 2001 From: xDemoN Date: Sat, 23 Mar 2019 08:51:34 -0400 Subject: [PATCH 293/304] Clue Scroll: Fixe Varrock East Bank Cryptic Clue (#8241) Closes #6705 --- .../runelite/client/plugins/cluescrolls/clues/CrypticClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java index b4d5b46391..20f0b16d9d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java @@ -300,7 +300,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc new CrypticClue("Does one really need a fire to stay warm here?", new WorldPoint(3816, 3810, 0), "Dig next to the fire near the Volcanic Mine entrance."), new CrypticClue("Search the open crate found in a small farmhouse in Hosidius. Cabbages grow outside.", CRATE_27533, new WorldPoint(1687, 3628, 0), "The house is east of the Mess in Great Kourend."), new CrypticClue("Dig under Ithoi's cabin.", new WorldPoint(2529, 2838, 0), "Dig under Ithoi's cabin in the Corsair Cove."), - new CrypticClue("Search the drawers, upstairs in the bank to the East of Varrock.", new WorldPoint(3250, 3420, 1), "Search the drawers upstairs in Varrock east bank"), + new CrypticClue("Search the drawers, upstairs in the bank to the East of Varrock.", DRAWERS_7194, new WorldPoint(3250, 3420, 1), "Search the drawers upstairs in Varrock east bank."), new CrypticClue("Speak to Hazelmere.", "Hazelmere", new WorldPoint(2677, 3088, 1), "Located upstairs in the house to the north of fairy ring CLS. Answer: 6859"), new CrypticClue("The effects of this fire are magnified.", new WorldPoint(1179, 3626, 0), "Dig by the fire beside Ket'sal K'uk in the westernmost part of the Kebos Swamp. ") ); From b8503e032653ed73cfa8ed1cbc7512c4890f6a0c Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 23 Mar 2019 20:54:06 -0400 Subject: [PATCH 294/304] xptracker: fix "Reset others" resetting overall xp Fixes #8296 --- .../runelite/client/plugins/xptracker/XpTrackerPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java index f72bcd12f2..a8d65962a5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java @@ -254,7 +254,6 @@ public class XpTrackerPlugin extends Plugin int currentXp = client.getSkillExperience(skill); xpState.resetSkill(skill, currentXp); xpPanel.resetSkill(skill); - xpPanel.updateTotal(xpState.getTotalSnapshot()); } /** @@ -265,7 +264,8 @@ public class XpTrackerPlugin extends Plugin { for (Skill s : Skill.values()) { - if (skill != s) + // Overall is not reset from resetting individual skills + if (skill != s && s != Skill.OVERALL) { resetSkillState(s); } From 07a20bc4f084c5e542e222848604ba44a3274164 Mon Sep 17 00:00:00 2001 From: Andrew Ghaly <8738663+andrewghaly@users.noreply.github.com> Date: Sat, 23 Mar 2019 23:40:29 -0400 Subject: [PATCH 295/304] hooks: fix typos in javadoc --- .../src/main/java/net/runelite/client/callback/Hooks.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java index 4cb368ace7..08cd4ea3fe 100644 --- a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java +++ b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java @@ -186,8 +186,8 @@ public class Hooks implements Callbacks * When the world map opens it loads about ~100mb of data into memory, which * represents about half of the total memory allocated by the client. * This gets cached and never released, which causes GC pressure which can affect - * performance. This method reinitailzies the world map cache, which allows the - * data to be garbage collecged, and causes the map data from disk each time + * performance. This method reinitializes the world map cache, which allows the + * data to be garbage collected, and causes the map data from disk each time * is it opened. */ private void checkWorldMap() From 98838fd7515f4a64d37f818b657713956cee5ae1 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 23 Mar 2019 16:55:31 -0400 Subject: [PATCH 296/304] client: show error dialog when unable to load client --- .../java/net/runelite/client/rs/ClientLoader.java | 1 - .../main/java/net/runelite/client/ui/ClientUI.java | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index 9e81d59b00..5c96b41c25 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -211,7 +211,6 @@ public class ClientLoader } log.error("Error loading RS!", e); - System.exit(-1); return null; } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java index 59ce146601..56c3865ae4 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java @@ -52,6 +52,7 @@ import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JOptionPane; +import static javax.swing.JOptionPane.ERROR_MESSAGE; import static javax.swing.JOptionPane.INFORMATION_MESSAGE; import javax.swing.JPanel; import javax.swing.JRootPane; @@ -510,8 +511,14 @@ public class ClientUI }); // Show out of date dialog if needed - final boolean isOutdated = !(client instanceof Client); - if (isOutdated) + if (client == null) + { + SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(frame, + "Error loading client! Check your logs for more details.", + "Unable to load client", + ERROR_MESSAGE)); + } + else if (!(client instanceof Client)) { SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(frame, "RuneLite has not yet been updated to work with the latest\n" From cd72e1fcf350e322548078253a9c8f6600169562 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 23 Mar 2019 16:57:27 -0400 Subject: [PATCH 297/304] client: verify client signature --- .../net/runelite/client/rs/ClientLoader.java | 34 +++++++- .../client/rs/VerificationException.java | 38 +++++++++ .../net/runelite/client/rs/jagex.crt | 79 +++++++++++++++++++ 3 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/rs/VerificationException.java create mode 100644 runelite-client/src/main/resources/net/runelite/client/rs/jagex.crt diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index 5c96b41c25..56ba0799d2 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -38,6 +38,11 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.jar.JarEntry; @@ -46,7 +51,9 @@ import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; -import static net.runelite.client.rs.ClientUpdateCheckMode.*; +import static net.runelite.client.rs.ClientUpdateCheckMode.AUTO; +import static net.runelite.client.rs.ClientUpdateCheckMode.NONE; +import static net.runelite.client.rs.ClientUpdateCheckMode.VANILLA; import net.runelite.http.api.RuneLiteAPI; import okhttp3.Request; import okhttp3.Response; @@ -81,6 +88,7 @@ public class ClientLoader Map zipFile = new HashMap<>(); { + Certificate[] jagexCertificateChain = getJagexCertificateChain(); String codebase = config.getCodeBase(); String initialJar = config.getInitialJar(); URL url = new URL(codebase + initialJar); @@ -113,6 +121,20 @@ public class ClientLoader buffer.write(tmp, 0, n); } + if (!Arrays.equals(metadata.getCertificates(), jagexCertificateChain)) + { + if (metadata.getName().startsWith("META-INF/")) + { + // META-INF/JAGEXLTD.SF and META-INF/JAGEXLTD.RSA are not signed, but we don't need + // anything in META-INF anyway. + continue; + } + else + { + throw new VerificationException("Unable to verify jar entry: " + metadata.getName()); + } + } + zipFile.put(metadata.getName(), buffer.toByteArray()); } } @@ -201,7 +223,8 @@ public class ClientLoader return rs; } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException - | CompressorException | InvalidHeaderException e) + | CompressorException | InvalidHeaderException | CertificateException | VerificationException + | SecurityException e) { if (e instanceof ClassNotFoundException) { @@ -214,4 +237,11 @@ public class ClientLoader return null; } } + + private static Certificate[] getJagexCertificateChain() throws CertificateException + { + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(ClientLoader.class.getResourceAsStream("jagex.crt")); + return certificates.toArray(new Certificate[certificates.size()]); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/rs/VerificationException.java b/runelite-client/src/main/java/net/runelite/client/rs/VerificationException.java new file mode 100644 index 0000000000..040370e8f0 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/rs/VerificationException.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.rs; + +class VerificationException extends Exception +{ + public VerificationException(String message) + { + super(message); + } + + public VerificationException(String message, Throwable cause) + { + super(message, cause); + } +} diff --git a/runelite-client/src/main/resources/net/runelite/client/rs/jagex.crt b/runelite-client/src/main/resources/net/runelite/client/rs/jagex.crt new file mode 100644 index 0000000000..06777e1b5e --- /dev/null +++ b/runelite-client/src/main/resources/net/runelite/client/rs/jagex.crt @@ -0,0 +1,79 @@ +-----BEGIN CERTIFICATE----- +MIIEozCCA4ugAwIBAgIPG66Q8BYiduuCbyAdmzRTMA0GCSqGSIb3DQEBCwUAMEwx +CzAJBgNVBAYTAlVTMRUwEwYDVQQKEwx0aGF3dGUsIEluYy4xJjAkBgNVBAMTHXRo +YXd0ZSBTSEEyNTYgQ29kZSBTaWduaW5nIENBMB4XDTE4MDgxNDAwMDAwMFoXDTIx +MTEwMzIzNTk1OVowYjELMAkGA1UEBhMCR0IxFzAVBgNVBAgMDkNhbWJyaWRnZXNo +aXJlMRIwEAYDVQQHDAlDYW1icmlkZ2UxEjAQBgNVBAoMCUphZ2V4IEx0ZDESMBAG +A1UEAwwJSmFnZXggTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA +idEgJi0xj7hhEyCMdXHxN31gyHS9Iwmzrda2a10BljKl6DGiSia1UWJ/zaJ88hcU +CjIFeUu0B5WZTXOjtLyxhpSSfVFjjNucCMFZLJ0NPSU554ZircHanCxj+rDxaHid +GBasfyrEujhhrcm9H4p1gyhZoMs5KGbxcdwJoCyNv9rIHiQnJhgzZLqG/rRE4JH7 +pjaijU519ZL8iZpz7oRSYIM1LzwMZcBsO4N71cHLvZpEi9B6wExS2W7/o1CEIqXv +tEHtxEFP5XWaWI/toLUBMdXYoKsVEhHs/zkNrjjMGXXQAcS6KOHHg0S+tZEGms30 +SY/69mtefjQceb5YwPjGuwIDAQABo4IBajCCAWYwCQYDVR0TBAIwADAfBgNVHSME +GDAWgBRXhptUuL6mKYrk9sLiExiJhc3ctzAdBgNVHQ4EFgQU7aoWtfnySWo/xlH3 +pkcMyJ9cLdwwKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3RsLnN5bWNiLmNvbS90 +bC5jcmwwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMDMG4GA1Ud +IARnMGUwYwYGZ4EMAQQBMFkwJgYIKwYBBQUHAgEWGmh0dHBzOi8vd3d3LnRoYXd0 +ZS5jb20vY3BzMC8GCCsGAQUFBwICMCMMIWh0dHBzOi8vd3d3LnRoYXd0ZS5jb20v +cmVwb3NpdG9yeTBXBggrBgEFBQcBAQRLMEkwHwYIKwYBBQUHMAGGE2h0dHA6Ly90 +bC5zeW1jZC5jb20wJgYIKwYBBQUHMAKGGmh0dHA6Ly90bC5zeW1jYi5jb20vdGwu +Y3J0MA0GCSqGSIb3DQEBCwUAA4IBAQCWhdlN3dalo14zBJURh3CtITGakbBF6N/T +4xSEVNUtIaJSMHWHVXCMnCEazRKX8C/AaroTuJ1ceUdXJc1CINjIABXz5rVpkWPQ +lPul1PfWyEYIIIEq0PjIEyapnWIDHsZu+HtDIHtRoya3e9p3Ac9+57MsiXLSX9D3 +jueMLakZ20Sy0JLWp2l7WkMjU27Wi3QxpZ3sw7reUzGBPLhGjcbABkqGCHXm+LqT +IrL6j3Co1fSeTGi43siPdP+JI6XK1+mcmTFX6Zktx15UDkYJzn0gqXmzgNQAYNss +iQR8TmbXjlvehDwcVmy/uRW8mWKjlqkMWRJVLoHc+jdUhosApE/5 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIEmTCCA4GgAwIBAgIQcaC3NpXdsa/COyuaGO5UyzANBgkqhkiG9w0BAQsFADCB +qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf +Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw +MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV +BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMTMxMjEwMDAwMDAwWhcNMjMx +MjA5MjM1OTU5WjBMMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhhd3RlLCBJbmMu +MSYwJAYDVQQDEx10aGF3dGUgU0hBMjU2IENvZGUgU2lnbmluZyBDQTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBAJtVAkwXBenQZsP8KK3TwP7v4Ol+1B72 +qhuRRv31Fu2YB1P6uocbfZ4fASerudJnyrcQJVP0476bkLjtI1xC72QlWOWIIhq+ +9ceu9b6KsRERkxoiqXRpwXS2aIengzD5ZPGx4zg+9NbB/BL+c1cXNVeK3VCNA/hm +zcp2gxPI1w5xHeRjyboX+NG55IjSLCjIISANQbcL4i/CgOaIe1Nsw0RjgX9oR4wr +Ks9b9IxJYbpphf1rAHgFJmkTMIA4TvFaVcnFUNaqOIlHQ1z+TXOlScWTaf53lpqv +84wOV7oz2Q7GQtMDd8S7Oa2R+fP3llw6ZKbtJ1fB6EDzU/K+KTT+X/kCAwEAAaOC +ARcwggETMC8GCCsGAQUFBwEBBCMwITAfBggrBgEFBQcwAYYTaHR0cDovL3QyLnN5 +bWNiLmNvbTASBgNVHRMBAf8ECDAGAQH/AgEAMDIGA1UdHwQrMCkwJ6AloCOGIWh0 +dHA6Ly90MS5zeW1jYi5jb20vVGhhd3RlUENBLmNybDAdBgNVHSUEFjAUBggrBgEF +BQcDAgYIKwYBBQUHAwMwDgYDVR0PAQH/BAQDAgEGMCkGA1UdEQQiMCCkHjAcMRow +GAYDVQQDExFTeW1hbnRlY1BLSS0xLTU2ODAdBgNVHQ4EFgQUV4abVLi+pimK5PbC +4hMYiYXN3LcwHwYDVR0jBBgwFoAUe1tFz6/Oy3r9MZIaarbzRutXSFAwDQYJKoZI +hvcNAQELBQADggEBACQ79degNhPHQ/7wCYdo0ZgxbhLkPx4flntrTB6HnovFbKOx +DHtQktWBnLGPLCm37vmRBbmOQfEs9tBZLZjgueqAAUdAlbg9nQO9ebs1tq2cTCf2 +Z0UQycW8h05Ve9KHu93cMO/G1GzMmTVtHOBg081ojylZS4mWCEbJjvx1T8XcCcxO +J4tEzQe8rATgtTOlh5/03XMMkeoSgW/jdfAetZNsRBfVPpfJvQcsVncfhd1G6L/e +LIGUo/flt6fBN591ylV3TV42KcqF2EVBcld1wHlb+jQQBm1kIEK3OsgfHUZkAl/G +R77wxDooVNr2Hk+aohlDpG9J+PxeQiAohItHIG4= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB +qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf +Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw +MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV +BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw +NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j +LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYG +A1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFs +W0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta +3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk +6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6 +Sk/KaAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94J +NqR32HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA +MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XP +r87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7ORtvzw6WfU +DW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz +YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX +xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2 +/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/ +LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7 +jVaMaA== +-----END CERTIFICATE----- \ No newline at end of file From 94a0ee5587c85f4971882bdef0aceef055b683f3 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sat, 16 Feb 2019 14:23:58 +0100 Subject: [PATCH 298/304] Normalize configuration between cache-updater and http-service Signed-off-by: Tomas Slusny --- cache-updater/application.properties | 7 ------- .../cache/updater/CacheConfiguration.java | 21 +++++-------------- .../src/main/resources/application.yaml | 16 ++++++++++++++ 3 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 cache-updater/application.properties create mode 100644 cache-updater/src/main/resources/application.yaml diff --git a/cache-updater/application.properties b/cache-updater/application.properties deleted file mode 100644 index 8bfa1c2542..0000000000 --- a/cache-updater/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -jdbc.url=jdbc:mysql://192.168.1.2:3306/cache -jdbc.username=runelite -jdbc.password=runelite -minio.url=http://192.168.1.2:9000 -minio.accesskey=QPQ15JX1ESAVMR0TLCL1 -minio.secretkey= -minio.bucket=runelite \ No newline at end of file diff --git a/cache-updater/src/main/java/net/runelite/cache/updater/CacheConfiguration.java b/cache-updater/src/main/java/net/runelite/cache/updater/CacheConfiguration.java index 354ca0b394..229ea1d268 100644 --- a/cache-updater/src/main/java/net/runelite/cache/updater/CacheConfiguration.java +++ b/cache-updater/src/main/java/net/runelite/cache/updater/CacheConfiguration.java @@ -33,9 +33,10 @@ import java.util.Map; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.sql2o.Sql2o; import org.sql2o.converters.Converter; import org.sql2o.quirks.NoQuirks; @@ -43,16 +44,7 @@ import org.sql2o.quirks.NoQuirks; @Configuration public class CacheConfiguration { - @Value("${jdbc.url}") - private String jdbcUrl; - - @Value("${jdbc.username}") - private String jdbcUsername; - - @Value("${jdbc.password}") - private String jdbcPassword; - - @Value("${minio.url}") + @Value("${minio.endpoint}") private String minioUrl; @Value("${minio.accesskey}") @@ -62,13 +54,10 @@ public class CacheConfiguration private String minioSecretKey; @Bean + @ConfigurationProperties(prefix = "datasource.runelite-cache") public DataSource dataSource() { - DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setUrl(jdbcUrl); - dataSource.setUsername(jdbcUsername); - dataSource.setPassword(jdbcPassword); - return dataSource; + return DataSourceBuilder.create().build(); } @Bean diff --git a/cache-updater/src/main/resources/application.yaml b/cache-updater/src/main/resources/application.yaml new file mode 100644 index 0000000000..df290d680f --- /dev/null +++ b/cache-updater/src/main/resources/application.yaml @@ -0,0 +1,16 @@ +--- +# Database +datasource: + runelite-cache: + driverClassName: com.mysql.jdbc.Driver + type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource + url: jdbc:mysql://localhost/runelite-cache + username: runelite + password: runelite + +# Minio client storage for cache +minio: + endpoint: http://localhost:9000 + accesskey: AM54M27O4WZK65N6F8IP + secretkey: /PZCxzmsJzwCHYlogcymuprniGCaaLUOET2n6yMP + bucket: runelite From b367e34202cd0f9ceb8904dcfdbb9726652320c3 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 19 Feb 2019 12:38:46 +0000 Subject: [PATCH 299/304] Migrate OAuth callback to Spring configuration property Signed-off-by: Tomas Slusny --- .../net/runelite/http/service/account/AccountService.java | 8 +++++--- http-service/src/main/resources/application.yaml | 1 + http-service/src/test/resources/application-dev.yaml | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java index 8cc83d2d80..f9951446aa 100644 --- a/http-service/src/main/java/net/runelite/http/service/account/AccountService.java +++ b/http-service/src/main/java/net/runelite/http/service/account/AccountService.java @@ -89,7 +89,6 @@ public class AccountService private static final String SCOPE = "https://www.googleapis.com/auth/userinfo.email"; private static final String USERINFO = "https://www.googleapis.com/oauth2/v2/userinfo"; - private static final String RL_OAUTH_URL = "https://api.runelite.net/oauth/"; private static final String RL_REDIR = "https://runelite.net/logged-in"; private final Gson gson = RuneLiteAPI.GSON; @@ -98,6 +97,7 @@ public class AccountService private final Sql2o sql2o; private final String oauthClientId; private final String oauthClientSecret; + private final String oauthCallback; private final AuthFilter auth; private final RedisPool jedisPool; @@ -106,6 +106,7 @@ public class AccountService @Qualifier("Runelite SQL2O") Sql2o sql2o, @Value("${oauth.client-id}") String oauthClientId, @Value("${oauth.client-secret}") String oauthClientSecret, + @Value("${oauth.callback}") String oauthCallback, AuthFilter auth, RedisPool jedisPool ) @@ -113,6 +114,7 @@ public class AccountService this.sql2o = sql2o; this.oauthClientId = oauthClientId; this.oauthClientSecret = oauthClientSecret; + this.oauthCallback = oauthCallback; this.auth = auth; this.jedisPool = jedisPool; @@ -147,7 +149,7 @@ public class AccountService .apiKey(oauthClientId) .apiSecret(oauthClientSecret) .scope(SCOPE) - .callback(RL_OAUTH_URL) + .callback(oauthCallback) .state(gson.toJson(state)) .build(GoogleApi20.instance()); @@ -186,7 +188,7 @@ public class AccountService .apiKey(oauthClientId) .apiSecret(oauthClientSecret) .scope(SCOPE) - .callback(RL_OAUTH_URL) + .callback(oauthCallback) .state(gson.toJson(state)) .build(GoogleApi20.instance()); diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml index a6437b36d7..9905e61695 100644 --- a/http-service/src/main/resources/application.yaml +++ b/http-service/src/main/resources/application.yaml @@ -16,6 +16,7 @@ spring.jmx.enabled: false oauth: client-id: client-secret: + callback: https://api.runelite.net/oauth/ # Minio client storage for cache minio: diff --git a/http-service/src/test/resources/application-dev.yaml b/http-service/src/test/resources/application-dev.yaml index b8c5fb91d1..0d2f1e06a9 100644 --- a/http-service/src/test/resources/application-dev.yaml +++ b/http-service/src/test/resources/application-dev.yaml @@ -25,3 +25,7 @@ datasource: url: jdbc:mysql://localhost:3306/runelite-tracker username: runelite password: runelite + +# Development oauth callback (without proxy) +oauth: + callback: http://localhost:8080/account/callback From d3c12157b0655941ee051f9803d12be9844410b3 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 14 Feb 2019 21:56:57 +0100 Subject: [PATCH 300/304] Add development configuration for Spring http-service - Remove spring boot test (no longer necessary) - Move test development configuration to main package Signed-off-by: Tomas Slusny --- http-service/pom.xml | 12 ++--- .../resources/application-dev.yaml | 0 .../service/SpringBootWebApplicationTest.java | 45 ------------------- 3 files changed, 6 insertions(+), 51 deletions(-) rename http-service/src/{test => main}/resources/application-dev.yaml (100%) delete mode 100644 http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java diff --git a/http-service/pom.xml b/http-service/pom.xml index e2c6296431..c297dcedf2 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -82,6 +82,12 @@ ${project.version} + + mysql + mysql-connector-java + 5.1.43 + provided + org.sql2o sql2o @@ -127,12 +133,6 @@ spring-boot-starter-test test - - mysql - mysql-connector-java - 5.1.43 - test - com.squareup.okhttp3 mockwebserver diff --git a/http-service/src/test/resources/application-dev.yaml b/http-service/src/main/resources/application-dev.yaml similarity index 100% rename from http-service/src/test/resources/application-dev.yaml rename to http-service/src/main/resources/application-dev.yaml diff --git a/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java b/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java deleted file mode 100644 index 6adcc0f6f0..0000000000 --- a/http-service/src/test/java/net/runelite/http/service/SpringBootWebApplicationTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.service; - -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.boot.SpringApplication; - -public class SpringBootWebApplicationTest -{ - @Test - @Ignore - public void run() throws InterruptedException - { - System.setProperty("spring.profiles.active", "dev"); - SpringApplication.run(SpringBootWebApplication.class); - - for (;;) - { - Thread.sleep(100L); - } - } -} \ No newline at end of file From 69c3341467b0e0ba1acd56deb74bbae9ab0d262b Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 23 Mar 2019 21:38:40 -0400 Subject: [PATCH 301/304] http-service: update mysql driver to mariadb 2.2.3 --- http-service/pom.xml | 6 +++--- .../src/main/resources/application-dev.yaml | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/http-service/pom.xml b/http-service/pom.xml index c297dcedf2..83c3441649 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -83,9 +83,9 @@ - mysql - mysql-connector-java - 5.1.43 + org.mariadb.jdbc + mariadb-java-client + 2.2.3 provided diff --git a/http-service/src/main/resources/application-dev.yaml b/http-service/src/main/resources/application-dev.yaml index 0d2f1e06a9..cc2286e9b3 100644 --- a/http-service/src/main/resources/application-dev.yaml +++ b/http-service/src/main/resources/application-dev.yaml @@ -6,23 +6,23 @@ logging.level.net.runelite: DEBUG datasource: runelite: jndiName: - driverClassName: com.mysql.jdbc.Driver - type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource - url: jdbc:mysql://localhost:3306/runelite + driverClassName: org.mariadb.jdbc.Driver + type: org.mariadb.jdbc.MariaDbDataSource + url: jdbc:mariadb://localhost:3306/runelite username: runelite password: runelite runelite-cache: jndiName: - driverClassName: com.mysql.jdbc.Driver - type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource - url: jdbc:mysql://localhost:3306/runelite-cache + driverClassName: org.mariadb.jdbc.Driver + type: org.mariadb.jdbc.MariaDbDataSource + url: jdbc:mariadb://localhost:3306/cache username: runelite password: runelite runelite-tracker: jndiName: - driverClassName: com.mysql.jdbc.Driver - type: com.mysql.jdbc.jdbc2.optional.MysqlDataSource - url: jdbc:mysql://localhost:3306/runelite-tracker + driverClassName: org.mariadb.jdbc.Driver + type: org.mariadb.jdbc.MariaDbDataSource + url: jdbc:mariadb://localhost:3306/xptracker username: runelite password: runelite From 9a5a89171b13edfa86fbfd3f816f1379c8edf0a0 Mon Sep 17 00:00:00 2001 From: Adam Ballinger Date: Mon, 4 Mar 2019 19:30:02 +0000 Subject: [PATCH 302/304] Add brimstone chest support to loot tracker --- .../loottracker/LootTrackerPlugin.java | 77 ++++++++++++++++++- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 4390da8a47..ec2bf74aad 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -25,6 +25,9 @@ */ package net.runelite.client.plugins.loottracker; +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Multiset; +import com.google.common.collect.Multisets; import com.google.inject.Provides; import java.awt.image.BufferedImage; import java.io.IOException; @@ -55,8 +58,7 @@ import net.runelite.api.SpriteID; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; -import net.runelite.client.events.SessionClose; -import net.runelite.client.events.SessionOpen; +import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.WidgetID; import net.runelite.client.account.AccountSession; @@ -66,6 +68,8 @@ import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.NpcLootReceived; import net.runelite.client.events.PlayerLootReceived; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemStack; import net.runelite.client.game.SpriteManager; @@ -93,6 +97,10 @@ public class LootTrackerPlugin extends Plugin private static final Pattern CLUE_SCROLL_PATTERN = Pattern.compile("You have completed [0-9]+ ([a-z]+) Treasure Trails."); private static final int THEATRE_OF_BLOOD_REGION = 12867; + // Brimstone loot handling + private static final String BRIMSTONE_CHEST_MESSAGE = "You find some treasure in the chest!"; + private static final String BRIMSTONE_CHEST_EVENT_TYPE = "Brimstone Chest"; + @Inject private ClientToolbar clientToolbar; @@ -123,6 +131,8 @@ public class LootTrackerPlugin extends Plugin private List ignoredItems = new ArrayList<>(); + private Multiset inventorySnapshot; + @Getter(AccessLevel.PACKAGE) private LootTrackerClient lootTrackerClient; @@ -363,8 +373,25 @@ public class LootTrackerPlugin extends Plugin return; } + final String message = event.getMessage(); + + if (message.equals(BRIMSTONE_CHEST_MESSAGE)) + { + eventType = BRIMSTONE_CHEST_EVENT_TYPE; + + final ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); + if (itemContainer != null) + { + inventorySnapshot = HashMultiset.create(); + Arrays.stream(itemContainer.getItems()) + .forEach(item -> inventorySnapshot.add(item.getId(), item.getQuantity())); + } + + return; + } + // Check if message is for a clue scroll reward - final Matcher m = CLUE_SCROLL_PATTERN.matcher(Text.removeTags(event.getMessage())); + final Matcher m = CLUE_SCROLL_PATTERN.matcher(Text.removeTags(message)); if (m.find()) { final String type = m.group(1).toLowerCase(); @@ -389,6 +416,50 @@ public class LootTrackerPlugin extends Plugin } } + @Subscribe + public void onItemContainerChanged(ItemContainerChanged event) + { + if (eventType == null || !eventType.equals(BRIMSTONE_CHEST_EVENT_TYPE)) + { + return; + } + + if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)) + { + return; + } + + processBrimstoneChestLoot(event.getItemContainer()); + eventType = null; + } + + private void processBrimstoneChestLoot(ItemContainer inventoryContainer) + { + if (inventorySnapshot != null) + { + Multiset currentInventory = HashMultiset.create(); + Arrays.stream(inventoryContainer.getItems()) + .forEach(item -> currentInventory.add(item.getId(), item.getQuantity())); + + final Multiset diff = Multisets.difference(currentInventory, inventorySnapshot); + + List items = diff.entrySet().stream() + .map(e -> new ItemStack(e.getElement(), e.getCount(), client.getLocalPlayer().getLocalLocation())) + .collect(Collectors.toList()); + + final LootTrackerItem[] entries = buildEntries(stack(items)); + SwingUtilities.invokeLater(() -> panel.add(BRIMSTONE_CHEST_EVENT_TYPE, -1, entries)); + + if (lootTrackerClient != null && config.saveLoot()) + { + LootRecord lootRecord = new LootRecord(BRIMSTONE_CHEST_EVENT_TYPE, LootRecordType.EVENT, toGameItems(items), Instant.now()); + lootTrackerClient.submit(lootRecord); + } + + inventorySnapshot = null; + } + } + void toggleItem(String name, boolean ignore) { final Set ignoredItemSet = new HashSet<>(ignoredItems); From 57b600a25780db4ff83dca3f211f9b3797181f78 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Mar 2019 15:58:12 -0400 Subject: [PATCH 303/304] spec plugin: only count specs on npcs --- .../plugins/specialcounter/SpecialCounterPlugin.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java index 40a50e7c53..0605791771 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java @@ -126,9 +126,9 @@ public class SpecialCounterPlugin extends Plugin return; } - checkInteracting(); + int interactingId = checkInteracting(); - if (specialHitpointsExperience != -1 && specialUsed) + if (interactingId > -1 && specialHitpointsExperience != -1 && specialUsed) { specialUsed = false; int hpXp = client.getSkillExperience(Skill.HITPOINTS); @@ -145,7 +145,7 @@ public class SpecialCounterPlugin extends Plugin } } - private void checkInteracting() + private int checkInteracting() { Player localPlayer = client.getLocalPlayer(); Actor interacting = localPlayer.getInteracting(); @@ -168,7 +168,11 @@ public class SpecialCounterPlugin extends Plugin } } + + return interactingId; } + + return -1; } @Subscribe From fb2fdadbc50f55f689a514abb28fd72ea8a25c83 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Mar 2019 15:59:54 -0400 Subject: [PATCH 304/304] spec plugin: share specs with party Co-authored-by: 15987632 --- .../specialcounter/SpecialCounter.java | 25 ++++ .../specialcounter/SpecialCounterPlugin.java | 108 +++++++++++++++--- .../specialcounter/SpecialCounterUpdate.java | 38 ++++++ 3 files changed, 158 insertions(+), 13 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java index 3c7b0f2135..425c781b45 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java @@ -25,15 +25,18 @@ package net.runelite.client.plugins.specialcounter; import java.awt.image.BufferedImage; +import java.util.Map; import net.runelite.client.ui.overlay.infobox.Counter; class SpecialCounter extends Counter { + private final SpecialCounterPlugin plugin; private SpecialWeapon weapon; SpecialCounter(BufferedImage image, SpecialCounterPlugin plugin, int hitValue, SpecialWeapon weapon) { super(image, plugin, hitValue); + this.plugin = plugin; this.weapon = weapon; } @@ -46,7 +49,29 @@ class SpecialCounter extends Counter @Override public String getTooltip() { + Map partySpecs = plugin.getPartySpecs(); int hitValue = getCount(); + + if (partySpecs.isEmpty()) + { + return buildTooltip(hitValue); + } + + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(buildTooltip(hitValue)); + + for (Map.Entry entry : partySpecs.entrySet()) + { + stringBuilder.append("
") + .append(entry.getKey() == null ? "You" : entry.getKey()).append(": ") + .append(buildTooltip(entry.getValue())); + } + + return stringBuilder.toString(); + } + + private String buildTooltip(int hitValue) + { if (!weapon.isDamage()) { if (hitValue == 1) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java index 0605791771..4ff5b8ae6f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java @@ -24,9 +24,13 @@ */ package net.runelite.client.plugins.specialcounter; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; import javax.inject.Inject; +import lombok.AccessLevel; +import lombok.Getter; import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.EquipmentInventorySlot; @@ -42,11 +46,14 @@ import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.VarbitChanged; +import net.runelite.client.callback.ClientThread; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; +import net.runelite.client.ws.PartyService; +import net.runelite.client.ws.WSClient; @PluginDescriptor( name = "Special Attack Counter", @@ -65,20 +72,38 @@ public class SpecialCounterPlugin extends Plugin private SpecialWeapon specialWeapon; private final Set interactedNpcIds = new HashSet<>(); private final SpecialCounter[] specialCounter = new SpecialCounter[SpecialWeapon.values().length]; + @Getter(AccessLevel.PACKAGE) + private final Map partySpecs = new HashMap<>(); @Inject private Client client; + @Inject + private ClientThread clientThread; + + @Inject + private WSClient wsClient; + + @Inject + private PartyService party; + @Inject private InfoBoxManager infoBoxManager; @Inject private ItemManager itemManager; + @Override + protected void startUp() + { + wsClient.registerMessage(SpecialCounterUpdate.class); + } + @Override protected void shutDown() { removeCounters(); + wsClient.unregisterMessage(SpecialCounterUpdate.class); } @Subscribe @@ -139,7 +164,16 @@ public class SpecialCounterPlugin extends Plugin { if (specialWeapon != null) { - updateCounter(specialWeapon, deltaExperience); + int hit = getHit(specialWeapon, deltaExperience); + + updateCounter(specialWeapon, null, hit); + + if (!party.getMembers().isEmpty()) + { + final SpecialCounterUpdate specialCounterUpdate = new SpecialCounterUpdate(interactingId, specialWeapon, hit); + specialCounterUpdate.setMemberId(party.getLocalMember().getMemberId()); + wsClient.send(specialCounterUpdate); + } } } } @@ -157,16 +191,7 @@ public class SpecialCounterPlugin extends Plugin if (!interactedNpcIds.contains(interactingId)) { removeCounters(); - modifier = 1d; - interactedNpcIds.add(interactingId); - - final Boss boss = Boss.getBoss(interactingId); - if (boss != null) - { - modifier = boss.getModifier(); - interactedNpcIds.addAll(boss.getIds()); - } - + addInteracting(interactingId); } return interactingId; @@ -175,6 +200,20 @@ public class SpecialCounterPlugin extends Plugin return -1; } + private void addInteracting(int npcId) + { + modifier = 1d; + interactedNpcIds.add(npcId); + + // Add alternate forms of bosses + final Boss boss = Boss.getBoss(npcId); + if (boss != null) + { + modifier = boss.getModifier(); + interactedNpcIds.addAll(boss.getIds()); + } + } + @Subscribe public void onNpcDespawned(NpcDespawned npcDespawned) { @@ -186,6 +225,36 @@ public class SpecialCounterPlugin extends Plugin } } + @Subscribe + public void onSpecialCounterUpdate(SpecialCounterUpdate event) + { + if (party.getLocalMember().getMemberId().equals(event.getMemberId())) + { + return; + } + + String name = party.getMemberById(event.getMemberId()).getName(); + if (name == null) + { + return; + } + + clientThread.invoke(() -> + { + // If not interacting with any npcs currently, add to interacting list + if (interactedNpcIds.isEmpty()) + { + addInteracting(event.getNpcId()); + } + + // Otherwise we only add the count if it is against a npc we are already tracking + if (interactedNpcIds.contains(event.getNpcId())) + { + updateCounter(event.getWeapon(), name, event.getHit()); + } + }); + } + private SpecialWeapon usedSpecialWeapon() { ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); @@ -214,10 +283,9 @@ public class SpecialCounterPlugin extends Plugin return null; } - private void updateCounter(SpecialWeapon specialWeapon, int deltaExperience) + private void updateCounter(SpecialWeapon specialWeapon, String name, int hit) { SpecialCounter counter = specialCounter[specialWeapon.ordinal()]; - int hit = getHit(specialWeapon, deltaExperience); if (counter == null) { @@ -230,11 +298,25 @@ public class SpecialCounterPlugin extends Plugin { counter.addHits(hit); } + + // If in a party, add hit to partySpecs for the infobox tooltip + if (!party.getMembers().isEmpty()) + { + if (partySpecs.containsKey(name)) + { + partySpecs.put(name, hit + partySpecs.get(name)); + } + else + { + partySpecs.put(name, hit); + } + } } private void removeCounters() { interactedNpcIds.clear(); + partySpecs.clear(); for (int i = 0; i < specialCounter.length; ++i) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java new file mode 100644 index 0000000000..16eff1af25 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019, Trevor + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.specialcounter; + +import lombok.EqualsAndHashCode; +import lombok.Value; +import net.runelite.http.api.ws.messages.party.PartyMemberMessage; + +@Value +@EqualsAndHashCode(callSuper = true) +public class SpecialCounterUpdate extends PartyMemberMessage +{ + private final int npcId; + private final SpecialWeapon weapon; + private final int hit; +}