From ce6cff4a1f64423d1f39544c258aa2c87073555d Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Mon, 7 Dec 2020 12:04:39 +0000 Subject: [PATCH 01/17] timetracking: Add option to show the soonest completion time of a tab --- .../plugins/timetracking/TimeTrackingConfig.java | 12 ++++++++++++ .../plugins/timetracking/TimeTrackingPlugin.java | 5 +++++ .../timetracking/farming/FarmingTracker.java | 16 ++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java index 494320517a..53d31a8314 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java @@ -38,6 +38,7 @@ public interface TimeTrackingConfig extends Config String BOTANIST = "botanist"; String TIMERS = "timers"; String STOPWATCHES = "stopwatches"; + String PREFER_SOONEST = "preferSoonest"; @ConfigItem( keyName = "timeFormatMode", @@ -118,6 +119,17 @@ public interface TimeTrackingConfig extends Config return 10; } + @ConfigItem( + keyName = PREFER_SOONEST, + name = "Prefer soonest completion", + description = "When displaying completion times on the overview, prefer showing the soonest any patch will complete.", + position = 7 + ) + default boolean preferSoonest() + { + return false; + } + @ConfigItem( keyName = "activeTab", name = "Active Tab", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java index 55ff192afd..2b08418d10 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java @@ -49,6 +49,7 @@ import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.CONFIG_GROUP; +import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.PREFER_SOONEST; import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.STOPWATCHES; import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.TIMERS; import net.runelite.client.plugins.timetracking.clocks.ClockManager; @@ -172,6 +173,10 @@ public class TimeTrackingPlugin extends Plugin { clockManager.loadStopwatches(); } + else if (e.getKey().equals(PREFER_SOONEST)) + { + farmingTracker.loadCompletionTimes(); + } } @Subscribe diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java index 298e91a5ce..dca3a4f51c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java @@ -277,7 +277,7 @@ public class FarmingTracker { for (Map.Entry> tab : farmingWorld.getTabs().entrySet()) { - long maxCompletionTime = 0; + long extremumCompletionTime = config.preferSoonest() ? Long.MAX_VALUE : 0; boolean allUnknown = true; boolean allEmpty = true; @@ -296,7 +296,15 @@ public class FarmingTracker allEmpty = false; // update max duration if this patch takes longer to grow - maxCompletionTime = Math.max(maxCompletionTime, prediction.getDoneEstimate()); + if (config.preferSoonest()) + { + extremumCompletionTime = Math.min(extremumCompletionTime, prediction.getDoneEstimate()); + } + else + { + extremumCompletionTime = Math.max(extremumCompletionTime, prediction.getDoneEstimate()); + } + } } @@ -313,7 +321,7 @@ public class FarmingTracker state = SummaryState.EMPTY; completionTime = -1L; } - else if (maxCompletionTime <= Instant.now().getEpochSecond()) + else if (extremumCompletionTime <= Instant.now().getEpochSecond()) { state = SummaryState.COMPLETED; completionTime = 0; @@ -321,7 +329,7 @@ public class FarmingTracker else { state = SummaryState.IN_PROGRESS; - completionTime = maxCompletionTime; + completionTime = extremumCompletionTime; } summaries.put(tab.getKey(), state); completionTimes.put(tab.getKey(), completionTime); From a5b6e279a818945ce7768bacf8bf9c7e0a7765a7 Mon Sep 17 00:00:00 2001 From: Cyborger1 <45152844+Cyborger1@users.noreply.github.com> Date: Mon, 25 Jan 2021 03:05:55 -0500 Subject: [PATCH 02/17] idle notifier: Add low & high energy notifications (#12995) Co-authored-by: Reasel --- .../idlenotifier/IdleNotifierConfig.java | 31 +++++++++- .../idlenotifier/IdleNotifierPlugin.java | 58 +++++++++++++++++++ 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java index b7ab769756..99f0a5b55f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java @@ -27,6 +27,7 @@ package net.runelite.client.plugins.idlenotifier; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Range; import net.runelite.client.config.Units; @ConfigGroup("idlenotifier") @@ -110,10 +111,36 @@ public interface IdleNotifierConfig extends Config return 0; } + @ConfigItem( + keyName = "lowEnergy", + name = "Low Energy Threshold", + description = "The amount of energy points remaining to send a notification at. A value of 100 will disable notification.", + position = 8 + ) + @Units(Units.PERCENT) + @Range(max = 100) + default int getLowEnergyThreshold() + { + return 100; + } + + @ConfigItem( + keyName = "highEnergy", + name = "High Energy Threshold", + description = "The amount of energy points reached to send a notification. A value of 0 will disable notification.", + position = 9 + ) + @Units(Units.PERCENT) + @Range(max = 100) + default int getHighEnergyThreshold() + { + return 0; + } + @ConfigItem( keyName = "oxygen", name = "Oxygen Threshold", - position = 8, + position = 10, description = "The amount of remaining oxygen to send a notification at. A value of 0 will disable notification." ) @Units(Units.PERCENT) @@ -125,7 +152,7 @@ public interface IdleNotifierConfig extends Config @ConfigItem( keyName = "spec", name = "Spec Threshold", - position = 9, + position = 11, description = "The amount of special attack energy reached to send a notification at. A value of 0 will disable notification." ) @Units(Units.PERCENT) 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 ee084f3c44..e9d2d01896 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 @@ -93,6 +93,8 @@ public class IdleNotifierPlugin extends Plugin private boolean notifyPosition = false; private boolean notifyHitpoints = true; private boolean notifyPrayer = true; + private boolean shouldNotifyLowEnergy = false; + private boolean shouldNotifyHighEnergy = false; private boolean notifyOxygen = true; private boolean notifyIdleLogout = true; private boolean notify6HourLogout = true; @@ -471,6 +473,16 @@ public class IdleNotifierPlugin extends Plugin notifier.notify("[" + local.getName() + "] has low prayer!"); } + if (checkLowEnergy()) + { + notifier.notify("[" + local.getName() + "] has low run energy!"); + } + + if (checkHighEnergy()) + { + notifier.notify("[" + local.getName() + "] has restored run energy!"); + } + if (checkLowOxygen()) { notifier.notify("[" + local.getName() + "] has low oxygen!"); @@ -572,6 +584,52 @@ public class IdleNotifierPlugin extends Plugin return false; } + private boolean checkLowEnergy() + { + if (config.getLowEnergyThreshold() >= 100) + { + return false; + } + + if (client.getEnergy() <= config.getLowEnergyThreshold()) + { + if (shouldNotifyLowEnergy) + { + shouldNotifyLowEnergy = false; + return true; + } + } + else + { + shouldNotifyLowEnergy = true; + } + + return false; + } + + private boolean checkHighEnergy() + { + if (config.getHighEnergyThreshold() == 0) + { + return false; + } + + if (client.getEnergy() >= config.getHighEnergyThreshold()) + { + if (shouldNotifyHighEnergy) + { + shouldNotifyHighEnergy = false; + return true; + } + } + else + { + shouldNotifyHighEnergy = true; + } + + return false; + } + private boolean checkInteractionIdle(Duration waitDuration, Player local) { if (lastInteract == null) From 426265c765eaf678f1f67787efe3feace978583f Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Jan 2021 18:09:26 -0500 Subject: [PATCH 03/17] ground markers: add option to export and import Co-authored-by: Paul Norton --- .../groundmarkers/GroundMarkerPlugin.java | 17 +- .../GroundMarkerSharingManager.java | 243 ++++++++++++++++++ 2 files changed, 257 insertions(+), 3 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerSharingManager.java 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 73e93f86ad..c1e1774931 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 @@ -51,6 +51,7 @@ import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.plugins.Plugin; @@ -98,7 +99,13 @@ public class GroundMarkerPlugin extends Plugin @Inject private ChatboxPanelManager chatboxPanelManager; - private void savePoints(int regionId, Collection points) + @Inject + private EventBus eventBus; + + @Inject + private GroundMarkerSharingManager sharingManager; + + void savePoints(int regionId, Collection points) { if (points == null || points.isEmpty()) { @@ -110,7 +117,7 @@ public class GroundMarkerPlugin extends Plugin configManager.setConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId, json); } - private Collection getPoints(int regionId) + Collection getPoints(int regionId) { String json = configManager.getConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); if (Strings.isNullOrEmpty(json)) @@ -129,7 +136,7 @@ public class GroundMarkerPlugin extends Plugin return configManager.getConfig(GroundMarkerConfig.class); } - private void loadPoints() + void loadPoints() { points.clear(); @@ -181,14 +188,18 @@ public class GroundMarkerPlugin extends Plugin { overlayManager.add(overlay); overlayManager.add(minimapOverlay); + sharingManager.addMenuOptions(); loadPoints(); + eventBus.register(sharingManager); } @Override public void shutDown() { + eventBus.unregister(sharingManager); overlayManager.remove(overlay); overlayManager.remove(minimapOverlay); + sharingManager.removeMenuOptions(); points.clear(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerSharingManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerSharingManager.java new file mode 100644 index 0000000000..8899a81f0d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerSharingManager.java @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2021, 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.groundmarkers; + +import com.google.common.base.Strings; +import com.google.common.util.concurrent.Runnables; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.google.gson.reflect.TypeToken; +import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.ChatMessageType; +import net.runelite.api.Client; +import net.runelite.api.events.WidgetMenuOptionClicked; +import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION; +import net.runelite.client.chat.ChatMessageManager; +import net.runelite.client.chat.QueuedMessage; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.chatbox.ChatboxPanelManager; +import net.runelite.client.menus.MenuManager; +import net.runelite.client.menus.WidgetMenuOption; +import net.runelite.http.api.RuneLiteAPI; + +@Slf4j +class GroundMarkerSharingManager +{ + private static final WidgetMenuOption EXPORT_MARKERS_OPTION = new WidgetMenuOption("Export", "Ground Markers", WORLD_MAP_OPTION); + private static final WidgetMenuOption IMPORT_MARKERS_OPTION = new WidgetMenuOption("Import", "Ground Markers", WORLD_MAP_OPTION); + + private static final Gson GSON = RuneLiteAPI.GSON; + + private final GroundMarkerPlugin plugin; + private final Client client; + private final MenuManager menuManager; + private final ChatMessageManager chatMessageManager; + private final ChatboxPanelManager chatboxPanelManager; + + @Inject + private GroundMarkerSharingManager(GroundMarkerPlugin plugin, Client client, MenuManager menuManager, ChatMessageManager chatMessageManager, ChatboxPanelManager chatboxPanelManager) + { + this.plugin = plugin; + this.client = client; + this.menuManager = menuManager; + this.chatMessageManager = chatMessageManager; + this.chatboxPanelManager = chatboxPanelManager; + } + + void addMenuOptions() + { + menuManager.addManagedCustomMenu(EXPORT_MARKERS_OPTION); + menuManager.addManagedCustomMenu(IMPORT_MARKERS_OPTION); + } + + void removeMenuOptions() + { + menuManager.removeManagedCustomMenu(EXPORT_MARKERS_OPTION); + menuManager.removeManagedCustomMenu(IMPORT_MARKERS_OPTION); + } + + private boolean widgetMenuClickedEquals(final WidgetMenuOptionClicked event, final WidgetMenuOption target) + { + return event.getMenuTarget().equals(target.getMenuTarget()) && + event.getMenuOption().equals(target.getMenuOption()); + } + + @Subscribe + public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) + { + // ensure that the option clicked is the export markers option + if (event.getWidget() != WORLD_MAP_OPTION) + { + return; + } + + if (widgetMenuClickedEquals(event, EXPORT_MARKERS_OPTION)) + { + exportGroundMarkers(); + } + else if (widgetMenuClickedEquals(event, IMPORT_MARKERS_OPTION)) + { + promptForImport(); + } + } + + private void exportGroundMarkers() + { + int[] regions = client.getMapRegions(); + if (regions == null) + { + return; + } + + List activePoints = Arrays.stream(regions) + .mapToObj(regionId -> plugin.getPoints(regionId).stream()) + .flatMap(Function.identity()) + .collect(Collectors.toList()); + + if (activePoints.isEmpty()) + { + sendChatMessage("You have no ground markers to export."); + return; + } + + final String exportDump = GSON.toJson(activePoints); + + log.debug("Exported ground markers: {}", exportDump); + + Toolkit.getDefaultToolkit() + .getSystemClipboard() + .setContents(new StringSelection(exportDump), null); + sendChatMessage(activePoints.size() + " ground markers were copied to your clipboard."); + } + + private void promptForImport() + { + final String clipboardText; + try + { + clipboardText = Toolkit.getDefaultToolkit() + .getSystemClipboard() + .getData(DataFlavor.stringFlavor) + .toString(); + } + catch (IOException | UnsupportedFlavorException ex) + { + sendChatMessage("Unable to read system clipboard."); + log.warn("error reading clipboard", ex); + return; + } + + log.debug("Clipboard contents: {}", clipboardText); + if (Strings.isNullOrEmpty(clipboardText)) + { + sendChatMessage("You do not have any ground markers copied in your clipboard."); + return; + } + + List importPoints; + try + { + // CHECKSTYLE:OFF + importPoints = GSON.fromJson(clipboardText, new TypeToken>(){}.getType()); + // CHECKSTYLE:ON + } + catch (JsonSyntaxException e) + { + log.debug("Malformed JSON for clipboard import", e); + sendChatMessage("You do not have any ground markers copied in your clipboard."); + return; + } + + if (importPoints.isEmpty()) + { + sendChatMessage("You do not have any ground markers copied in your clipboard."); + return; + } + + chatboxPanelManager.openTextMenuInput("Are you sure you want to import " + importPoints.size() + " ground markers?") + .option("Yes", () -> importGroundMarkers(importPoints)) + .option("No", Runnables::doNothing) + .build(); + } + + private void importGroundMarkers(Collection importPoints) + { + // regions being imported may not be loaded on client, + // so need to import each bunch directly into the config + // first, collate the list of unique region ids in the import + Map> regionGroupedPoints = importPoints.stream() + .collect(Collectors.groupingBy(GroundMarkerPoint::getRegionId)); + + // now import each region into the config + regionGroupedPoints.forEach((regionId, groupedPoints) -> + { + // combine imported points with existing region points + log.debug("Importing {} points to region {}", groupedPoints.size(), regionId); + Collection regionPoints = plugin.getPoints(regionId); + + List mergedList = new ArrayList<>(regionPoints.size() + groupedPoints.size()); + // add existing points + mergedList.addAll(regionPoints); + + // add new points + for (GroundMarkerPoint point : groupedPoints) + { + // filter out duplicates + if (!mergedList.contains(point)) + { + mergedList.add(point); + } + } + + plugin.savePoints(regionId, mergedList); + }); + + // reload points from config + log.debug("Reloading points after import"); + plugin.loadPoints(); + sendChatMessage(importPoints.size() + " ground markers were imported from the clipboard."); + } + + private void sendChatMessage(final String message) + { + chatMessageManager.queue(QueuedMessage.builder() + .type(ChatMessageType.CONSOLE) + .runeLiteFormattedMessage(message) + .build()); + } +} From f6c68eefc8a3c5415451bdbd6190b1f745ed5489 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Jan 2021 19:27:15 -0500 Subject: [PATCH 04/17] api: remove PlayerMenuOptionClicked There is only one legitimate use of this, which is in the hiscore plugin, but it is simple to replace it with a normal menu option clicked event. Additionally the world hopper was incorrectly using this event for the Hop option, so it has been changed to use the menu option clicked event. --- .../api/events/PlayerMenuOptionClicked.java | 44 --------- .../runelite/client/menus/MenuManager.java | 27 +----- .../client/plugins/hiscore/HiscorePlugin.java | 28 +++++- .../worldhopper/WorldHopperPlugin.java | 10 +- .../client/menus/MenuManagerTest.java | 95 ------------------- 5 files changed, 32 insertions(+), 172 deletions(-) delete mode 100644 runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java delete mode 100644 runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java deleted file mode 100644 index dcfb0421ca..0000000000 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016-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.api.events; - -import lombok.Data; - -/** - * An event where a player menu option that was added by RuneLite has - * been clicked (ie. HiScore Lookup). - */ -@Data -public class PlayerMenuOptionClicked -{ - /** - * The menu option clicked. - */ - private String menuOption; - /** - * The target player. - */ - private String menuTarget; -} diff --git a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java index 67129b0ba5..a597038628 100644 --- a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java +++ b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java @@ -34,25 +34,21 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.regex.Pattern; import javax.inject.Inject; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; -import net.runelite.api.IconID; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; import net.runelite.api.NPCComposition; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.NpcActionChanged; -import net.runelite.api.events.PlayerMenuOptionClicked; import net.runelite.api.events.PlayerMenuOptionsChanged; import net.runelite.api.events.WidgetMenuOptionClicked; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.util.Text; @Singleton @Slf4j @@ -64,8 +60,6 @@ public class MenuManager private static final int IDX_LOWER = 4; private static final int IDX_UPPER = 8; - private static final Pattern BOUNTY_EMBLEM_TAG_AND_TIER_REGEXP = Pattern.compile(String.format("%s[1-9]0?", IconID.BOUNTY_HUNTER_EMBLEM.toString())); - private final Client client; private final EventBus eventBus; @@ -235,10 +229,9 @@ public class MenuManager @Subscribe public void onMenuOptionClicked(MenuOptionClicked event) { - if (event.getMenuAction() != MenuAction.RUNELITE - && event.getMenuAction() != MenuAction.RUNELITE_PLAYER) + if (event.getMenuAction() != MenuAction.RUNELITE) { - return; // not a managed widget option or custom player option + return; } int widgetId = event.getWidgetId(); @@ -254,23 +247,9 @@ public class MenuManager customMenu.setMenuTarget(event.getMenuTarget()); customMenu.setWidget(curMenuOption.getWidget()); eventBus.post(customMenu); - return; // don't continue because it's not a player option + return; } } - - // removes bounty hunter emblem tag and tier from player name, e.g: - // "username5 (level-42)" -> "username (level-42)" - String target = BOUNTY_EMBLEM_TAG_AND_TIER_REGEXP.matcher(event.getMenuTarget()).replaceAll(""); - - // removes tags and level from player names for example: - // username (level-42) or username - String username = Text.removeTags(target).split("[(]")[0].trim(); - - PlayerMenuOptionClicked playerMenuOptionClicked = new PlayerMenuOptionClicked(); - playerMenuOptionClicked.setMenuOption(event.getMenuOption()); - playerMenuOptionClicked.setMenuTarget(username); - - eventBus.post(playerMenuOptionClicked); } private void addPlayerMenuItem(int playerOptionIndex, String menuText) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java index edb450d61b..caf3020149 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java @@ -38,9 +38,10 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; +import net.runelite.api.Player; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.PlayerMenuOptionClicked; +import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; @@ -174,11 +175,30 @@ public class HiscorePlugin extends Plugin } @Subscribe - public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) + public void onMenuOptionClicked(MenuOptionClicked event) { - if (event.getMenuOption().equals(LOOKUP)) + if ((event.getMenuAction() == MenuAction.RUNELITE || event.getMenuAction() == MenuAction.RUNELITE_PLAYER) + && event.getMenuOption().equals(LOOKUP)) { - lookupPlayer(Text.removeTags(event.getMenuTarget())); + final String target; + if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER) + { + // The player id is included in the event, so we can use that to get the player name, + // which avoids having to parse out the combat level and any icons preceding the name. + Player player = client.getCachedPlayers()[event.getId()]; + if (player == null) + { + return; + } + + target = player.getName(); + } + else + { + target = Text.removeTags(event.getMenuTarget()); + } + + lookupPlayer(target); } } 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 b10e2a0667..a283fe9d7f 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 @@ -47,10 +47,10 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.ChatPlayer; -import net.runelite.api.FriendsChatMember; -import net.runelite.api.FriendsChatManager; import net.runelite.api.Client; import net.runelite.api.Friend; +import net.runelite.api.FriendsChatManager; +import net.runelite.api.FriendsChatMember; import net.runelite.api.GameState; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; @@ -60,7 +60,7 @@ import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.PlayerMenuOptionClicked; +import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.WorldListLoad; import net.runelite.api.widgets.WidgetInfo; @@ -408,9 +408,9 @@ public class WorldHopperPlugin extends Plugin } @Subscribe - public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) + public void onMenuOptionClicked(MenuOptionClicked event) { - if (!event.getMenuOption().equals(HOP_TO)) + if (event.getMenuAction() != MenuAction.RUNELITE || !event.getMenuOption().equals(HOP_TO)) { return; } diff --git a/runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java b/runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java deleted file mode 100644 index 4c378d48ce..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2020, bfmoatbio - * Copyright (c) 2020, 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.menus; - -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 net.runelite.api.Client; -import net.runelite.api.MenuAction; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.PlayerMenuOptionClicked; -import net.runelite.client.eventbus.EventBus; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import static org.mockito.Mockito.verify; -import org.mockito.junit.MockitoJUnitRunner; -import static org.junit.Assert.assertEquals; - -@RunWith(MockitoJUnitRunner.class) -public class MenuManagerTest -{ - @Inject - private MenuManager menuManager; - - @Mock - @Bind - private Client client; - - @Mock - @Bind - private EventBus eventBus; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testPlayerMenuOptionClicked() - { - MenuOptionClicked event = new MenuOptionClicked(); - event.setMenuAction(MenuAction.RUNELITE_PLAYER); - event.setMenuTarget("username (level-42)"); - - menuManager.onMenuOptionClicked(event); - - ArgumentCaptor captor = ArgumentCaptor.forClass(PlayerMenuOptionClicked.class); - verify(eventBus).post(captor.capture()); - PlayerMenuOptionClicked clicked = captor.getValue(); - assertEquals("username", clicked.getMenuTarget()); - } - - @Test - public void testPlayerMenuOptionWithBountyHunterEmblemClicked() - { - MenuOptionClicked event = new MenuOptionClicked(); - event.setMenuAction(MenuAction.RUNELITE_PLAYER); - event.setMenuTarget("username5 (level-42)"); - - menuManager.onMenuOptionClicked(event); - - ArgumentCaptor captor = ArgumentCaptor.forClass(PlayerMenuOptionClicked.class); - verify(eventBus).post(captor.capture()); - PlayerMenuOptionClicked clicked = captor.getValue(); - assertEquals("username", clicked.getMenuTarget()); - } -} From d68d66b01d6c29f16f8fd50b1a1f022a7066f496 Mon Sep 17 00:00:00 2001 From: loldudester Date: Mon, 25 Jan 2021 19:49:18 -0800 Subject: [PATCH 05/17] Fix javadoc cutting off descriptions Co-authored-by: Jordan Atwood --- .../java/net/runelite/api/ChatMessageType.java | 2 +- .../src/main/java/net/runelite/api/Client.java | 14 +++++++------- .../src/main/java/net/runelite/api/HeadIcon.java | 2 +- .../src/main/java/net/runelite/api/MenuEntry.java | 4 ++-- .../main/java/net/runelite/api/MessageNode.java | 2 +- .../src/main/java/net/runelite/api/Projectile.java | 2 +- .../net/runelite/api/events/MenuEntryAdded.java | 4 ++-- .../java/net/runelite/api/events/WorldChanged.java | 2 +- .../net/runelite/client/game/AgilityShortcut.java | 2 +- .../runelite/client/menus/WidgetMenuOption.java | 4 ++-- .../plugins/discord/DiscordGameEventType.java | 2 +- .../client/plugins/itemstats/stats/Stat.java | 2 +- .../runelite/client/plugins/xptracker/XpState.java | 4 ++-- .../runelite/client/util/QuantityFormatter.java | 2 +- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ChatMessageType.java b/runelite-api/src/main/java/net/runelite/api/ChatMessageType.java index f96d7fba63..d453bfbb35 100644 --- a/runelite-api/src/main/java/net/runelite/api/ChatMessageType.java +++ b/runelite-api/src/main/java/net/runelite/api/ChatMessageType.java @@ -117,7 +117,7 @@ public enum ChatMessageType */ MODAUTOTYPER(91), /** - * A game message (ie. when a setting is changed). + * A game message. (ie. when a setting is changed) */ CONSOLE(99), /** 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 0dcad51c06..c08be0edbe 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -433,7 +433,7 @@ public interface Client extends GameEngine int getMouseCurrentButton(); /** - * Gets the currently selected tile (ie. last right clicked tile). + * Gets the currently selected tile. (ie. last right clicked tile) * * @return the selected tile */ @@ -1465,8 +1465,8 @@ public interface Client extends GameEngine void setPlayersHidden(boolean state); /** - * Sets whether 2D sprites (ie. overhead prayers, PK skull) related to - * the other players are hidden. + * Sets whether 2D sprites related to the other players are hidden. + * (ie. overhead prayers, PK skull) * * @param state the new player 2D hidden state */ @@ -1494,8 +1494,8 @@ public interface Client extends GameEngine void setLocalPlayerHidden(boolean state); /** - * Sets whether 2D sprites (ie. overhead prayers, PK skull) related to - * the local player are hidden. + * Sets whether 2D sprites related to the local player are hidden. + * (ie. overhead prayers, PK skull) * * @param state new local player 2D hidden state */ @@ -1509,8 +1509,8 @@ public interface Client extends GameEngine void setNPCsHidden(boolean state); /** - * Sets whether 2D sprites (ie. overhead prayers) related to - * the NPCs are hidden. + * Sets whether 2D sprites related to the NPCs are hidden. + * (ie. overhead prayers) * * @param state new NPC 2D hidden state */ diff --git a/runelite-api/src/main/java/net/runelite/api/HeadIcon.java b/runelite-api/src/main/java/net/runelite/api/HeadIcon.java index 6f70220ba9..ad8f00cc08 100644 --- a/runelite-api/src/main/java/net/runelite/api/HeadIcon.java +++ b/runelite-api/src/main/java/net/runelite/api/HeadIcon.java @@ -54,7 +54,7 @@ public enum HeadIcon */ REDEMPTION, /** - * Protect from range and mage (ie. used by Kalphite Queen). + * Protect from range and mage. (ie. used by Kalphite Queen) */ RANGE_MAGE } diff --git a/runelite-api/src/main/java/net/runelite/api/MenuEntry.java b/runelite-api/src/main/java/net/runelite/api/MenuEntry.java index 6d9cc751f4..e28165e603 100644 --- a/runelite-api/src/main/java/net/runelite/api/MenuEntry.java +++ b/runelite-api/src/main/java/net/runelite/api/MenuEntry.java @@ -33,11 +33,11 @@ import lombok.Data; public class MenuEntry { /** - * The option text added to the menu (ie. "Walk here", "Use"). + * The option text added to the menu. (ie. "Walk here", "Use") */ private String option; /** - * The target of the action (ie. Item or Actor name). + * The target of the action. (ie. Item or Actor name) *

* If the option does not apply to any target, this field * will be set to empty string. diff --git a/runelite-api/src/main/java/net/runelite/api/MessageNode.java b/runelite-api/src/main/java/net/runelite/api/MessageNode.java index 9b7325a3e0..e1f96bf4aa 100644 --- a/runelite-api/src/main/java/net/runelite/api/MessageNode.java +++ b/runelite-api/src/main/java/net/runelite/api/MessageNode.java @@ -58,7 +58,7 @@ public interface MessageNode extends Node void setName(String name); /** - * Gets the sender of the message (ie. friends chat name). + * Gets the sender of the message. (ie. friends chat name) * * @return the message sender */ diff --git a/runelite-api/src/main/java/net/runelite/api/Projectile.java b/runelite-api/src/main/java/net/runelite/api/Projectile.java index 323a7a43ed..2f371611d3 100644 --- a/runelite-api/src/main/java/net/runelite/api/Projectile.java +++ b/runelite-api/src/main/java/net/runelite/api/Projectile.java @@ -25,7 +25,7 @@ package net.runelite.api; /** - * Represents a projectile entity (ie. cannonball, arrow). + * Represents a projectile entity. (ie. cannonball, arrow) */ public interface Projectile extends Renderable { diff --git a/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java b/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java index e6aa08b600..0771e8189c 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java +++ b/runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java @@ -35,11 +35,11 @@ import lombok.Data; public class MenuEntryAdded { /** - * The option text added to the menu (ie. "Walk here", "Use"). + * The option text added to the menu. (ie. "Walk here", "Use") */ private final String option; /** - * The target of the action (ie. Item or Actor name). + * The target of the action. (ie. Item or Actor name) *

* If the option does not apply to any target, this field * will be set to empty string. diff --git a/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java index 57fcb00ee6..408114af1e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java @@ -27,7 +27,7 @@ package net.runelite.api.events; import net.runelite.api.Client; /** - * Posted when the game world the client wants to connect to has changed + * Posted when the game world the client wants to connect to has changed. * This is posted after the world ID and type have updated, but before a new * connection is established * 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 20b99655fb..5833b05a37 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 @@ -237,7 +237,7 @@ public enum AgilityShortcut @Getter private final int level; /** - * Brief description of the shortcut (e.g. 'Rocks', 'Stepping Stones', 'Jump') + * Brief description of the shortcut. (e.g. 'Rocks', 'Stepping Stones', 'Jump') */ @Getter private final String description; diff --git a/runelite-client/src/main/java/net/runelite/client/menus/WidgetMenuOption.java b/runelite-client/src/main/java/net/runelite/client/menus/WidgetMenuOption.java index 307551542c..d24ae1d18d 100644 --- a/runelite-client/src/main/java/net/runelite/client/menus/WidgetMenuOption.java +++ b/runelite-client/src/main/java/net/runelite/client/menus/WidgetMenuOption.java @@ -33,11 +33,11 @@ import net.runelite.client.util.ColorUtil; public final class WidgetMenuOption { /** - * The left hand text to be displayed on the menu option. Ex. the menuOption of "Drop Bones" is "Drop" + * The left hand text to be displayed on the menu option. (ex. the menuOption of "Drop Bones" is "Drop") */ private String menuOption; /** - * The right hand text to be displayed on the menu option Ex. the menuTarget of "Drop Bones" is "Bones" + * The right hand text to be displayed on the menu option. (ex. the menuTarget of "Drop Bones" is "Bones") */ private String menuTarget; /** diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java index 17b72b5d6e..7e07a12ee4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java @@ -470,7 +470,7 @@ enum DiscordGameEventType private int priority; /** - * Marks this event as root event, e.g event that should be used for total time tracking + * Marks this event as root event. (eg. event that should be used for total time tracking) */ private boolean root; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stat.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stat.java index be7b2ff4d8..2d65a7993c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stat.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stat.java @@ -52,7 +52,7 @@ public abstract class Stat public abstract int getValue(Client client); /** - * Get the base stat maximum, ie. the bottom half of the stat fraction. + * Get the base stat maximum. (ie. the bottom half of the stat fraction) */ public abstract int getMaximum(Client client); } 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 fac3c16410..1fbbdb2c49 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 @@ -159,8 +159,8 @@ class XpState } /** - * Update number of actions performed for skill (e.g amount of kills in this case) if last interacted - * NPC died + * Update number of actions performed for skill if last interacted NPC died. + * (eg. amount of kills in this case) * @param skill skill to update actions for * @param npc npc that just died * @param npcHealth max health of npc that just died diff --git a/runelite-client/src/main/java/net/runelite/client/util/QuantityFormatter.java b/runelite-client/src/main/java/net/runelite/client/util/QuantityFormatter.java index 49823b5cca..2b838e409c 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/QuantityFormatter.java +++ b/runelite-client/src/main/java/net/runelite/client/util/QuantityFormatter.java @@ -182,7 +182,7 @@ public class QuantityFormatter } /** - * Calculates, given a string with a value denominator (ex. 20K) + * Calculates, given a string with a value denominator (for example, 20K) * the multiplier that the denominator represents (in this case 1000). * * @param string The string to check. From 8aee2fb0c21f592054ba5266fd0cae7b1adcddbb Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 26 Jan 2021 16:53:31 -0700 Subject: [PATCH 06/17] Update Item IDs to 2021-1-27 --- .../main/java/net/runelite/api/ItemID.java | 57 ++++++++++++++++++- .../java/net/runelite/api/NullItemID.java | 56 ++++++++++++++++++ 2 files changed, 111 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 66ef6c0323..df6d719ce9 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -11656,8 +11656,6 @@ public final class ItemID public static final int GIANT_BOULDER = 25314; public static final int GOBLIN_DECORATIONS = 25316; public static final int GNOME_CHILD_ICON = 25319; - public static final int GNOME_CHILD = 25320; - public static final int GNOME_CHILD_25321 = 25321; public static final int _20TH_ANNIVERSARY_HAT = 25322; public static final int _20TH_ANNIVERSARY_TOP = 25324; public static final int _20TH_ANNIVERSARY_BOTTOM = 25326; @@ -11698,5 +11696,60 @@ public final class ItemID public static final int TRAILBLAZER_RELIC_HUNTER_T1_ARMOUR_SET = 25380; public static final int TRAILBLAZER_RELIC_HUNTER_T2_ARMOUR_SET = 25383; public static final int TRAILBLAZER_RELIC_HUNTER_T3_ARMOUR_SET = 25386; + public static final int SWAMPBARK_BODY = 25389; + public static final int SWAMPBARK_GAUNTLETS = 25392; + public static final int SWAMPBARK_BOOTS = 25395; + public static final int SWAMPBARK_HELM = 25398; + public static final int SWAMPBARK_LEGS = 25401; + public static final int BLOODBARK_BODY = 25404; + public static final int BLOODBARK_GAUNTLETS = 25407; + public static final int BLOODBARK_BOOTS = 25410; + public static final int BLOODBARK_HELM = 25413; + public static final int BLOODBARK_LEGS = 25416; + public static final int URIUM_REMAINS = 25419; + public static final int BLEACHED_BONES = 25422; + public static final int GOLD_KEY_RED = 25424; + public static final int GOLD_KEY_BROWN = 25426; + public static final int GOLD_KEY_CRIMSON = 25428; + public static final int GOLD_KEY_BLACK = 25430; + public static final int GOLD_KEY_PURPLE = 25432; + public static final int ZEALOTS_ROBE_TOP = 25434; + public static final int ZEALOTS_ROBE_BOTTOM = 25436; + public static final int ZEALOTS_HELM = 25438; + public static final int ZEALOTS_BOOTS = 25440; + public static final int BRONZE_LOCKS = 25442; + public static final int STEEL_LOCKS = 25445; + public static final int BLACK_LOCKS = 25448; + public static final int SILVER_LOCKS = 25451; + public static final int GOLD_LOCKS = 25454; + public static final int BROKEN_COFFIN = 25457; + public static final int BRONZE_COFFIN = 25459; + public static final int STEEL_COFFIN = 25461; + public static final int BLACK_COFFIN = 25463; + public static final int SILVER_COFFIN = 25465; + public static final int GOLD_COFFIN = 25467; + public static final int OPEN_BRONZE_COFFIN = 25469; + public static final int OPEN_STEEL_COFFIN = 25470; + public static final int OPEN_BLACK_COFFIN = 25471; + public static final int OPEN_SILVER_COFFIN = 25472; + public static final int OPEN_GOLD_COFFIN = 25473; + public static final int TREE_WIZARDS_JOURNAL = 25474; + public static final int BLOODY_NOTES = 25476; + public static final int RUNESCROLL_OF_SWAMPBARK = 25478; + public static final int RUNESCROLL_OF_BLOODBARK = 25481; + public static final int TOXIC_BLOWPIPE_BETA__BRONZE = 25484; + public static final int TOXIC_BLOWPIPE_BETA__IRON = 25485; + public static final int TOXIC_BLOWPIPE_BETA__STEEL = 25486; + public static final int TOXIC_BLOWPIPE_BETA__BLACK = 25487; + public static final int TOXIC_BLOWPIPE_BETA__MITHRIL = 25488; + public static final int TOXIC_BLOWPIPE_BETA__ADAMANT = 25489; + public static final int TOXIC_BLOWPIPE_BETA__RUNE = 25490; + public static final int TOXIC_BLOWPIPE_BETA__DRAGON = 25491; + public static final int BLACK_DHIDE_BODY_BETA = 25492; + public static final int BLACK_DHIDE_CHAPS_BETA = 25493; + public static final int BLACK_DHIDE_VAMBRACES_BETA = 25494; + public static final int CRYSTAL_HELM_BETA = 25495; + public static final int CRYSTAL_BODY_BETA = 25496; + public static final int CRYSTAL_LEGS_BETA = 25497; /* 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 c6fa2aadf0..a0bc89a2aa 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -13453,6 +13453,8 @@ public final class NullItemID public static final int NULL_25315 = 25315; public static final int NULL_25317 = 25317; public static final int NULL_25318 = 25318; + public static final int NULL_25320 = 25320; + public static final int NULL_25321 = 25321; public static final int NULL_25323 = 25323; public static final int NULL_25325 = 25325; public static final int NULL_25327 = 25327; @@ -13480,5 +13482,59 @@ public final class NullItemID public static final int NULL_25385 = 25385; public static final int NULL_25387 = 25387; public static final int NULL_25388 = 25388; + public static final int NULL_25390 = 25390; + public static final int NULL_25391 = 25391; + public static final int NULL_25393 = 25393; + public static final int NULL_25394 = 25394; + public static final int NULL_25396 = 25396; + public static final int NULL_25397 = 25397; + public static final int NULL_25399 = 25399; + public static final int NULL_25400 = 25400; + public static final int NULL_25402 = 25402; + public static final int NULL_25403 = 25403; + public static final int NULL_25405 = 25405; + public static final int NULL_25406 = 25406; + public static final int NULL_25408 = 25408; + public static final int NULL_25409 = 25409; + public static final int NULL_25411 = 25411; + public static final int NULL_25412 = 25412; + public static final int NULL_25414 = 25414; + public static final int NULL_25415 = 25415; + public static final int NULL_25417 = 25417; + public static final int NULL_25418 = 25418; + public static final int NULL_25420 = 25420; + public static final int NULL_25421 = 25421; + public static final int NULL_25423 = 25423; + public static final int NULL_25425 = 25425; + public static final int NULL_25427 = 25427; + public static final int NULL_25429 = 25429; + public static final int NULL_25431 = 25431; + public static final int NULL_25433 = 25433; + public static final int NULL_25435 = 25435; + public static final int NULL_25437 = 25437; + public static final int NULL_25439 = 25439; + public static final int NULL_25441 = 25441; + public static final int NULL_25443 = 25443; + public static final int NULL_25444 = 25444; + public static final int NULL_25446 = 25446; + public static final int NULL_25447 = 25447; + public static final int NULL_25449 = 25449; + public static final int NULL_25450 = 25450; + public static final int NULL_25452 = 25452; + public static final int NULL_25453 = 25453; + public static final int NULL_25455 = 25455; + public static final int NULL_25456 = 25456; + public static final int NULL_25458 = 25458; + public static final int NULL_25460 = 25460; + public static final int NULL_25462 = 25462; + public static final int NULL_25464 = 25464; + public static final int NULL_25466 = 25466; + public static final int NULL_25468 = 25468; + public static final int NULL_25475 = 25475; + public static final int NULL_25477 = 25477; + public static final int NULL_25479 = 25479; + public static final int NULL_25480 = 25480; + public static final int NULL_25482 = 25482; + public static final int NULL_25483 = 25483; /* This file is automatically generated. Do not edit. */ } From 805158a6449bcd42a9300959d3c97cc78e65d9e3 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 26 Jan 2021 16:53:31 -0700 Subject: [PATCH 07/17] Update Item variations to 2021-1-27 --- .../src/main/resources/item_variations.json | 53 +++++++++++++++---- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/resources/item_variations.json b/runelite-client/src/main/resources/item_variations.json index 62877d1869..9543697a90 100644 --- a/runelite-client/src/main/resources/item_variations.json +++ b/runelite-client/src/main/resources/item_variations.json @@ -2727,6 +2727,10 @@ 2464, 8936 ], + "black dhide vambraces": [ + 2491, + 25494 + ], "blue dhide chaps": [ 2493, 7382, @@ -2743,7 +2747,8 @@ 2497, 12383, 12387, - 20424 + 20424, + 25493 ], "blue dhide body": [ 2499, @@ -2761,7 +2766,8 @@ 2503, 12381, 12385, - 20423 + 20423, + 25492 ], "dragon chainbody": [ 2513, @@ -7760,7 +7766,15 @@ ], "toxic blowpipe": [ 12924, - 12926 + 12926, + 25484, + 25485, + 25486, + 25487, + 25488, + 25489, + 25490, + 25491 ], "serpentine helm": [ 12929, @@ -9240,21 +9254,24 @@ 23887, 23888, 23971, - 23973 + 23973, + 25495 ], "crystal body": [ 23889, 23890, 23891, 23975, - 23977 + 23977, + 25496 ], "crystal legs": [ 23892, 23893, 23894, 23979, - 23981 + 23981, + 25497 ], "crystal staff": [ 23898, @@ -9623,10 +9640,6 @@ 25319, 25338 ], - "gnome child": [ - 25320, - 25321 - ], "soul cape": [ 25344, 25346 @@ -9635,5 +9648,25 @@ 25380, 25383, 25386 + ], + "bronze coffin": [ + 25459, + 25469 + ], + "steel coffin": [ + 25461, + 25470 + ], + "black coffin": [ + 25463, + 25471 + ], + "silver coffin": [ + 25465, + 25472 + ], + "gold coffin": [ + 25467, + 25473 ] } \ No newline at end of file From 93a4a4c37998312970afaf022e8dec2f5487f4af Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 26 Jan 2021 16:53:31 -0700 Subject: [PATCH 08/17] Update Object IDs to 2021-1-27 --- .../java/net/runelite/api/NullObjectID.java | 91 +++---------------- .../main/java/net/runelite/api/ObjectID.java | 35 ++++--- 2 files changed, 27 insertions(+), 99 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 950d22e579..91bb2fdc18 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -879,7 +879,6 @@ public final class NullObjectID public static final int NULL_1793 = 1793; public static final int NULL_1794 = 1794; public static final int NULL_1795 = 1795; - public static final int NULL_1796 = 1796; public static final int NULL_1798 = 1798; public static final int NULL_1799 = 1799; public static final int NULL_1800 = 1800; @@ -890,7 +889,6 @@ public final class NullObjectID public static final int NULL_1807 = 1807; public static final int NULL_1808 = 1808; public static final int NULL_1809 = 1809; - public static final int NULL_1812 = 1812; public static final int NULL_1815 = 1815; public static final int NULL_1818 = 1818; public static final int NULL_1819 = 1819; @@ -19747,6 +19745,7 @@ public final class NullObjectID public static final int NULL_40427 = 40427; public static final int NULL_40428 = 40428; public static final int NULL_40429 = 40429; + public static final int NULL_40470 = 40470; public static final int NULL_40477 = 40477; public static final int NULL_40478 = 40478; public static final int NULL_40479 = 40479; @@ -20009,84 +20008,6 @@ public final class NullObjectID public static final int NULL_40934 = 40934; public static final int NULL_40935 = 40935; public static final int NULL_40936 = 40936; - public static final int NULL_40942 = 40942; - public static final int NULL_40943 = 40943; - public static final int NULL_40944 = 40944; - public static final int NULL_40945 = 40945; - public static final int NULL_40946 = 40946; - public static final int NULL_40947 = 40947; - public static final int NULL_40948 = 40948; - public static final int NULL_40949 = 40949; - public static final int NULL_40950 = 40950; - public static final int NULL_40951 = 40951; - public static final int NULL_40952 = 40952; - public static final int NULL_40953 = 40953; - public static final int NULL_40954 = 40954; - public static final int NULL_40955 = 40955; - public static final int NULL_40956 = 40956; - public static final int NULL_40957 = 40957; - public static final int NULL_40958 = 40958; - public static final int NULL_40959 = 40959; - public static final int NULL_40960 = 40960; - public static final int NULL_40961 = 40961; - public static final int NULL_40962 = 40962; - public static final int NULL_40963 = 40963; - public static final int NULL_40964 = 40964; - public static final int NULL_40965 = 40965; - public static final int NULL_40966 = 40966; - public static final int NULL_40967 = 40967; - public static final int NULL_40968 = 40968; - public static final int NULL_40969 = 40969; - public static final int NULL_40970 = 40970; - public static final int NULL_40971 = 40971; - public static final int NULL_40972 = 40972; - public static final int NULL_40973 = 40973; - public static final int NULL_40974 = 40974; - public static final int NULL_40975 = 40975; - public static final int NULL_40976 = 40976; - public static final int NULL_40977 = 40977; - public static final int NULL_40978 = 40978; - public static final int NULL_40979 = 40979; - public static final int NULL_40980 = 40980; - public static final int NULL_40981 = 40981; - public static final int NULL_40982 = 40982; - public static final int NULL_40983 = 40983; - public static final int NULL_40984 = 40984; - public static final int NULL_40985 = 40985; - public static final int NULL_40987 = 40987; - public static final int NULL_40988 = 40988; - public static final int NULL_40989 = 40989; - public static final int NULL_40990 = 40990; - public static final int NULL_40991 = 40991; - public static final int NULL_40992 = 40992; - public static final int NULL_40993 = 40993; - public static final int NULL_40994 = 40994; - public static final int NULL_40995 = 40995; - public static final int NULL_40996 = 40996; - public static final int NULL_40997 = 40997; - public static final int NULL_40998 = 40998; - public static final int NULL_40999 = 40999; - public static final int NULL_41000 = 41000; - public static final int NULL_41001 = 41001; - public static final int NULL_41002 = 41002; - public static final int NULL_41003 = 41003; - public static final int NULL_41004 = 41004; - public static final int NULL_41005 = 41005; - public static final int NULL_41006 = 41006; - public static final int NULL_41007 = 41007; - public static final int NULL_41008 = 41008; - public static final int NULL_41009 = 41009; - public static final int NULL_41010 = 41010; - public static final int NULL_41011 = 41011; - public static final int NULL_41012 = 41012; - public static final int NULL_41013 = 41013; - public static final int NULL_41014 = 41014; - public static final int NULL_41015 = 41015; - public static final int NULL_41016 = 41016; - public static final int NULL_41018 = 41018; - public static final int NULL_41019 = 41019; - public static final int NULL_41020 = 41020; - public static final int NULL_41021 = 41021; public static final int NULL_41022 = 41022; public static final int NULL_41191 = 41191; public static final int NULL_41192 = 41192; @@ -20096,5 +20017,15 @@ public final class NullObjectID public static final int NULL_41196 = 41196; public static final int NULL_41197 = 41197; public static final int NULL_41198 = 41198; + public static final int NULL_41201 = 41201; + public static final int NULL_41202 = 41202; + public static final int NULL_41203 = 41203; + public static final int NULL_41204 = 41204; + public static final int NULL_41205 = 41205; + public static final int NULL_41206 = 41206; + public static final int NULL_41207 = 41207; + public static final int NULL_41208 = 41208; + public static final int NULL_41209 = 41209; + public static final int NULL_41211 = 41211; /* 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 153313b119..8bf9ca4de0 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -18582,7 +18582,7 @@ public final class ObjectID public static final int RUBBLE_34803 = 34803; public static final int RUBBLE_34804 = 34804; public static final int RUBBLE_34805 = 34805; - public static final int JADFEST_PORTAL = 34826; + public static final int HANDY_PORTAL = 34826; public static final int LARRANS_SMALL_CHEST_34828 = 34828; public static final int LARRANS_BIG_CHEST = 34829; public static final int LARRANS_BIG_CHEST_34830 = 34830; @@ -19619,7 +19619,7 @@ public final class ObjectID public static final int GATE_37954 = 37954; public static final int LADDER_37955 = 37955; public static final int LADDER_37956 = 37956; - public static final int HANDY_PORTAL = 37957; + public static final int HANDY_PORTAL_37957 = 37957; public static final int BANK_BOOTH_37959 = 37959; public static final int DOOR_37961 = 37961; public static final int DOOR_37963 = 37963; @@ -20709,6 +20709,8 @@ public final class ObjectID public static final int EXPLOSIVE_POTION_TABLE_40467 = 40467; public static final int POTION_OF_POWER_TABLE_40468 = 40468; public static final int POTION_OF_POWER_TABLE_40469 = 40469; + public static final int GRAVESTONE_40471 = 40471; + public static final int COFFIN_40472 = 40472; public static final int BANK_CHEST_40473 = 40473; public static final int SOUL_WARS_PORTAL = 40474; public static final int SOUL_WARS_PORTAL_40475 = 40475; @@ -20899,25 +20901,8 @@ public final class ObjectID public static final int STATUE_40915 = 40915; public static final int STATUE_40916 = 40916; public static final int STATUE_40917 = 40917; - public static final int INERT_PORTAL = 40918; - public static final int PORTAL_40919 = 40919; - public static final int ODD_FEATHERS = 40920; - public static final int PORTAL_40921 = 40921; - public static final int BARRIER_40922 = 40922; - public static final int SLEEPING_BAG_40923 = 40923; - public static final int STATUE_40924 = 40924; - public static final int ARCHWAY_40929 = 40929; - public static final int LIGHT_40930 = 40930; - public static final int LIGHT_40931 = 40931; public static final int EVERGREEN_40932 = 40932; public static final int EVERGREEN_40933 = 40933; - public static final int LIGHT_40937 = 40937; - public static final int LIGHT_40938 = 40938; - public static final int LIGHT_40939 = 40939; - public static final int LIGHT_40940 = 40940; - public static final int FIREWORKS = 40941; - public static final int POST_40986 = 40986; - public static final int PARTY_TABLE = 41017; public static final int POTION_OF_POWER_TABLE_41023 = 41023; public static final int PEDESTAL_SPACE = 41024; public static final int PEDESTAL_SPACE_41025 = 41025; @@ -21088,5 +21073,17 @@ public final class ObjectID public static final int ANCIENT_BRAZIER_41190 = 41190; public static final int BARRIER_41199 = 41199; public static final int BARRIER_41200 = 41200; + public static final int SOLID_GOLD_DOOR = 41210; + public static final int GOLD_CHEST = 41212; + public static final int GOLD_CHEST_41213 = 41213; + public static final int GOLD_CHEST_41214 = 41214; + public static final int GOLD_CHEST_41215 = 41215; + public static final int GOLD_CHEST_41216 = 41216; + public static final int GOLD_CHEST_41217 = 41217; + public static final int GOLD_CHEST_41218 = 41218; + public static final int GOLD_CHEST_41219 = 41219; + public static final int GOLD_CHEST_41220 = 41220; + public static final int GOLD_CHEST_41221 = 41221; + public static final int ALTAR_41222 = 41222; /* This file is automatically generated. Do not edit. */ } From 3c9674f63ee493465554a43622e4d5717c4f49d2 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 26 Jan 2021 16:53:31 -0700 Subject: [PATCH 09/17] Update NPC IDs to 2021-1-27 --- .../src/main/java/net/runelite/api/NpcID.java | 33 ++++--------------- .../main/java/net/runelite/api/NullNpcID.java | 1 - 2 files changed, 6 insertions(+), 28 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 15460768d9..f6bef67796 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -2657,6 +2657,7 @@ public final class NpcID public static final int DRYAD = 2828; public static final int FAIRY_2829 = 2829; public static final int MYSTERIOUS_OLD_MAN = 2830; + public static final int CHAIR = 2832; public static final int LIL_CREATOR = 2833; public static final int GIANT_BAT = 2834; public static final int CAMEL = 2835; @@ -5716,6 +5717,7 @@ public final class NpcID public static final int THE_INADEQUACY_HARD = 6119; public static final int THE_EVERLASTING_HARD = 6120; public static final int THE_UNTOUCHABLE_HARD = 6121; + public static final int URIUM_SHADOW = 6143; public static final int SCION_6177 = 6177; public static final int JUNGLE_SPIDER_6267 = 6267; public static final int JUNGLE_SPIDER_6271 = 6271; @@ -8920,37 +8922,14 @@ public final class NpcID public static final int DUCK_10546 = 10546; public static final int DUCK_10547 = 10547; public static final int CHICKEN_10556 = 10556; - public static final int GNOME_CHILD_10557 = 10557; - public static final int GNOME_CHILD_10558 = 10558; public static final int SCRUBFOOT = 10559; - public static final int GNOME_CHILD_10560 = 10560; public static final int RED_FIREFLIES = 10561; - public static final int GNOME_CHILD_10562 = 10562; - public static final int THRANDER = 10563; public static final int GREEN_FIREFLIES = 10564; - public static final int CHUCK_10565 = 10565; public static final int GOBLIN_10566 = 10566; public static final int GOBLIN_10567 = 10567; - public static final int PIOUS_PETE = 10568; - public static final int MYSTERIOUS_WATCHER = 10569; - public static final int MYSTERIOUS_WATCHER_10570 = 10570; - public static final int MYSTERIOUS_WATCHER_10571 = 10571; - public static final int BIG_MO = 10572; - public static final int CHEERLEADER_10573 = 10573; - public static final int CHEERLEADER_10574 = 10574; - public static final int CHEERLEADER_10575 = 10575; - public static final int BLACK_DRAGON_10576 = 10576; - public static final int RED_DRAGON_10577 = 10577; - public static final int BLUE_DRAGON_10578 = 10578; - public static final int KING_BLACK_DRAGON_10579 = 10579; - public static final int BABY_BLUE_DRAGON_10580 = 10580; - public static final int LESSER_DEMON_10581 = 10581; - public static final int GREATER_DEMON_10582 = 10582; - public static final int BLACK_DEMON_10583 = 10583; - public static final int SCORPION_10584 = 10584; - public static final int KING_SCORPION_10585 = 10585; - public static final int ORC = 10586; - public static final int LIZARD_MAN = 10587; - public static final int TROLL_10588 = 10588; + public static final int URIUM_SHADE = 10589; + public static final int DAMPE = 10590; + public static final int UNDEAD_ZEALOT = 10591; + public static final int UNDEAD_ZEALOT_10592 = 10592; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullNpcID.java b/runelite-api/src/main/java/net/runelite/api/NullNpcID.java index 622f0fc904..c0acd7f40c 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullNpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullNpcID.java @@ -174,7 +174,6 @@ public final class NullNpcID public static final int NULL_2780 = 2780; public static final int NULL_2781 = 2781; public static final int NULL_2831 = 2831; - public static final int NULL_2832 = 2832; public static final int NULL_2934 = 2934; public static final int NULL_2935 = 2935; public static final int NULL_2936 = 2936; From 2be9fe9df3357b3d27863b0efeb7224d564b1c93 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Jan 2021 13:03:09 -0500 Subject: [PATCH 10/17] slayer plugin: update task completion message parsing --- .../client/plugins/slayer/SlayerPlugin.java | 47 +++++++---------- .../plugins/slayer/SlayerPluginTest.java | 51 ++++++++++++++++--- 2 files changed, 64 insertions(+), 34 deletions(-) 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 72ad3524ee..db9b247fe3 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 @@ -99,7 +99,7 @@ public class SlayerPlugin extends Plugin //Chat messages private static final Pattern CHAT_GEM_PROGRESS_MESSAGE = Pattern.compile("^(?:You're assigned to kill|You have received a new Slayer assignment from .*:) (?:[Tt]he )?(?.+?)(?: (?:in|on|south of) (?:the )?(?[^;]+))?(?:; only | \\()(?\\d+)(?: more to go\\.|\\))$"); private static final String CHAT_GEM_COMPLETE_MESSAGE = "You need something new to hunt."; - private static final Pattern CHAT_COMPLETE_MESSAGE = Pattern.compile("(?:\\d+,)*\\d+"); + private static final Pattern CHAT_COMPLETE_MESSAGE = Pattern.compile("You've completed (?:at least )?(?[\\d,]+) (?:Wilderness )?tasks?(?: and received \\d+ points, giving you a total of (?[\\d,]+)| and reached the maximum amount of Slayer points \\((?[\\d,]+)\\))?"); private static final String CHAT_CANCEL_MESSAGE = "Your task has been cancelled."; private static final String CHAT_CANCEL_MESSAGE_JAD = "You no longer have a slayer task as you left the fight cave."; private static final String CHAT_CANCEL_MESSAGE_ZUK = "You no longer have a slayer task as you left the Inferno."; @@ -450,6 +450,7 @@ public class SlayerPlugin extends Plugin expeditiousChargeCount = Integer.parseInt(mExpeditious.group(1)); config.expeditious(expeditiousChargeCount); } + if (chatMsg.startsWith(CHAT_BRACELET_SLAUGHTER_CHARGE)) { Matcher mSlaughter = CHAT_BRACELET_SLAUGHTER_CHARGE_REGEX.matcher(chatMsg); @@ -466,35 +467,25 @@ public class SlayerPlugin extends Plugin { Matcher mComplete = CHAT_COMPLETE_MESSAGE.matcher(chatMsg); - List matches = new ArrayList<>(); - while (mComplete.find()) + if (mComplete.find()) { - matches.add(mComplete.group(0).replaceAll(",", "")); - } + String mTasks = mComplete.group("tasks"); + String mPoints = mComplete.group("points"); + if (mPoints == null) + { + mPoints = mComplete.group("points2"); + } - int streak = -1, points = -1; - switch (matches.size()) - { - case 0: - streak = 1; - break; - case 1: - streak = Integer.parseInt(matches.get(0)); - break; - case 3: - streak = Integer.parseInt(matches.get(0)); - points = Integer.parseInt(matches.get(2)); - break; - default: - log.warn("Unreachable default case for message ending in '; return to Slayer master'"); - } - if (streak != -1) - { - config.streak(streak); - } - if (points != -1) - { - config.points(points); + if (mTasks != null) + { + int streak = Integer.parseInt(mTasks.replace(",", "")); + config.streak(streak); + } + if (mPoints != null) + { + int points = Integer.parseInt(mPoints.replace(",", "")); + config.points(points); + } } setTask("", 0, 0); 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 d2b4b13f5a..967802b2cf 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 @@ -101,11 +101,14 @@ public class SlayerPluginTest private static final String REWARD_POINTS = "Reward points: 17,566"; - private static final String TASK_ONE = "You've completed one task; return to a Slayer master."; - private static final String TASK_COMPLETE_NO_POINTS = "You've completed 3 tasks; return to a Slayer master."; - private static final String TASK_POINTS = "You've completed 9 tasks and received 0 points, giving you a total of 18,000; return to a Slayer master."; - private static final String TASK_LARGE_STREAK = "You've completed 2,465 tasks and received 15 points, giving you a total of 17,566,000; return to a Slayer master."; - private static final String TASK_COMPETE_TURAEL = "You've completed 104 tasks. You'll be eligible to earn reward points if you complete tasks from a more advanced Slayer Master."; + private static final String TASK_ONE = "You've completed 1 task and will need 4 more before you start receiving Slayer points; return to a Slayer master."; + private static final String TASK_COMPLETE_NO_POINTS = "You've completed 3 tasks and will need 2 more before you start receiving Slayer points; return to a Slayer master."; + private static final String TASK_POINTS = "You've completed 9 tasks and received 10 points, giving you a total of 18,000; return to a Slayer master."; + private static final String TASK_LARGE_STREAK = "You've completed 2,465 tasks and received 15 points, giving you a total of 131,071; return to a Slayer master."; + private static final String TASK_COMPETE_TURAEL = "You've completed 104 tasks . You'll be eligible to earn reward points if you complete tasks from a more advanced Slayer Master."; + private static final String TASK_MAX_STREAK = "You've completed at least 16,000 tasks and received 15 points, giving you a total of 131,071; return to a Slayer master."; + private static final String TASK_MAX_POINTS = "You've completed 9 tasks and reached the maximum amount of Slayer points (131,071); return to a Slayer master."; + private static final String TASK_WILDERNESS = "You've completed 9 Wilderness tasks and received 10 points, giving you a total of 18,000; return to a Slayer master."; private static final String TASK_COMPLETE = "You need something new to hunt."; private static final String TASK_CANCELED = "Your task has been cancelled."; @@ -483,7 +486,7 @@ public class SlayerPluginTest verify(slayerConfig).streak(2465); assertEquals("", slayerPlugin.getTaskName()); assertEquals(0, slayerPlugin.getAmount()); - verify(slayerConfig).points(17_566_000); + verify(slayerConfig).points(131_071); } @Test @@ -497,6 +500,42 @@ public class SlayerPluginTest assertEquals(0, slayerPlugin.getAmount()); } + @Test + public void testTaskMaxStreak() + { + ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_MAX_STREAK, null, 0); + slayerPlugin.onChatMessage(chatMessageEvent); + + verify(slayerConfig).streak(16_000); + verify(slayerConfig).points(131_071); + assertEquals("", slayerPlugin.getTaskName()); + assertEquals(0, slayerPlugin.getAmount()); + } + + @Test + public void testTaskMaxPoints() + { + ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_MAX_POINTS, null, 0); + slayerPlugin.onChatMessage(chatMessageEvent); + + verify(slayerConfig).streak(9); + verify(slayerConfig).points(131_071); + assertEquals("", slayerPlugin.getTaskName()); + assertEquals(0, slayerPlugin.getAmount()); + } + + @Test + public void testTaskWilderness() + { + ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_WILDERNESS, null, 0); + slayerPlugin.onChatMessage(chatMessageEvent); + + verify(slayerConfig).streak(9); + verify(slayerConfig).points(18_000); + assertEquals("", slayerPlugin.getTaskName()); + assertEquals(0, slayerPlugin.getAmount()); + } + @Test public void testComplete() { From 5eab226b3795307c1d0e08a55d68c5a4c9992852 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 27 Jan 2021 11:49:30 +0000 Subject: [PATCH 11/17] Release 1.6.38 --- 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 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 64e289637a..57ec51fdaf 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 84680ae2ef..6e7643a80c 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 2493a298c3..ea4003b324 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 44a54972f9..433473fae3 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 0a5a66948a..2542170650 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 Web Service diff --git a/pom.xml b/pom.xml index 39f5f6f422..da133f32ca 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.6.38 diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 5a035ea6c7..fb5a88b052 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 682c6625f8..6ec2a05b30 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index ff8e50ba3c..6d4306d736 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38-SNAPSHOT + 1.6.38 script-assembler-plugin From 585bdc65d4b1960bcee2fbeded6b2656907a7ea0 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 27 Jan 2021 11:49:39 +0000 Subject: [PATCH 12/17] Bump for 1.6.39-SNAPSHOT --- 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 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 57ec51fdaf..eaa5cc4bc1 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 6e7643a80c..e8ed1260ad 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index ea4003b324..88f64d466f 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 433473fae3..8ebea1f210 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 2542170650..44f7340e3f 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index da133f32ca..e9c9fb5744 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.6.38 + HEAD diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index fb5a88b052..9fff909084 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 6ec2a05b30..518749315a 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 6d4306d736..47677f9a03 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.38 + 1.6.39-SNAPSHOT script-assembler-plugin From 42e745881f81e369e4316b7e723fad1057386951 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Wed, 27 Jan 2021 10:20:01 -0500 Subject: [PATCH 13/17] itemstats: Update Soul Wars Bandages healing --- .../net/runelite/client/plugins/itemstats/ItemStatChanges.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1a6d4677e7..ac7be8d848 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 @@ -215,7 +215,7 @@ public class ItemStatChanges add(new GauntletPotion(), EGNIOL_POTION_1, EGNIOL_POTION_2, EGNIOL_POTION_3, EGNIOL_POTION_4); // Soul Wars - add(combo(2, heal(HITPOINTS, perc(.20, 2)), heal(RUN_ENERGY, 100)), BANDAGES_25202); + add(combo(2, heal(HITPOINTS, perc(.15, 1)), heal(RUN_ENERGY, 100)), BANDAGES_25202); add(combo(6, 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(PRAYER, perc(.25, 8))), POTION_OF_POWER1, POTION_OF_POWER2, POTION_OF_POWER3, POTION_OF_POWER4); log.debug("{} items; {} behaviours loaded", effects.size(), new HashSet<>(effects.values()).size()); From 267dbb3231d25515702728dc838050f6fc24b659 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Wed, 27 Jan 2021 20:25:44 -0500 Subject: [PATCH 14/17] npc indicators: remove tags from minimap npc name --- .../client/plugins/npchighlight/NpcMinimapOverlay.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcMinimapOverlay.java index 9582288ea1..e1fd961216 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcMinimapOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcMinimapOverlay.java @@ -36,6 +36,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 NpcMinimapOverlay extends Overlay { @@ -56,7 +57,7 @@ public class NpcMinimapOverlay extends Overlay { for (NPC npc : plugin.getHighlightedNpcs()) { - renderNpcOverlay(graphics, npc, npc.getName(), config.getHighlightColor()); + renderNpcOverlay(graphics, npc, Text.removeTags(npc.getName()), config.getHighlightColor()); } return null; From f5df6a02981ce00a1525e4e19183727a2d9f222f Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 27 Jan 2021 18:42:34 -0500 Subject: [PATCH 15/17] menu manager: preserve managed menu option ordering Also add a check that the menu being added is of type CC_OP so that we know getWidgetId() is valid --- .../main/java/net/runelite/client/menus/MenuManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java index a597038628..179b757001 100644 --- a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java +++ b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java @@ -26,7 +26,7 @@ package net.runelite.client.menus; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; -import com.google.common.collect.HashMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; import java.util.Arrays; import java.util.Collection; @@ -66,7 +66,7 @@ public class MenuManager //Maps the indexes that are being used to the menu option. private final Map playerMenuIndexMap = new HashMap<>(); //Used to manage custom non-player menu options - private final Multimap managedMenuOptions = HashMultimap.create(); + private final Multimap managedMenuOptions = LinkedHashMultimap.create(); private final Set npcMenuOptions = new HashSet<>(); @Inject @@ -117,7 +117,7 @@ public class MenuManager @Subscribe public void onMenuEntryAdded(MenuEntryAdded event) { - if (client.getSpellSelected()) + if (client.getSpellSelected() || event.getType() != MenuAction.CC_OP.getId()) { return; } From 84661dfe5202c2f91f83385ea474b7a5955857ec Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 27 Jan 2021 18:43:49 -0500 Subject: [PATCH 16/17] api: remove npc action changed event Despite menu manager using this, the methods to register npc menu options was removed awhile ago, and so it is unused --- .../runelite/api/events/NpcActionChanged.java | 44 ------------------- .../runelite/client/menus/MenuManager.java | 37 ---------------- 2 files changed, 81 deletions(-) delete mode 100644 runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java deleted file mode 100644 index 7539821167..0000000000 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.api.events; - -import lombok.Data; -import net.runelite.api.NPCComposition; - -/** - * An event where an action of an {@link NPCComposition} has changed. - */ -@Data -public class NpcActionChanged -{ - /** - * The NPC composition that has been changed. - */ - private NPCComposition npcComposition; - /** - * The raw index of the modified action. - */ - private int idx; -} diff --git a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java index 179b757001..c2231233db 100644 --- a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java +++ b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java @@ -31,19 +31,15 @@ import com.google.common.collect.Multimap; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Set; import javax.inject.Inject; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; -import net.runelite.api.NPCComposition; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcActionChanged; import net.runelite.api.events.PlayerMenuOptionsChanged; import net.runelite.api.events.WidgetMenuOptionClicked; import net.runelite.api.widgets.WidgetInfo; @@ -67,7 +63,6 @@ public class MenuManager private final Map playerMenuIndexMap = new HashMap<>(); //Used to manage custom non-player menu options private final Multimap managedMenuOptions = LinkedHashMultimap.create(); - private final Set npcMenuOptions = new HashSet<>(); @Inject @VisibleForTesting @@ -194,38 +189,6 @@ public class MenuManager addPlayerMenuItem(newIdx, menuText); } - @Subscribe - public void onNpcActionChanged(NpcActionChanged event) - { - NPCComposition composition = event.getNpcComposition(); - for (String npcOption : npcMenuOptions) - { - addNpcOption(composition, npcOption); - } - } - - private void addNpcOption(NPCComposition composition, String npcOption) - { - String[] actions = composition.getActions(); - int unused = -1; - for (int i = 0; i < actions.length; ++i) - { - if (actions[i] == null && unused == -1) - { - unused = i; - } - else if (actions[i] != null && actions[i].equals(npcOption)) - { - return; - } - } - if (unused == -1) - { - return; - } - actions[unused] = npcOption; - } - @Subscribe public void onMenuOptionClicked(MenuOptionClicked event) { From e3b0755385c3594d6d76d0130c4bc9c2e1aebdcf Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 28 Jan 2021 23:28:14 -0500 Subject: [PATCH 17/17] world hopper: move hop() to client thread --- .../plugins/worldhopper/WorldHopperPlugin.java | 12 +++++++++--- .../plugins/worldhopper/WorldSwitcherPanel.java | 5 +---- 2 files changed, 10 insertions(+), 7 deletions(-) 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 a283fe9d7f..f0d4f88185 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 @@ -64,6 +64,7 @@ import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.WorldListLoad; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.callback.ClientThread; import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatMessageBuilder; import net.runelite.client.chat.ChatMessageManager; @@ -111,6 +112,9 @@ public class WorldHopperPlugin extends Plugin @Inject private Client client; + @Inject + private ClientThread clientThread; + @Inject private ConfigManager configManager; @@ -162,7 +166,7 @@ public class WorldHopperPlugin extends Plugin @Override public void hotkeyPressed() { - hop(true); + clientThread.invoke(() -> hop(true)); } }; private final HotkeyListener nextKeyListener = new HotkeyListener(() -> config.nextKey()) @@ -170,7 +174,7 @@ public class WorldHopperPlugin extends Plugin @Override public void hotkeyPressed() { - hop(false); + clientThread.invoke(() -> hop(false)); } }; @@ -304,7 +308,7 @@ public class WorldHopperPlugin extends Plugin void hopTo(World world) { - hop(world.getId()); + clientThread.invoke(() -> hop(world.getId())); } void addToFavorites(World world) @@ -613,6 +617,8 @@ public class WorldHopperPlugin extends Plugin private void hop(int worldId) { + assert client.isClientThread(); + WorldResult worldResult = worldService.getWorlds(); // Don't try to hop if the world doesn't exist World world = worldResult.findWorld(worldId); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldSwitcherPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldSwitcherPanel.java index 486d88f373..2f0d428712 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldSwitcherPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldSwitcherPanel.java @@ -370,10 +370,7 @@ class WorldSwitcherPanel extends PluginPanel private WorldTableRow buildRow(World world, boolean stripe, boolean current, boolean favorite) { WorldTableRow row = new WorldTableRow(world, current, favorite, plugin.getStoredPing(world), - world1 -> - { - plugin.hopTo(world1); - }, + plugin::hopTo, (world12, add) -> { if (add)