From 2ac1c2e387dd17b9ffed7960c80d076ba7539744 Mon Sep 17 00:00:00 2001 From: Lotto Date: Wed, 16 Oct 2019 19:01:45 +0200 Subject: [PATCH 01/27] fishing: make overlay colors configurable --- .../client/plugins/fishing/FishingConfig.java | 44 ++++++++++++++++--- .../fishing/FishingSpotMinimapOverlay.java | 4 +- .../plugins/fishing/FishingSpotOverlay.java | 10 ++--- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java index 01d7454e4a..5ccee0e752 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.fishing; +import java.awt.Color; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @@ -76,7 +77,40 @@ public interface FishingConfig extends Config } @ConfigItem( - position = 4, + keyName = "overlayColor", + name = "Overlay Color", + description = "Color of overlays", + position = 4 + ) + default Color getOverlayColor() + { + return Color.CYAN; + } + + @ConfigItem( + keyName = "minnowsOverlayColor", + name = "Minnows Overlay Color", + description = "Color of overlays for Minnows", + position = 5 + ) + default Color getMinnowsOverlayColor() + { + return Color.RED; + } + + @ConfigItem( + keyName = "aerialOverlayColor", + name = "Aerial Overlay Color", + description = "Color of overlays when 1-tick aerial fishing", + position = 6 + ) + default Color getAerialOverlayColor() + { + return Color.GREEN; + } + + @ConfigItem( + position = 7, keyName = "statTimeout", name = "Reset stats (minutes)", description = "The time until fishing session data is reset in minutes." @@ -87,7 +121,7 @@ public interface FishingConfig extends Config } @ConfigItem( - position = 5, + position = 8, keyName = "showFishingStats", name = "Show Fishing session stats", description = "Display the fishing session stats." @@ -98,7 +132,7 @@ public interface FishingConfig extends Config } @ConfigItem( - position = 6, + position = 9, keyName = "showMinnowOverlay", name = "Show Minnow Movement overlay", description = "Display the minnow progress pie overlay." @@ -109,7 +143,7 @@ public interface FishingConfig extends Config } @ConfigItem( - position = 7, + position = 10, keyName = "trawlerNotification", name = "Trawler activity notification", description = "Send a notification when fishing trawler activity drops below 15%." @@ -120,7 +154,7 @@ public interface FishingConfig extends Config } @ConfigItem( - position = 8, + position = 11, keyName = "trawlerTimer", name = "Trawler timer in MM:SS", description = "Trawler Timer will display a more accurate timer in MM:SS format." diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotMinimapOverlay.java index 09a6b612fc..aa9e72cdf6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotMinimapOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotMinimapOverlay.java @@ -76,7 +76,9 @@ class FishingSpotMinimapOverlay extends Overlay continue; } - Color color = npc.getGraphic() == GraphicID.FLYING_FISH ? Color.RED : Color.CYAN; + Color color = npc.getGraphic() == GraphicID.FLYING_FISH + ? config.getMinnowsOverlayColor() + : config.getOverlayColor(); net.runelite.api.Point minimapLocation = npc.getMinimapLocation(); if (minimapLocation != null) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java index 257955c878..c7200b9201 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java @@ -107,15 +107,15 @@ class FishingSpotOverlay extends Overlay Color color; if (npc.getGraphic() == GraphicID.FLYING_FISH) { - color = Color.RED; + color = config.getMinnowsOverlayColor(); } else if (spot == FishingSpot.COMMON_TENCH && npc.getWorldLocation().distanceTo2D(client.getLocalPlayer().getWorldLocation()) <= ONE_TICK_AERIAL_FISHING) { - color = Color.GREEN; + color = config.getAerialOverlayColor(); } else { - color = Color.CYAN; + color = config.getOverlayColor(); } if (spot == FishingSpot.MINNOW && config.showMinnowOverlay()) @@ -156,12 +156,12 @@ class FishingSpotOverlay extends Overlay if (config.showSpotIcons()) { - BufferedImage fishImage = itemManager.getImage(spot.getFishSpriteId());; + BufferedImage fishImage = itemManager.getImage(spot.getFishSpriteId()); if (spot == FishingSpot.COMMON_TENCH && npc.getWorldLocation().distanceTo2D(client.getLocalPlayer().getWorldLocation()) <= ONE_TICK_AERIAL_FISHING) { - fishImage = ImageUtil.outlineImage(itemManager.getImage(spot.getFishSpriteId()), Color.GREEN); + fishImage = ImageUtil.outlineImage(itemManager.getImage(spot.getFishSpriteId()), color); } if (fishImage != null) From f31e366da66e3333904bdf1a407bdcf9791a3ac1 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 17 Oct 2019 18:50:25 -0400 Subject: [PATCH 02/27] random events: fix menu being hidden for own events This changes the plugin to work by just using interact change events, which will happen regardless of the spawn events and whether or not it is interacting at the time of spawn. This fixes two bugs in the existing implementation: 1) not updating lastEventTick on interact change, causing currentRandomEvent to get timed out near immediately 2) not sending notifications for npcs which spawn while interacting --- .../randomevents/RandomEventPlugin.java | 74 +++++++------------ 1 file changed, 25 insertions(+), 49 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java index 9c9c75b778..bc9cb52977 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java @@ -28,20 +28,18 @@ package net.runelite.client.plugins.randomevents; import com.google.common.collect.ImmutableSet; import com.google.inject.Provides; import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; import java.util.Set; import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.MenuAction; import net.runelite.api.NPC; import net.runelite.api.NpcID; import net.runelite.api.Player; -import net.runelite.api.events.GameTick; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.NpcSpawned; +import net.runelite.api.events.NpcDespawned; import net.runelite.client.Notifier; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; @@ -53,6 +51,7 @@ import net.runelite.client.plugins.PluginDescriptor; description = "Notify when random events appear and remove talk/dismiss options on events that aren't yours.", enabledByDefault = false ) +@Slf4j public class RandomEventPlugin extends Plugin { private static final Set EVENT_NPCS = ImmutableSet.of( @@ -85,10 +84,8 @@ public class RandomEventPlugin extends Plugin ); private static final int RANDOM_EVENT_TIMEOUT = 150; - private Map spawnedNpcs = new HashMap<>(); private NPC currentRandomEvent; - // event npcs teleport to you to stay in range, we need to throttle spawns - private int lastEventTick = -RANDOM_EVENT_TIMEOUT; + private int lastNotificationTick = -RANDOM_EVENT_TIMEOUT; // to avoid double notifications @Inject private Client client; @@ -108,34 +105,8 @@ public class RandomEventPlugin extends Plugin @Override protected void shutDown() throws Exception { - lastEventTick = 0; + lastNotificationTick = 0; currentRandomEvent = null; - spawnedNpcs.clear(); - } - - @Subscribe - public void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - - if (!EVENT_NPCS.contains(npc.getId())) - { - return; - } - - // only occasionally do event npcs spawn with non-null interacting - if (npc.getInteracting() == client.getLocalPlayer()) - { - if (client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT) - { - currentRandomEvent = npc; - lastEventTick = client.getTickCount(); - } - } - else - { - spawnedNpcs.put(npc, client.getTickCount()); - } } @Subscribe @@ -143,31 +114,36 @@ public class RandomEventPlugin extends Plugin { Actor source = event.getSource(); Actor target = event.getTarget(); + Player player = client.getLocalPlayer(); - if (spawnedNpcs.containsKey(source)) + // Check that the npc is interacting with the player and the player isn't interacting with the npc, so + // that the notification doesn't fire from talking to other user's randoms + if (target != player || player.getInteracting() == source || !(source instanceof NPC) || !EVENT_NPCS.contains(((NPC) source).getId())) { - Player player = client.getLocalPlayer(); - if (player == target && client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT) + return; + } + + log.debug("Random event spawn: {}", source.getName()); + + currentRandomEvent = (NPC) source; + + if (client.getTickCount() - lastNotificationTick > RANDOM_EVENT_TIMEOUT) + { + lastNotificationTick = client.getTickCount(); + + if (shouldNotify(currentRandomEvent.getId())) { - currentRandomEvent = (NPC) source; - if (shouldNotify(currentRandomEvent.getId())) - { - notifier.notify("Random event spawned: " + currentRandomEvent.getName()); - } + notifier.notify("Random event spawned: " + currentRandomEvent.getName()); } } } @Subscribe - public void onGameTick(GameTick event) + public void onNpcDespawned(NpcDespawned npcDespawned) { - if (!spawnedNpcs.isEmpty()) - { - // allow 2 ticks for interacting to get set - spawnedNpcs.entrySet().removeIf(entry -> client.getTickCount() - entry.getValue() >= 2); - } + NPC npc = npcDespawned.getNpc(); - if (client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT) + if (npc == currentRandomEvent) { currentRandomEvent = null; } From 9b569f850638d44486c8f4c9d9f417937a57f6b0 Mon Sep 17 00:00:00 2001 From: dekvall Date: Fri, 18 Oct 2019 15:52:41 +0200 Subject: [PATCH 03/27] skill calc: clear combined action slot on skill change It doesn't make much sense to combine actions across skills. --- .../client/plugins/skillcalculator/SkillCalculator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java index e2114a6a95..7e69b798d2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2018, Kruithne * Copyright (c) 2018, Psikoi * All rights reserved. @@ -129,6 +129,9 @@ class SkillCalculator extends JPanel // Clear the search bar searchBar.setText(null); + // Clear the combined action slots + clearCombinedSlots(); + // Add in checkboxes for available skill bonuses. renderBonusOptions(); From a7657f46b6d047e1f537c4a564cc2774c9ea3bcc Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Mon, 30 Sep 2019 14:25:03 -0400 Subject: [PATCH 04/27] world map: correct waterbirth ship transportation icon --- .../client/plugins/worldmap/TransportationPointLocation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java index 3bbe10826a..c49e7edad5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java @@ -69,11 +69,11 @@ enum TransportationPointLocation PORTSARIM_TO_PEST_CONTROL("Ship to Pest Control", new WorldPoint(3039, 3201, 0), new WorldPoint(2659, 2675, 0)), RELLEKKA_TO_JATIZSO_NEITIZNOT("Ship to Jatizso/Neitiznot", new WorldPoint(2639, 3710, 0)), RELLEKKA_TO_MISCELLANIA("Ship to Miscellania", new WorldPoint(2627, 3692, 0), new WorldPoint(2579, 3846, 0)), - RELLEKKA_TO_WATERBIRTH("Ship to Waterbirth", new WorldPoint(2621, 3683, 0), new WorldPoint(2549, 3758, 0)), + RELLEKKA_TO_WATERBIRTH("Ship to Waterbirth", new WorldPoint(2618, 3685, 0), new WorldPoint(2549, 3758, 0)), RELLEKKA_TO_WEISS_ICEBERG("Ship to Weiss/Iceberg", new WorldPoint(2707, 3735, 0)), RELLEKKA_TO_UNGAEL("Ship to Ungael", new WorldPoint(2638, 3698, 0), new WorldPoint(2276, 4034, 0)), RIMMINGTON_TO_CORSAIR_COVE("Ship to Corsair Cove", new WorldPoint(2909, 3227, 0 ), new WorldPoint(2577, 2839, 0)), - WATERBIRTH_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2549, 3758, 0), new WorldPoint(2621, 3683, 0)), + WATERBIRTH_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2549, 3758, 0), new WorldPoint(2618, 3685, 0)), WEISS_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2847, 3967, 0), new WorldPoint(2707, 3735, 0)), UNGAEL_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2276, 4034, 0), new WorldPoint(2638, 3698, 0)), From 9f3ae20fee4365fcc4e06e767823c434f294b917 Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Mon, 30 Sep 2019 14:33:48 -0400 Subject: [PATCH 05/27] world map: correct pirates' cove ship transportation icon --- .../client/plugins/worldmap/TransportationPointLocation.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java index c49e7edad5..bbf1d9f763 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java @@ -58,7 +58,7 @@ enum TransportationPointLocation NEITIZNOT_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2310, 3779, 0), new WorldPoint(2639, 3710, 0)), PESTCONTROL_TO_PORTSARIM("Ship to Port Sarim", new WorldPoint(2659, 2675, 0), new WorldPoint(3039, 3201, 0)), PIRATES_COVE_TO_LUNAR_ISLE("Ship to Lunar Isle", new WorldPoint(2223, 3796, 0), new WorldPoint(2137, 3899, 0)), - PIRATES_COVE_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2212, 3794, 0), new WorldPoint(2656, 3680, 0)), + PIRATES_COVE_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2212, 3794, 0), new WorldPoint(2620, 3695, 0)), PORT_PHASMATYS_TO_DRAGONTOOTH("Ship to Dragontooth Island", new WorldPoint(3703, 3487, 0), new WorldPoint(3791, 3561, 0)), PORT_PHASMATYS_TO_HARMLESS("Ship to Mos Le'Harmless", new WorldPoint(3709, 3497, 0), new WorldPoint(3682, 2951, 0)), PORT_PISCARILIUS_TO_PORTSARIM_LANDSEND("Ship to Port Sarim/Land's End", new WorldPoint(1823, 3692, 0)), @@ -69,6 +69,7 @@ enum TransportationPointLocation PORTSARIM_TO_PEST_CONTROL("Ship to Pest Control", new WorldPoint(3039, 3201, 0), new WorldPoint(2659, 2675, 0)), RELLEKKA_TO_JATIZSO_NEITIZNOT("Ship to Jatizso/Neitiznot", new WorldPoint(2639, 3710, 0)), RELLEKKA_TO_MISCELLANIA("Ship to Miscellania", new WorldPoint(2627, 3692, 0), new WorldPoint(2579, 3846, 0)), + RELLEKKA_TO_PIRATES_COVE("Ship to Pirates' Cove", new WorldPoint(2620, 3695, 0), new WorldPoint(2212, 3794, 0)), RELLEKKA_TO_WATERBIRTH("Ship to Waterbirth", new WorldPoint(2618, 3685, 0), new WorldPoint(2549, 3758, 0)), RELLEKKA_TO_WEISS_ICEBERG("Ship to Weiss/Iceberg", new WorldPoint(2707, 3735, 0)), RELLEKKA_TO_UNGAEL("Ship to Ungael", new WorldPoint(2638, 3698, 0), new WorldPoint(2276, 4034, 0)), From 228001a3141ee29d74097fe7a6429c99c6f665ba Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Mon, 30 Sep 2019 14:52:55 -0400 Subject: [PATCH 06/27] world map: correct lunar diplomacy quest start icon --- .../runelite/client/plugins/worldmap/QuestStartLocation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index 1100d22f9f..ea89d808a0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -117,7 +117,7 @@ enum QuestStartLocation LEGENDS_QUEST(Quest.LEGENDS_QUEST, new WorldPoint(2725, 3367, 0)), LOST_CITY(Quest.LOST_CITY, new WorldPoint(3149, 3205, 0)), THE_LOST_TRIBE(Quest.THE_LOST_TRIBE, new WorldPoint(3211, 3224, 0)), - LUNAR_DIPLOMACY(Quest.LUNAR_DIPLOMACY, new WorldPoint(2619, 3689, 0)), + LUNAR_DIPLOMACY(Quest.LUNAR_DIPLOMACY, new WorldPoint(2618, 3691, 0)), MAKING_FRIENDS_WITH_MY_ARM(Quest.MAKING_FRIENDS_WITH_MY_ARM, new WorldPoint(2904, 10092, 0)), MAKING_HISTORY(Quest.MAKING_HISTORY, new WorldPoint(2435, 3346, 0)), MONKS_FRIEND(Quest.MONKS_FRIEND, new WorldPoint(2605, 3209, 0)), From 075d4addc110b50b54cb44e038f1362d9b5bb5be Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Wed, 2 Oct 2019 08:22:33 -0400 Subject: [PATCH 07/27] world map: add island of stone ship transport icon --- .../client/plugins/worldmap/TransportationPointLocation.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java index bbf1d9f763..47867f22bd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java @@ -48,6 +48,7 @@ enum TransportationPointLocation FISHINGPLAT_TO_ARDOUGNE("Ship to Ardougne", new WorldPoint(2779, 3271, 0), new WorldPoint(2722, 3304, 0)), HARMLESS_TO_PORT_PHASMATYS("Ship to Port Phasmatys", new WorldPoint(3682, 2951, 0), new WorldPoint(3709, 3497, 0)), ICEBERG_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2657, 3988, 0), new WorldPoint(2707, 3735, 0)), + ISLAND_OF_STONE_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2470, 3994, 0), new WorldPoint(2621, 3692, 0)), ISLAND_TO_APE_ATOLL("Ship to Ape Atoll", new WorldPoint(2891, 2726, 0), new WorldPoint(2802, 2706, 0)), JATIZSO_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2420, 3780, 0), new WorldPoint(2639, 3710, 0)), KARAMJA_TO_PORT_SARIM("Ship to Port Sarim", new WorldPoint(2955, 3144, 0), new WorldPoint(3029, 3218, 0)), From c71b8ae5df2467047990b94f66145d5491792b3e Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Fri, 18 Oct 2019 19:08:53 -0400 Subject: [PATCH 08/27] quest: add fremennik exiles quest to enum --- runelite-api/src/main/java/net/runelite/api/Quest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Quest.java b/runelite-api/src/main/java/net/runelite/api/Quest.java index ec40bcec01..70b9767a16 100644 --- a/runelite-api/src/main/java/net/runelite/api/Quest.java +++ b/runelite-api/src/main/java/net/runelite/api/Quest.java @@ -176,6 +176,7 @@ public enum Quest THE_ASCENT_OF_ARCEUUS(542, "The Ascent of Arceuus"), THE_FORSAKEN_TOWER(543, "The Forsaken Tower"), SONG_OF_THE_ELVES(603, "Song of the Elves"), + THE_FREMENNIK_EXILES(718, "The Fremennik Exiles"), //Miniquests ENTER_THE_ABYSS(319, "Enter the Abyss"), From 65b9150b0e117817afe1d43e2064392df22983fd Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Fri, 18 Oct 2019 19:09:58 -0400 Subject: [PATCH 09/27] world map: add fremennik exiles quest start --- .../net/runelite/client/plugins/worldmap/QuestStartLocation.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index ea89d808a0..459abf02e0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -96,6 +96,7 @@ enum QuestStartLocation THE_FORSAKEN_TOWER(Quest.THE_FORSAKEN_TOWER, new WorldPoint(1484, 3747, 0)), THE_FREMENNIK_ISLES(Quest.THE_FREMENNIK_ISLES, new WorldPoint(2645, 3711, 0)), THE_FREMENNIK_TRIALS(Quest.THE_FREMENNIK_TRIALS, new WorldPoint(2657, 3669, 0)), + THE_FREMENNIK_EXILES(Quest.THE_FREMENNIK_EXILES, new WorldPoint(2658, 3669, 0)), GARDEN_OF_TRANQUILLITY(Quest.GARDEN_OF_TRANQUILLITY, new WorldPoint(3227, 3477, 0)), GERTRUDES_CAT_RATCATCHERS(Quest.GERTRUDES_CAT, new WorldPoint(3150, 3411, 0)), GHOSTS_AHOY(Quest.GHOSTS_AHOY, new WorldPoint(3677, 3510, 0)), From 45c8da0adb82c4dde2d3a033a1774eb934f5c7b8 Mon Sep 17 00:00:00 2001 From: SebastiaanVanspauwen <43320258+SebastiaanVanspauwen@users.noreply.github.com> Date: Sat, 19 Oct 2019 02:57:59 +0200 Subject: [PATCH 10/27] timers plugin: update full teleblock text --- .../java/net/runelite/client/plugins/timers/TimersPlugin.java | 2 +- .../net/runelite/client/plugins/timers/TimersPluginTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index b84d987c8f..57cf7fa633 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -108,7 +108,7 @@ public class TimersPlugin extends Plugin private static final String PRAYER_ENHANCE_EXPIRED = "Your prayer enhance effect has worn off."; private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\."); - private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes, 0 seconds\\."); + private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes\\."); private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\."); private static final Pattern DIVINE_POTION_PATTERN = Pattern.compile("You drink some of your divine (.+) potion\\."); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java index f9ba35154d..618ad296c1 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java @@ -51,7 +51,7 @@ import org.mockito.runners.MockitoJUnitRunner; public class TimersPluginTest { private static final String DMM_HALF_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 1 minute, 15 seconds."; - private static final String FULL_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 5 minutes, 0 seconds."; + private static final String FULL_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 5 minutes."; private static final String HALF_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 2 minutes, 30 seconds."; @Inject From 496c11e011d791c12448269f36962607896fe116 Mon Sep 17 00:00:00 2001 From: Nathaniel Pather <12907920+NathanielPather@users.noreply.github.com> Date: Sat, 19 Oct 2019 11:17:08 +1000 Subject: [PATCH 11/27] clues: add Island of Stone location descriptor --- .../client/plugins/cluescrolls/clues/CoordinateClue.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java index 039e70770c..3d833104d7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java @@ -168,6 +168,7 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati .put(new WorldPoint(3051, 3736, 0), "East of the Wilderness Obelisk in 28 Wilderness.") .put(new WorldPoint(2316, 3814, 0), "West of Neitiznot, near the bridge.") .put(new WorldPoint(2872, 3937, 0), "Weiss.") + .put(new WorldPoint(2835, 2998, 0), "Northeast corner of the Island of Stone.") // Master .put(new WorldPoint(2178, 3209, 0), "South of Elf Camp.") .put(new WorldPoint(2155, 3100, 0), "South of Port Tyras (BJS).") From ed015888f4c9f12ec284cc97798872b3c2bcc84d Mon Sep 17 00:00:00 2001 From: 15987632 Date: Thu, 17 Oct 2019 22:39:46 -0400 Subject: [PATCH 12/27] widgets: fix wilderness level widget --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index ea51c91626..81bfc752b9 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -739,7 +739,7 @@ public class WidgetID static final int KILLDEATH_RATIO = 33; static final int SKULL_CONTAINER = 53; static final int SAFE_ZONE = 55; - static final int WILDERNESS_LEVEL = 57; // this can also be the Deadman Mode "Protection" text + static final int WILDERNESS_LEVEL = 58; // this can also be the Deadman Mode "Protection" text } static class KourendFavour From d736dfb73e9e5852ec8342f3dd6c653715307b43 Mon Sep 17 00:00:00 2001 From: Desetude Date: Sat, 19 Oct 2019 03:58:07 +0100 Subject: [PATCH 13/27] Make the PvP kill/death counter moveable --- .../main/java/net/runelite/client/ui/overlay/WidgetOverlay.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java index 17b43ce3d7..87a4de12ac 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java @@ -50,6 +50,7 @@ public class WidgetOverlay extends Overlay .put(WidgetInfo.PEST_CONTROL_INFO, OverlayPosition.TOP_LEFT) .put(WidgetInfo.ZEAH_MESS_HALL_COOKING_DISPLAY, OverlayPosition.TOP_LEFT) .put(WidgetInfo.PVP_BOUNTY_HUNTER_INFO, OverlayPosition.TOP_RIGHT) + .put(WidgetInfo.PVP_KILLDEATH_COUNTER, OverlayPosition.TOP_LEFT) .put(WidgetInfo.SKOTIZO_CONTAINER, OverlayPosition.TOP_LEFT) .put(WidgetInfo.KOUREND_FAVOUR_OVERLAY, OverlayPosition.TOP_CENTER) .put(WidgetInfo.PYRAMID_PLUNDER_DATA, OverlayPosition.TOP_CENTER) From 541af9084ce094abaefea1f5cad857bfe5fe275a Mon Sep 17 00:00:00 2001 From: Lotto Date: Sun, 20 Oct 2019 15:09:05 +0200 Subject: [PATCH 14/27] feed: use RuneLiteClient's Twitter list --- http-service/src/main/resources/application.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml index 3c6fc451fe..ce902b76cb 100644 --- a/http-service/src/main/resources/application.yaml +++ b/http-service/src/main/resources/application.yaml @@ -38,4 +38,4 @@ runelite: twitter: consumerkey: secretkey: - listid: 968949795153948673 \ No newline at end of file + listid: 1185897074786742273 \ No newline at end of file From 9321d6e64e1fed4d52b8bee51b709c9fe8384e7a Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 21 Oct 2019 08:54:34 -0400 Subject: [PATCH 15/27] achievement diary: remove requirements for Karamja hard kill a metal dragon task The listed requirements are optional due to the back entrance to the dungeon. --- .../achievementdiary/diaries/KaramjaDiaryRequirement.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java index f6523bc667..fc906cccb4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java @@ -120,9 +120,6 @@ public class KaramjaDiaryRequirement extends GenericDiaryRequirement new CombatLevelRequirement(100), new SkillRequirement(Skill.SLAYER, 50), new QuestRequirement(Quest.SHILO_VILLAGE)); - add("Kill a metal dragon in Brimhaven Dungeon.", - new SkillRequirement(Skill.AGILITY, 12), - new SkillRequirement(Skill.WOODCUTTING, 34)); // ELITE add("Craft 56 Nature runes at once.", From 3b356f7a25f901b4cc88884ed277052ae05f8068 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Wed, 16 Oct 2019 09:38:44 -0600 Subject: [PATCH 16/27] music: Add ingame granular volume adjustment --- .../java/net/runelite/api/ScriptEvent.java | 5 + .../main/java/net/runelite/api/ScriptID.java | 10 + .../java/net/runelite/api/widgets/Widget.java | 31 ++- .../net/runelite/api/widgets/WidgetID.java | 8 + .../net/runelite/api/widgets/WidgetInfo.java | 6 +- .../client/plugins/music/MusicConfig.java | 62 ++--- .../client/plugins/music/MusicPlugin.java | 219 ++++++++++++++++-- .../src/main/scripts/options_allsounds.hash | 1 + .../src/main/scripts/options_allsounds.rs2asm | 140 +++++++++++ 9 files changed, 434 insertions(+), 48 deletions(-) create mode 100644 runelite-client/src/main/scripts/options_allsounds.hash create mode 100644 runelite-client/src/main/scripts/options_allsounds.rs2asm diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java b/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java index 2af2c1bd92..b9fa224ea5 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java @@ -61,4 +61,9 @@ public interface ScriptEvent * @see net.runelite.api.events.MenuOptionClicked */ String getOpbase(); + + /** + * Parent relative x coordinate for mouse related events + */ + int getMouseX(); } diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index 657ec2dcb8..9d056b34e4 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -83,6 +83,16 @@ public final class ScriptID @ScriptArguments(integer = 2) public static final int MESSAGE_LAYER_CLOSE = 299; + /** + * Sets the background for sound option bars + *
    + *
  • int Value of the slider (0-4)
  • + *
  • int (WidgetID) * 5, segments of the slider
  • + *
+ */ + @ScriptArguments(integer = 6) + public static final int OPTIONS_ALLSOUNDS = 358; + /** * Readies the chatbox panel for things like the chatbox input * Inverse of MESSAGE_LAYER_CLOSE diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java b/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java index e4ad3f3baa..f44e61e448 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java @@ -553,7 +553,7 @@ public interface Widget void setOnMouseOverListener(Object... args); /** - * Sets a script to be ran every frame when the mouse is in the widget bounds + * Sets a script to be ran every client tick when the mouse is in the widget bounds * * @param args A ScriptID, then the args for the script */ @@ -567,7 +567,7 @@ public interface Widget void setOnMouseLeaveListener(Object... args); /** - * Sets a script to be ran every frame + * Sets a script to be ran every client tick * * @param args A ScriptID, then the args for the script */ @@ -823,4 +823,31 @@ public interface Widget * Can widgets under this widgets be scrolled in this widgets bounding box */ void setNoScrollThrough(boolean noScrollThrough); + + /** + * {@link net.runelite.api.VarPlayer}s that triggers this widgets varTransmitListener + */ + void setVarTransmitTrigger(int ...trigger); + + /** + * Sets a script to be ran the first client tick the mouse is held ontop of this widget + * + * @param args A ScriptID, then the args for the script + */ + void setOnClickListener(Object ...args); + + /** + * Sets a script to be ran the every client tick the mouse is held ontop of this widget, + * except the first client tick. + * + * @param args A ScriptID, then the args for the script + */ + void setOnHoldListener(Object ...args); + + /** + * Sets a script to be ran the first client tick the mouse is not held ontop of this widget + * + * @param args A ScriptID, then the args for the script + */ + void setOnReleaseListener(Object ...args); } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 349d29721b..06fca6a6b7 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -143,6 +143,7 @@ public class WidgetID public static final int ITEMS_KEPT_ON_DEATH_GROUP_ID = 4; public static final int SEED_VAULT_GROUP_ID = 631; public static final int EXPLORERS_RING_ALCH_GROUP_ID = 483; + public static final int OPTIONS_GROUP_ID = 261; static class WorldMap { @@ -834,4 +835,11 @@ public class WidgetID { static final int INVENTORY = 7; } + + static class Options + { + static final int MUSIC_SLIDER = 44; + static final int SOUND_EFFECT_SLIDER = 50; + static final int AREA_SOUND_SLIDER = 56; + } } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index db1b7a57f6..32281cd2c8 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -498,7 +498,11 @@ public enum WidgetInfo SEED_VAULT_TITLE_CONTAINER(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.TITLE_CONTAINER), SEED_VAULT_ITEM_CONTAINER(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_CONTAINER), - SEED_VAULT_ITEM_TEXT(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_TEXT); + SEED_VAULT_ITEM_TEXT(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_TEXT), + + OPTIONS_MUSIC_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.MUSIC_SLIDER), + OPTIONS_SOUND_EFFECT_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.SOUND_EFFECT_SLIDER), + OPTIONS_AREA_SOUND_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.AREA_SOUND_SLIDER); private final int groupId; private final int childId; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java index 20b50545d0..da764e62c9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java @@ -27,20 +27,15 @@ package net.runelite.client.plugins.music; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.Range; @ConfigGroup("music") public interface MusicConfig extends Config { @ConfigItem( keyName = "musicVolume", - name = "Music Volume", - description = "Overrides music volume in game with more granular control", - position = 1 - ) - @Range( - min = 0, - max = 255 + name = "", + description = "", + hidden = true ) default int getMusicVolume() { @@ -48,32 +43,47 @@ public interface MusicConfig extends Config } @ConfigItem( - keyName = "soundEffectVolume", - name = "Sound Effect Volume", - description = "Overrides the sound effect volume in game with more granular control", - position = 2 + keyName = "musicVolume", + name = "", + description = "", + hidden = true ) - @Range( - min = 0, - max = 127 + void setMusicVolume(int vol); + + @ConfigItem( + keyName = "soundEffectVolume", + name = "", + description = "", + hidden = true ) default int getSoundEffectVolume() { return 0; } + @ConfigItem( + keyName = "soundEffectVolume", + name = "", + description = "", + hidden = true + ) + void setSoundEffectVolume(int val); + + @ConfigItem( + keyName = "areaSoundEffectVolume", + name = "", + description = "", + hidden = true + ) + default int getAreaSoundEffectVolume() + { + return 0; + } @ConfigItem( keyName = "areaSoundEffectVolume", - name = "Area Sound Effect Volume", - description = "Overrides the area sound effect volume in game with more granular control", - position = 3 + name = "", + description = "", + hidden = true ) - @Range( - min = 0, - max = 127 - ) - default int getAreaSoundEffectVolume() - { - return 0; - } + void setAreaSoundEffectVolume(int vol); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java index 80ef0c22e3..167032278a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java @@ -29,23 +29,30 @@ import com.google.inject.Provides; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; +import java.util.function.BiConsumer; +import java.util.function.ToIntFunction; import java.util.stream.Collectors; import javax.inject.Inject; import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.ScriptID; import net.runelite.api.SoundEffectID; import net.runelite.api.SpriteID; import net.runelite.api.VarClientInt; +import net.runelite.api.VarPlayer; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameStateChanged; +import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.VarClientIntChanged; import net.runelite.api.events.VolumeChanged; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetConfig; import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetPositionMode; @@ -85,17 +92,15 @@ public class MusicPlugin extends Plugin private MusicState currentMusicFilter = MusicState.ALL; - private int lastMusicVolume; - private int lastEffectVolume; - private int lastAreaEffectVolume; - @Override protected void startUp() { - lastMusicVolume = lastEffectVolume = lastAreaEffectVolume = -1; - - clientThread.invoke(this::addMusicButtons); - clientThread.invoke(this::applyMusicVolumeConfig); + clientThread.invoke(() -> + { + addMusicButtons(); + applyMusicVolumeConfig(); + updateMusicOptions(); + }); } @Override @@ -108,6 +113,8 @@ public class MusicPlugin extends Plugin } tracks = null; + + clientThread.invoke(this::teardownMusicOptions); } @Provides @@ -138,6 +145,10 @@ public class MusicPlugin extends Plugin currentMusicFilter = MusicState.ALL; addMusicButtons(); } + if (widgetLoaded.getGroupId() == WidgetID.OPTIONS_GROUP_ID) + { + updateMusicOptions(); + } } private void addMusicButtons() @@ -206,26 +217,24 @@ public class MusicPlugin extends Plugin private void applyMusicVolumeConfig() { int musicVolume = musicConfig.getMusicVolume(); - // Set the volume if it is >0, or if it was >0 and is now going back to 0 - if (musicVolume > 0 || lastMusicVolume > 0) + if (musicVolume > 0) { - client.setMusicVolume(musicVolume); - lastMusicVolume = musicVolume; + client.setMusicVolume(musicVolume - 1); } int soundEffectVolume = musicConfig.getSoundEffectVolume(); - if (soundEffectVolume > 0 || lastEffectVolume > 0) + if (soundEffectVolume > 0) { - client.setSoundEffectVolume(soundEffectVolume); - lastEffectVolume = soundEffectVolume; + client.setSoundEffectVolume(soundEffectVolume - 1); } int areaSoundEffectVolume = musicConfig.getAreaSoundEffectVolume(); - if (areaSoundEffectVolume > 0 || lastAreaEffectVolume > 0) + if (areaSoundEffectVolume > 0) { - client.setAreaSoundEffectVolume(areaSoundEffectVolume); - lastAreaEffectVolume = areaSoundEffectVolume; + client.setAreaSoundEffectVolume(areaSoundEffectVolume - 1); } + + updateMusicOptions(); } private boolean isOnMusicTab() @@ -351,4 +360,176 @@ public class MusicPlugin extends Plugin private final String name; private final int spriteID; } -} + + @RequiredArgsConstructor + @Getter + private enum MusicSlider + { + MUSIC(WidgetInfo.OPTIONS_MUSIC_SLIDER, VarPlayer.MUSIC_VOLUME, MusicConfig::getMusicVolume, MusicConfig::setMusicVolume, 255), + AREA(WidgetInfo.OPTIONS_AREA_SOUND_SLIDER, VarPlayer.AREA_EFFECT_VOLUME, MusicConfig::getAreaSoundEffectVolume, MusicConfig::setAreaSoundEffectVolume, 127), + EFFECT(WidgetInfo.OPTIONS_SOUND_EFFECT_SLIDER, VarPlayer.SOUND_EFFECT_VOLUME, MusicConfig::getSoundEffectVolume, MusicConfig::setSoundEffectVolume, 127); + + private final WidgetInfo widgetID; + private final VarPlayer var; + private final ToIntFunction getter; + private final BiConsumer setter; + private final int max; + + @Setter + private Widget handle; + + @Setter + private Widget track; + + private static int PADDING = 8; + + private int getX() + { + return getTrack().getRelativeX() + PADDING; + } + + private int getWidth() + { + return getTrack().getWidth() - (PADDING * 2) - handle.getWidth(); + } + } + + private void teardownMusicOptions() + { + for (MusicSlider slider : MusicSlider.values()) + { + Widget icon = client.getWidget(slider.getWidgetID()); + if (icon == null) + { + return; + } + + if (slider.getHandle() != null) + { + { + Widget handle = slider.getHandle(); + Widget[] siblings = handle.getParent().getChildren(); + if (siblings.length < handle.getIndex() || siblings[handle.getIndex()] != handle) + { + continue; + } + siblings[slider.getTrack().getIndex()] = null; + siblings[handle.getIndex()] = null; + } + + Object[] init = icon.getOnLoadListener(); + init[1] = slider.getWidgetID().getId(); + + // Readd the var transmit triggers and rerun options_allsounds + client.runScript(init); + slider.setHandle(null); + slider.setTrack(null); + } + } + } + + private void updateMusicOptions() + { + for (MusicSlider slider : MusicSlider.values()) + { + Widget icon = client.getWidget(slider.getWidgetID()); + if (icon == null) + { + return; + } + + Widget handle = slider.getHandle(); + if (handle != null) + { + Widget[] siblings = handle.getParent().getChildren(); + if (siblings.length < handle.getIndex() || siblings[handle.getIndex()] != handle) + { + handle = null; + } + } + if (handle == null) + { + Object[] init = icon.getOnLoadListener(); + icon.setVarTransmitTrigger((int[]) null); + + Widget track = icon.getParent().createChild(-1, WidgetType.TEXT); + slider.setTrack(track); + handle = icon.getParent().createChild(-1, WidgetType.GRAPHIC); + slider.setHandle(handle); + + { + // First widget of the track + int wid = (Integer) init[2]; + Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); + + track.setOriginalX(w.getRelativeX()); + track.setOriginalY(w.getRelativeY()); + } + { + // Last widget of the track + int wid = (Integer) init[6]; + Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); + + track.setOriginalWidth((w.getRelativeX() + w.getWidth()) - track.getOriginalX()); + } + + track.setOriginalHeight(16); + track.setNoClickThrough(true); + track.revalidate(); + + handle.setSpriteId(SpriteID.OPTIONS_ZOOM_SLIDER_THUMB); + handle.setOriginalWidth(16); + handle.setOriginalHeight(16); + handle.setClickMask(WidgetConfig.DRAG); + + JavaScriptCallback move = ev -> + { + int newVal = ((ev.getMouseX() - MusicSlider.PADDING - (slider.getHandle().getWidth() / 2)) * slider.getMax()) + / slider.getWidth(); + if (newVal < 0) + { + newVal = 0; + } + if (newVal > slider.getMax()) + { + newVal = slider.getMax(); + } + + // We store +1 so we can tell the difference between 0 and muted + slider.getSetter().accept(musicConfig, newVal + 1); + applyMusicVolumeConfig(); + }; + + track.setOnClickListener(move); + track.setOnHoldListener(move); + track.setOnReleaseListener(move); + track.setHasListener(true); + + client.runScript(ScriptID.OPTIONS_ALLSOUNDS, -1, init[2], init[3], init[4], init[5], init[6]); + } + + int value = slider.getGetter().applyAsInt(musicConfig) - 1; + if (value <= -1) + { + // Use the vanilla value + value = ((4 - client.getVar(slider.getVar())) * slider.getMax()) / 4; + } + + int newX = ((value * slider.getWidth()) / slider.getMax()) + slider.getX(); + slider.getHandle().setOriginalX(newX); + slider.getHandle().setOriginalY(slider.getTrack().getOriginalY()); + slider.getHandle().revalidate(); + } + } + + @Subscribe + public void onScriptCallbackEvent(ScriptCallbackEvent ev) + { + switch (ev.getEventName()) + { + case "optionsAllSounds": + // We have to override this script because it gets invoked periodically from the server + client.getIntStack()[client.getIntStackSize() - 1] = -1; + } + } +} \ No newline at end of file diff --git a/runelite-client/src/main/scripts/options_allsounds.hash b/runelite-client/src/main/scripts/options_allsounds.hash new file mode 100644 index 0000000000..84863d9bd2 --- /dev/null +++ b/runelite-client/src/main/scripts/options_allsounds.hash @@ -0,0 +1 @@ +950ADB6A28E029005D24F99A65EF4D2AC4486EDC680D8770F4435F0300AA1299 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/options_allsounds.rs2asm b/runelite-client/src/main/scripts/options_allsounds.rs2asm new file mode 100644 index 0000000000..2d4e94e9ce --- /dev/null +++ b/runelite-client/src/main/scripts/options_allsounds.rs2asm @@ -0,0 +1,140 @@ +.id 358 +.int_stack_count 6 +.string_stack_count 0 +.int_var_count 6 +.string_var_count 0 +; callback "optionsAllSounds" +; Used by the MusicPlugin to hide the vanilla (blue) volume handles +; Enable the MusicPlugin and go to the volume options panel. There should +; only be a green handle on the slider + iload 0 + sconst "optionsAllSounds" + runelite_callback + istore 0 + iload 0 + iconst 4 + if_icmpeq LABEL4 + jump LABEL20 +LABEL4: + iconst 687 + iload 1 + if_setgraphic + iconst 693 + iload 2 + if_setgraphic + iconst 694 + iload 3 + if_setgraphic + iconst 695 + iload 4 + if_setgraphic + iconst 696 + iload 5 + if_setgraphic + jump LABEL115 +LABEL20: + iload 0 + iconst 3 + if_icmpeq LABEL24 + jump LABEL40 +LABEL24: + iconst 692 + iload 1 + if_setgraphic + iconst 688 + iload 2 + if_setgraphic + iconst 694 + iload 3 + if_setgraphic + iconst 695 + iload 4 + if_setgraphic + iconst 696 + iload 5 + if_setgraphic + jump LABEL115 +LABEL40: + iload 0 + iconst 2 + if_icmpeq LABEL44 + jump LABEL60 +LABEL44: + iconst 692 + iload 1 + if_setgraphic + iconst 693 + iload 2 + if_setgraphic + iconst 689 + iload 3 + if_setgraphic + iconst 695 + iload 4 + if_setgraphic + iconst 696 + iload 5 + if_setgraphic + jump LABEL115 +LABEL60: + iload 0 + iconst 1 + if_icmpeq LABEL64 + jump LABEL80 +LABEL64: + iconst 692 + iload 1 + if_setgraphic + iconst 693 + iload 2 + if_setgraphic + iconst 694 + iload 3 + if_setgraphic + iconst 690 + iload 4 + if_setgraphic + iconst 696 + iload 5 + if_setgraphic + jump LABEL115 +LABEL80: + iload 0 + iconst 0 + if_icmpeq LABEL84 + jump LABEL100 +LABEL84: + iconst 692 + iload 1 + if_setgraphic + iconst 693 + iload 2 + if_setgraphic + iconst 694 + iload 3 + if_setgraphic + iconst 695 + iload 4 + if_setgraphic + iconst 691 + iload 5 + if_setgraphic + jump LABEL115 +LABEL100: + iconst 692 + iload 1 + if_setgraphic + iconst 693 + iload 2 + if_setgraphic + iconst 694 + iload 3 + if_setgraphic + iconst 695 + iload 4 + if_setgraphic + iconst 696 + iload 5 + if_setgraphic +LABEL115: + return From 263a6daf1455a6b9bbe037c36438ff7bd7128854 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Oct 2019 22:50:40 +0100 Subject: [PATCH 17/27] farming calc: fix white lily level --- .../runelite/client/plugins/skillcalculator/skill_farming.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json index 5953579264..805b2b365c 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json @@ -187,7 +187,7 @@ "xp": 6218.4 }, { - "level": 57, + "level": 58, "icon": 22932, "name": "White lily", "xp": 292 From 06c1732fa118e3618a57d7b678c5bbdbecf190b4 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Oct 2019 22:51:29 +0100 Subject: [PATCH 18/27] fletching calc: add dragon crossbow --- .../skillcalculator/skill_fletching.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fletching.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fletching.json index 7da4e7236c..e64e32c28d 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fletching.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fletching.json @@ -486,6 +486,24 @@ "name": "Amethyst Broad Bolts", "xp": 10.6 }, + { + "level": 78, + "icon": 21952, + "name": "Magic Stock", + "xp": 70 + }, + { + "level": 78, + "icon": 21921, + "name": "Dragon Crossbow (U)", + "xp": 135 + }, + { + "level": 78, + "icon": 21902, + "name": "Dragon Crossbow", + "xp": 70 + }, { "level": 80, "icon": 861, From e498ba59b4044de71f0236026f4c1b28e322fe84 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Oct 2019 22:51:53 +0100 Subject: [PATCH 19/27] mining calc: add soft clay --- .../client/plugins/skillcalculator/skill_mining.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json index 7c7c3abd49..728f204861 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json @@ -126,6 +126,12 @@ "name": "Mithril Ore", "xp": 80 }, + { + "level": 70, + "icon": 1761, + "name": "Soft Clay", + "xp": 5 + }, { "level": 70, "icon": 449, From b109f935724a72423d54e2753c7b85e82b665dd3 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Oct 2019 22:52:16 +0100 Subject: [PATCH 20/27] hunter calc: add crystal impling --- .../client/plugins/skillcalculator/skill_hunter.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_hunter.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_hunter.json index 1337d233cb..a50c2164d6 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_hunter.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_hunter.json @@ -318,6 +318,12 @@ "name": "Ninja Impling (Gielinor)", "xp": 240 }, + { + "level": 80, + "icon": 23768, + "name": "Crystal Impling", + "xp": 280 + }, { "level": 83, "icon": 11256, From a3ccd12db17002c0270789924c0abb5629587dcb Mon Sep 17 00:00:00 2001 From: dekvall Date: Sun, 6 Oct 2019 17:19:32 +0200 Subject: [PATCH 21/27] fishing: reset trawler start time when back on land --- .../java/net/runelite/client/plugins/fishing/FishingPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java index 39cbb4253e..a8371cf81c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java @@ -386,6 +386,7 @@ public class FishingPlugin extends Plugin if (regionID != TRAWLER_SHIP_REGION_NORMAL && regionID != TRAWLER_SHIP_REGION_SINKING) { log.debug("Trawler session ended"); + trawlerStartTime = null; return; } From 27a304dce6db8dab5f463c83b31831758c690eb3 Mon Sep 17 00:00:00 2001 From: dekvall Date: Sun, 6 Oct 2019 17:17:32 +0200 Subject: [PATCH 22/27] loottracker: add fishing trawler --- runelite-api/src/main/java/net/runelite/api/InventoryID.java | 4 ++++ .../src/main/java/net/runelite/api/widgets/WidgetID.java | 1 + .../client/plugins/loottracker/LootTrackerPlugin.java | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/InventoryID.java b/runelite-api/src/main/java/net/runelite/api/InventoryID.java index a5e4de4bdc..83a8ffe68e 100644 --- a/runelite-api/src/main/java/net/runelite/api/InventoryID.java +++ b/runelite-api/src/main/java/net/runelite/api/InventoryID.java @@ -29,6 +29,10 @@ package net.runelite.api; */ public enum InventoryID { + /** + * Reward from fishing trawler + */ + FISHING_TRAWLER_REWARD(0), /** * Standard player inventory. */ diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 4c8b3efc80..33d0f462ac 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -120,6 +120,7 @@ public class WidgetID public static final int SPELLBOOK_GROUP_ID = 218; public static final int PVP_GROUP_ID = 90; public static final int FISHING_TRAWLER_GROUP_ID = 366; + public static final int FISHING_TRAWLER_REWARD_GROUP_ID = 367; public static final int ZEAH_MESS_HALL_GROUP_ID = 235; public static final int KOUREND_FAVOUR_GROUP_ID = 246; public static final int LOOTING_BAG_GROUP_ID = 81; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index edec90e676..89a6c0a685 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -407,6 +407,10 @@ public class LootTrackerPlugin extends Plugin eventType = "Kingdom of Miscellania"; container = client.getItemContainer(InventoryID.KINGDOM_OF_MISCELLANIA); break; + case (WidgetID.FISHING_TRAWLER_REWARD_GROUP_ID): + eventType = "Fishing Trawler"; + container = client.getItemContainer(InventoryID.FISHING_TRAWLER_REWARD); + break; default: return; } From a94637d3be596b50cbe06a577f6f6b90b2486350 Mon Sep 17 00:00:00 2001 From: Abex Date: Tue, 22 Oct 2019 12:49:01 -0600 Subject: [PATCH 23/27] wiki: support wiki-casting on non-inventory items --- .../net/runelite/api/widgets/WidgetID.java | 12 +- .../net/runelite/api/widgets/WidgetInfo.java | 6 +- .../client/plugins/wiki/WikiPlugin.java | 138 ++++++++++++++---- 3 files changed, 123 insertions(+), 33 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 33d0f462ac..8dc2e13152 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -52,7 +52,7 @@ public class WidgetID public static final int EQUIPMENT_INVENTORY_GROUP_ID = 85; public static final int EMOTES_GROUP_ID = 216; public static final int RUNE_POUCH_GROUP_ID = 190; - public static final int DIARY_GROUP_ID = 259; + public static final int ACHIEVEMENT_DIARY_GROUP_ID = 259; public static final int PEST_CONTROL_BOAT_GROUP_ID = 407; public static final int PEST_CONTROL_GROUP_ID = 408; public static final int CLAN_CHAT_GROUP_ID = 7; @@ -843,4 +843,14 @@ public class WidgetID static final int SOUND_EFFECT_SLIDER = 50; static final int AREA_SOUND_SLIDER = 56; } + + static class AchievementDiary + { + static final int CONTAINER = 2; + } + + static class Skills + { + static final int CONTAINER = 0; + } } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 32281cd2c8..c7e3efb585 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -502,7 +502,11 @@ public enum WidgetInfo OPTIONS_MUSIC_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.MUSIC_SLIDER), OPTIONS_SOUND_EFFECT_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.SOUND_EFFECT_SLIDER), - OPTIONS_AREA_SOUND_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.AREA_SOUND_SLIDER); + OPTIONS_AREA_SOUND_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.AREA_SOUND_SLIDER), + + ACHIEVEMENT_DIARY_CONTAINER(WidgetID.ACHIEVEMENT_DIARY_GROUP_ID, WidgetID.AchievementDiary.CONTAINER), + + SKILLS_CONTAINER(WidgetID.SKILLS_GROUP_ID, WidgetID.Skills.CONTAINER); private final int groupId; private final int childId; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index afbc30b766..3c14556492 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -26,8 +26,7 @@ package net.runelite.client.plugins.wiki; import com.google.common.primitives.Ints; import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.util.stream.Stream; import javax.inject.Inject; import javax.inject.Provider; import lombok.extern.slf4j.Slf4j; @@ -82,9 +81,6 @@ public class WikiPlugin extends Plugin private static final String MENUOP_QUICKGUIDE = "Quick Guide"; private static final String MENUOP_WIKI = "Wiki"; - private static final Pattern SKILL_REGEX = Pattern.compile("([A-Za-z]+) guide"); - private static final Pattern DIARY_REGEX = Pattern.compile("([A-Za-z &]+) Journal"); - @Inject private SpriteManager spriteManager; @@ -164,12 +160,14 @@ public class WikiPlugin extends Plugin icon.setOriginalHeight(16); icon.setTargetVerb("Lookup"); icon.setName("Wiki"); - icon.setClickMask(WidgetConfig.USE_GROUND_ITEM | WidgetConfig.USE_ITEM | WidgetConfig.USE_NPC | WidgetConfig.USE_OBJECT); + icon.setClickMask(WidgetConfig.USE_GROUND_ITEM | WidgetConfig.USE_ITEM | WidgetConfig.USE_NPC + | WidgetConfig.USE_OBJECT | WidgetConfig.USE_WIDGET); icon.setNoClickThrough(true); icon.setOnTargetEnterListener((JavaScriptCallback) ev -> { wikiSelected = true; icon.setSpriteId(WikiSprite.WIKI_SELECTED_ICON.getSpriteId()); + client.setAllWidgetsAreOpTargetable(true); }); icon.setAction(5, "Search"); // Start at option 5 so the target op is ontop icon.setOnOpListener((JavaScriptCallback) ev -> @@ -188,6 +186,8 @@ public class WikiPlugin extends Plugin private void onDeselect() { + client.setAllWidgetsAreOpTargetable(false); + wikiSelected = false; if (icon != null) { @@ -198,6 +198,7 @@ public class WikiPlugin extends Plugin @Subscribe private void onMenuOptionClicked(MenuOptionClicked ev) { + optarget: if (wikiSelected) { onDeselect(); @@ -211,6 +212,9 @@ public class WikiPlugin extends Plugin switch (ev.getMenuAction()) { + case RUNELITE: + // This is a quest widget op + break optarget; case CANCEL: return; case ITEM_USE_ON_WIDGET: @@ -245,6 +249,18 @@ public class WikiPlugin extends Plugin location = WorldPoint.fromScene(client, ev.getActionParam(), ev.getWidgetId(), client.getPlane()); break; } + case SPELL_CAST_ON_WIDGET: + Widget w = getWidget(ev.getWidgetId(), ev.getActionParam()); + + if (w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1) + { + type = "item"; + id = itemManager.canonicalize(w.getItemId()); + name = itemManager.getItemComposition(id).getName(); + location = null; + break; + } + // fallthrough default: log.info("Unknown menu option: {} {} {}", ev, ev.getMenuAction(), ev.getMenuAction() == MenuAction.CANCEL); return; @@ -293,25 +309,12 @@ public class WikiPlugin extends Plugin LinkBrowser.browse(ub.build().toString()); break; case MENUOP_WIKI: - Matcher skillRegex = WikiPlugin.SKILL_REGEX.matcher(Text.removeTags(ev.getMenuTarget())); - Matcher diaryRegex = WikiPlugin.DIARY_REGEX.matcher(Text.removeTags(ev.getMenuTarget())); + LinkBrowser.browse(WIKI_BASE.newBuilder() + .addPathSegment("w") + .addPathSegment(Text.removeTags(ev.getMenuTarget())) + .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE) + .build().toString()); - if (skillRegex.find()) - { - LinkBrowser.browse(WIKI_BASE.newBuilder() - .addPathSegment("w") - .addPathSegment(skillRegex.group(1)) - .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE) - .build().toString()); - } - else if (diaryRegex.find()) - { - LinkBrowser.browse(WIKI_BASE.newBuilder() - .addPathSegment("w") - .addPathSegment(diaryRegex.group(1) + " Diary") - .addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE) - .build().toString()); - } } } } @@ -322,6 +325,16 @@ public class WikiPlugin extends Plugin .build(); } + private Widget getWidget(int wid, int index) + { + Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); + if (index != -1) + { + w = w.getChild(index); + } + return w; + } + @Subscribe public void onMenuEntryAdded(MenuEntryAdded event) { @@ -329,19 +342,42 @@ public class WikiPlugin extends Plugin int widgetID = event.getActionParam1(); MenuEntry[] menuEntries = client.getMenuEntries(); - if (Ints.contains(QUESTLIST_WIDGET_IDS, widgetID) && "Read Journal:".equals(event.getOption())) + if (wikiSelected && event.getType() == MenuAction.SPELL_CAST_ON_WIDGET.getId()) { + Widget w = getWidget(widgetID, widgetIndex); + if (!(w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1)) + { + // we don't support this widget + // remove the last SPELL_CAST_ON_WIDGET; we can't blindly remove the top action because some other + // plugin might have added something on this same event, and we probably shouldn't remove that instead + MenuEntry[] oldEntries = menuEntries; + menuEntries = Arrays.copyOf(menuEntries, menuEntries.length - 1); + for (int ourEntry = oldEntries.length - 1; + ourEntry >= 2 && oldEntries[oldEntries.length - 1].getType() != MenuAction.SPELL_CAST_ON_WIDGET.getId(); + ourEntry--) + { + menuEntries[ourEntry - 1] = oldEntries[ourEntry]; + } + client.setMenuEntries(menuEntries); + } + } + + if (Ints.contains(QUESTLIST_WIDGET_IDS, widgetID) + && ((wikiSelected && widgetIndex != -1) || "Read Journal:".equals(event.getOption()))) + { + Widget w = getWidget(widgetID, widgetIndex); + String target = w.getName(); menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 2); MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); - menuEntry.setTarget(event.getTarget()); + menuEntry.setTarget(target); menuEntry.setOption(MENUOP_GUIDE); menuEntry.setParam0(widgetIndex); menuEntry.setParam1(widgetID); menuEntry.setType(MenuAction.RUNELITE.getId()); menuEntry = menuEntries[menuEntries.length - 2] = new MenuEntry(); - menuEntry.setTarget(event.getTarget()); + menuEntry.setTarget(target); menuEntry.setOption(MENUOP_QUICKGUIDE); menuEntry.setParam0(widgetIndex); menuEntry.setParam1(widgetID); @@ -350,17 +386,57 @@ public class WikiPlugin extends Plugin client.setMenuEntries(menuEntries); } - if ((WidgetInfo.TO_GROUP(widgetID) == WidgetID.SKILLS_GROUP_ID && event.getOption().startsWith("View")) - || (WidgetInfo.TO_GROUP(widgetID) == WidgetID.DIARY_GROUP_ID && event.getOption().startsWith("Open"))) + if (widgetID == WidgetInfo.ACHIEVEMENT_DIARY_CONTAINER.getId()) { + Widget w = getWidget(widgetID, widgetIndex); + if (w.getActions() == null) + { + return; + } + + String action = Stream.of(w.getActions()) + .filter(s -> s != null && !s.isEmpty()) + .findFirst().orElse(null); + if (action == null) + { + return; + } + menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); - menuEntry.setTarget(event.getOption().replace("View ", "").replace("Open ", "")); + menuEntry.setTarget(action.replace("Open ", "").replace("Journal", "Diary")); + menuEntry.setOption(MENUOP_WIKI); + menuEntry.setParam0(widgetIndex); + menuEntry.setParam1(widgetID); + menuEntry.setType(MenuAction.RUNELITE.getId()); + + client.setMenuEntries(menuEntries); + } + + if (WidgetInfo.TO_GROUP(widgetID) == WidgetInfo.SKILLS_CONTAINER.getGroupId()) + { + Widget w = getWidget(widgetID, widgetIndex); + if (w.getParentId() != WidgetInfo.SKILLS_CONTAINER.getId()) + { + return; + } + + String action = Stream.of(w.getActions()) + .filter(s -> s != null && !s.isEmpty()) + .findFirst().orElse(null); + if (action == null) + { + return; + } + + menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); + + MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); + menuEntry.setTarget(action.replace("View ", "").replace(" guide", "")); menuEntry.setOption(MENUOP_WIKI); menuEntry.setParam0(widgetIndex); menuEntry.setParam1(widgetID); - menuEntry.setIdentifier(event.getIdentifier()); menuEntry.setType(MenuAction.RUNELITE.getId()); client.setMenuEntries(menuEntries); From def32e5bfb31adfa590e19d72c36e84e302b7343 Mon Sep 17 00:00:00 2001 From: Elpan <47849683+Elpan1@users.noreply.github.com> Date: Tue, 22 Oct 2019 20:52:26 +0200 Subject: [PATCH 24/27] world map: fix Prifddinas farming patch tooltip There is no herb patch in Prifddinas --- .../client/plugins/worldmap/FarmingPatchLocation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java index bfb3e446ae..eaadd3a5be 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java @@ -35,13 +35,13 @@ enum FarmingPatchLocation new WorldPoint(3793, 2836, 0), new WorldPoint(1269, 3730, 0) ), + ALLOTMENT_FLOWER("Allotment/Flower", new WorldPoint(3289, 6100, 0)), ALLOTMENT_HERB_FLOWER("Allotment/Herb/Flower", new WorldPoint(1809, 3490, 0), new WorldPoint(3598, 3524, 0), new WorldPoint(3052, 3309, 0), new WorldPoint(2810, 3462, 0), - new WorldPoint(2663, 3375, 0), - new WorldPoint(3289, 6100, 0) + new WorldPoint(2663, 3375, 0) ), ANIMA_HERB("Anima/Herb", new WorldPoint(1235, 3724, 0)), BELLADONNA("Belladonna", new WorldPoint(3084, 3356, 0)), From fbe9f71e706643a4568eb876e2214a5016c56866 Mon Sep 17 00:00:00 2001 From: dekvall Date: Sat, 19 Oct 2019 18:58:54 +0200 Subject: [PATCH 25/27] loottracker: add confirm dialog to reset all --- .../plugins/loottracker/LootTrackerPanel.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java index 9dc783bab8..39a1b0134a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java @@ -40,6 +40,7 @@ import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JMenuItem; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.border.EmptyBorder; @@ -74,6 +75,10 @@ class LootTrackerPanel extends PluginPanel private static final String HTML_LABEL_TEMPLATE = "%s%s"; + private static final String SYNC_RESET_ALL_WARNING_TEXT = + "This will permanently delete the current loot from both the client and the RuneLite website."; + private static final String NO_SYNC_RESET_ALL_WARNING_TEXT = + "This will permanently delete the current loot from the client."; // When there is no loot, display this private final PluginErrorPanel errorPanel = new PluginErrorPanel(); @@ -312,6 +317,18 @@ class LootTrackerPanel extends PluginPanel final JMenuItem reset = new JMenuItem("Reset All"); reset.addActionListener(e -> { + final LootTrackerClient client = plugin.getLootTrackerClient(); + final boolean syncLoot = client != null && config.syncPanel(); + final int result = JOptionPane.showOptionDialog(overallPanel, + syncLoot ? SYNC_RESET_ALL_WARNING_TEXT : NO_SYNC_RESET_ALL_WARNING_TEXT, + "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, + null, new String[]{"Yes", "No"}, "No"); + + if (result != JOptionPane.YES_OPTION) + { + return; + } + // If not in detailed view, remove all, otherwise only remove for the currently detailed title records.removeIf(r -> r.matches(currentView)); boxes.removeIf(b -> b.matches(currentView)); @@ -320,8 +337,7 @@ class LootTrackerPanel extends PluginPanel logsContainer.repaint(); // Delete all loot, or loot matching the current view - LootTrackerClient client = plugin.getLootTrackerClient(); - if (client != null && config.syncPanel()) + if (syncLoot) { client.delete(currentView); } From 1b60dbb5757af168f7f55b2151f5672646425146 Mon Sep 17 00:00:00 2001 From: dekvall Date: Wed, 23 Oct 2019 00:04:54 +0200 Subject: [PATCH 26/27] random events: fix npe on login on login, interactingChanged fires once with both player and target set to null. --- .../client/plugins/randomevents/RandomEventPlugin.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java index bc9cb52977..85aace2e7c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java @@ -118,7 +118,11 @@ public class RandomEventPlugin extends Plugin // Check that the npc is interacting with the player and the player isn't interacting with the npc, so // that the notification doesn't fire from talking to other user's randoms - if (target != player || player.getInteracting() == source || !(source instanceof NPC) || !EVENT_NPCS.contains(((NPC) source).getId())) + if (player == null + || target != player + || player.getInteracting() == source + || !(source instanceof NPC) + || !EVENT_NPCS.contains(((NPC) source).getId())) { return; } From f025082676c454dee9c96f13a8513ec2526489bf Mon Sep 17 00:00:00 2001 From: dekvall Date: Wed, 23 Oct 2019 01:48:41 +0200 Subject: [PATCH 27/27] examine plugin: add pricecheck for trade interface --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 2 ++ .../net/runelite/client/plugins/examine/ExaminePlugin.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 8dc2e13152..a0a6c4bf62 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -45,6 +45,8 @@ public class WidgetID public static final int GRAND_EXCHANGE_GROUP_ID = 465; public static final int DEPOSIT_BOX_GROUP_ID = 192; public static final int INVENTORY_GROUP_ID = 149; + public static final int PLAYER_TRADE_SCREEN_GROUP_ID = 335; + public static final int PLAYER_TRADE_INVENTORY_GROUP_ID = 336; public static final int FRIENDS_LIST_GROUP_ID = 429; public static final int IGNORE_LIST_GROUP_ID = 432; public static final int RAIDING_PARTY_GROUP_ID = 500; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java index 02769cb2a5..73488efd52 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java @@ -95,7 +95,6 @@ public class ExaminePlugin extends Plugin @Inject private ScheduledExecutorService executor; - @Subscribe public void onGameStateChanged(GameStateChanged event) { @@ -287,7 +286,9 @@ public class ExaminePlugin extends Plugin || WidgetInfo.CLUE_SCROLL_REWARD_ITEM_CONTAINER.getGroupId() == widgetGroup || WidgetInfo.LOOTING_BAG_CONTAINER.getGroupId() == widgetGroup || WidgetID.SEED_VAULT_INVENTORY_GROUP_ID == widgetGroup - || WidgetID.SEED_BOX_GROUP_ID == widgetGroup) + || WidgetID.SEED_BOX_GROUP_ID == widgetGroup + || WidgetID.PLAYER_TRADE_SCREEN_GROUP_ID == widgetGroup + || WidgetID.PLAYER_TRADE_INVENTORY_GROUP_ID == widgetGroup) { Widget[] children = widget.getDynamicChildren(); if (actionParam < children.length)