From 2ac1c2e387dd17b9ffed7960c80d076ba7539744 Mon Sep 17 00:00:00 2001 From: Lotto Date: Wed, 16 Oct 2019 19:01:45 +0200 Subject: [PATCH 01/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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 ac27e8d17f734770514fbf4dbd1f5689a611783f Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 19 Oct 2019 03:16:05 +0100 Subject: [PATCH 13/63] loot tracker: rename price to gePrice --- .../client/plugins/loottracker/LootTrackerBox.java | 12 ++++++------ .../client/plugins/loottracker/LootTrackerItem.java | 2 +- .../client/plugins/loottracker/LootTrackerPanel.java | 2 +- .../plugins/loottracker/LootTrackerPlugin.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index 2e89f8af60..55892d8e34 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -261,7 +261,7 @@ class LootTrackerBox extends JPanel continue; } - totalPrice += entry.getPrice(); + totalPrice += entry.getGePrice(); int quantity = 0; for (final LootTrackerItem i : items) @@ -277,9 +277,9 @@ class LootTrackerBox extends JPanel if (quantity > 0) { int newQuantity = entry.getQuantity() + quantity; - long pricePerItem = entry.getPrice() == 0 ? 0 : (entry.getPrice() / entry.getQuantity()); + long gePricePerItem = entry.getGePrice() == 0 ? 0 : (entry.getGePrice() / entry.getQuantity()); - items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, pricePerItem * newQuantity, entry.isIgnored())); + items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, gePricePerItem * newQuantity, entry.isIgnored())); } else { @@ -287,7 +287,7 @@ class LootTrackerBox extends JPanel } } - items.sort((i1, i2) -> Long.compare(i2.getPrice(), i1.getPrice())); + items.sort((i1, i2) -> Long.compare(i2.getGePrice(), i1.getGePrice())); // Calculates how many rows need to be display to fit all items final int rowSize = ((items.size() % ITEMS_PER_ROW == 0) ? 0 : 1) + items.size() / ITEMS_PER_ROW; @@ -352,8 +352,8 @@ class LootTrackerBox extends JPanel { final String name = item.getName(); final int quantity = item.getQuantity(); - final long price = item.getPrice(); + final long gePrice = item.getGePrice(); final String ignoredLabel = item.isIgnored() ? " - Ignored" : ""; - return name + " x " + quantity + " (" + QuantityFormatter.quantityToStackSize(price) + ") " + ignoredLabel; + return name + " x " + quantity + " (" + QuantityFormatter.quantityToStackSize(gePrice) + ") " + ignoredLabel; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java index feb1504681..1ecf28a229 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java @@ -38,7 +38,7 @@ class LootTrackerItem @Getter private final int quantity; @Getter - private final long price; + private final long gePrice; @Getter @Setter private boolean ignored; 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..a4f21447f5 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 @@ -613,7 +613,7 @@ class LootTrackerPanel extends PluginPanel continue; } - overallGp += item.getPrice(); + overallGp += item.getGePrice(); } if (present > 0) 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..cc021c3650 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 @@ -636,14 +636,14 @@ public class LootTrackerPlugin extends Plugin { final ItemComposition itemComposition = itemManager.getItemComposition(itemId); final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId; - final long price = (long) itemManager.getItemPrice(realItemId) * (long) quantity; + final long gePrice = (long) itemManager.getItemPrice(realItemId) * (long) quantity; final boolean ignored = ignoredItems.contains(itemComposition.getName()); return new LootTrackerItem( itemId, itemComposition.getName(), quantity, - price, + gePrice, ignored); } From d736dfb73e9e5852ec8342f3dd6c653715307b43 Mon Sep 17 00:00:00 2001 From: Desetude Date: Sat, 19 Oct 2019 03:58:07 +0100 Subject: [PATCH 14/63] 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 15/63] 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 16/63] 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 17/63] 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 18/63] 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 19/63] 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 20/63] 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 21/63] 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 22/63] 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 23/63] 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 24/63] 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 25/63] 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 26/63] 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 27/63] 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 28/63] 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) From 7b7d436f007ade619aa16dbe40eb7c344202ab30 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Wed, 23 Oct 2019 08:14:16 +0100 Subject: [PATCH 29/63] clues: fix Shayzien supply armour Sherlock clue --- .../client/plugins/cluescrolls/clues/SkillChallengeClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java index d563c0c0de..ced104cc30 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java @@ -144,7 +144,7 @@ public class SkillChallengeClue extends ClueScroll implements NpcClueScroll new SkillChallengeClue("Craft multiple cosmic runes from a single essence.", item(ItemID.PURE_ESSENCE)), new SkillChallengeClue("Plant a watermelon seed.", item(ItemID.RAKE), item(ItemID.SEED_DIBBER), xOfItem(ItemID.WATERMELON_SEED, 3)), new SkillChallengeClue("Activate the Chivalry prayer."), - new SkillChallengeClue("Hand in a Tier 2 or higher set of Shayzien supply armour", "hand in a boxed set of shayzien supply armour at tier 2 or above.", any("Shayzien Supply Set (Tier 2 or higher)", item(ItemID.SHAYZIEN_SUPPLY_SET_2), item(ItemID.SHAYZIEN_SUPPLY_SET_3), item(ItemID.SHAYZIEN_SUPPLY_SET_4), item(ItemID.SHAYZIEN_SUPPLY_SET_5))), + new SkillChallengeClue("Hand in a Tier 2 or higher set of Shayzien supply armour", "take the lovakengj armourers a boxed set of shayzien supply armour at tier 2 or above.", any("Shayzien Supply Set (Tier 2 or higher)", item(ItemID.SHAYZIEN_SUPPLY_SET_2), item(ItemID.SHAYZIEN_SUPPLY_SET_3), item(ItemID.SHAYZIEN_SUPPLY_SET_4), item(ItemID.SHAYZIEN_SUPPLY_SET_5))), // Master Sherlock Tasks new SkillChallengeClue("Equip an abyssal whip in front of the abyssal demons of the Slayer Tower.", true, any("Abyssal Whip", item(ItemID.ABYSSAL_WHIP), item(ItemID.FROZEN_ABYSSAL_WHIP), item(ItemID.VOLCANIC_ABYSSAL_WHIP))), new SkillChallengeClue("Smith a runite med helm.", item(ItemID.HAMMER), item(ItemID.RUNITE_BAR)), From 6aea005bfa707b10be3182ba44e50681058839ed Mon Sep 17 00:00:00 2001 From: dekvall Date: Wed, 23 Oct 2019 01:29:32 +0200 Subject: [PATCH 30/63] chat timestamps: add timestamps to split private chat --- .../src/main/scripts/ChatSplitBuilder.rs2asm | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm b/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm index 73badbb543..354aa42e71 100644 --- a/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm +++ b/runelite-client/src/main/scripts/ChatSplitBuilder.rs2asm @@ -377,12 +377,17 @@ LABEL327: jump LABEL372 LABEL330: iload 7 + iload 12 ; Load the id of the messageNode + sconst "" ; Push a container for the timestamp + sconst "addTimestamp" ; Push event name + runelite_callback ; Invoke callback + pop_int ; Pop the id of the messageNode sconst "From " sload 1 sconst ":" sconst "privateChatSplitFrom" runelite_callback - join_string 3 + join_string 4 ; Add the timestamp to the message sload 0 iload 9 iload 10 @@ -401,12 +406,17 @@ LABEL330: jump LABEL407 LABEL351: iload 7 + iload 12 ; Load the id of the messageNode + sconst "" ; Push container for the timestamp + sconst "addTimestamp" ; Push event name + runelite_callback ; Invoke callback + pop_int ; Pop the id of the messageNode sconst "To " sload 1 sconst ":" sconst "privateChatSplitTo" runelite_callback - join_string 3 + join_string 4 ; Add the timestamp to the message sload 0 iload 9 iload 10 @@ -425,7 +435,13 @@ LABEL351: jump LABEL407 LABEL372: iload 7 - sload 0 + iload 12 ; Load the id of the messageNode + sconst "" ; Push a container for the timestamp + sconst "addTimestamp" ; Push event name + runelite_callback ; Invoke callback + pop_int ; Pop the id of the messageNode + sload 0 ; Load the log in/out message + join_string 2 ; Add the timestamp to the message iload 9 iload 10 iconst 10682368 From 37e025ed799f15739e0029dff5a3bbac2394c2d7 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 23 Oct 2019 10:03:30 -0400 Subject: [PATCH 31/63] client: update mockito Remove various unused stubbing detected by the newer Mockito version Update references to deprecated Matchers and MockitoJUnitRunner classes --- runelite-client/pom.xml | 4 +- .../client/chat/ChatMessageManagerTest.java | 4 +- .../client/config/ConfigManagerTest.java | 2 +- .../client/game/ItemVariationMappingTest.java | 2 +- .../client/plugins/PluginManagerTest.java | 2 +- .../attackstyles/AttackStylesPluginTest.java | 3 +- .../client/plugins/bank/BankPluginTest.java | 4 +- .../bank/ContainerCalculationTest.java | 4 +- .../plugins/cerberus/CerberusPluginTest.java | 2 +- .../chatcommands/ChatCommandsPluginTest.java | 4 +- .../chatfilter/ChatFilterPluginTest.java | 6 +-- .../ChatNotificationsPluginTest.java | 2 +- .../plugins/cooking/CookingPluginTest.java | 4 +- .../plugins/emojis/EmojiPluginTest.java | 2 +- .../plugins/examine/ExaminePluginTest.java | 6 +-- .../GrandExchangeOfferSlotTest.java | 2 +- .../idlenotifier/IdleNotifierPluginTest.java | 21 +++++----- .../itemcharges/ItemChargePluginTest.java | 4 +- .../ItemsKeptOnDeathPluginTest.java | 2 +- .../MenuEntrySwapperPluginTest.java | 4 +- .../motherlode/MotherlodePluginTest.java | 2 +- .../npchighlight/NpcIndicatorsPluginTest.java | 2 +- .../screenshot/ScreenshotPluginTest.java | 39 +++++++------------ .../plugins/slayer/SlayerPluginTest.java | 7 ++-- .../plugins/smelting/SmeltingPluginTest.java | 2 +- .../plugins/timers/TimersPluginTest.java | 3 +- .../timestamp/TimestampPluginTest.java | 2 +- .../wintertodt/WintertodtPluginTest.java | 2 +- .../xptracker/XpTrackerPluginTest.java | 5 +-- .../overlay/components/TextComponentTest.java | 6 +-- .../components/TooltipComponentTest.java | 2 +- 31 files changed, 65 insertions(+), 91 deletions(-) diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index a35b5065da..ebf7d9280f 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -222,8 +222,8 @@ org.mockito - mockito-all - 1.10.19 + mockito-core + 3.1.0 test diff --git a/runelite-client/src/test/java/net/runelite/client/chat/ChatMessageManagerTest.java b/runelite-client/src/test/java/net/runelite/client/chat/ChatMessageManagerTest.java index b6912fa959..24e3539106 100644 --- a/runelite-client/src/test/java/net/runelite/client/chat/ChatMessageManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/chat/ChatMessageManagerTest.java @@ -37,12 +37,12 @@ import net.runelite.client.config.ChatColorConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ChatMessageManagerTest diff --git a/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java b/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java index 63afbbd2a6..14e4b80f06 100644 --- a/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java @@ -39,7 +39,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ConfigManagerTest diff --git a/runelite-client/src/test/java/net/runelite/client/game/ItemVariationMappingTest.java b/runelite-client/src/test/java/net/runelite/client/game/ItemVariationMappingTest.java index ba67d6b9c2..64d4ec9454 100644 --- a/runelite-client/src/test/java/net/runelite/client/game/ItemVariationMappingTest.java +++ b/runelite-client/src/test/java/net/runelite/client/game/ItemVariationMappingTest.java @@ -31,7 +31,7 @@ import static net.runelite.api.ItemID.*; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ItemVariationMappingTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java index 93dbeff17c..99c85db67d 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java @@ -58,7 +58,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class PluginManagerTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java index 2060d0d536..f84e1fddad 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java @@ -46,7 +46,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class AttackStylesPluginTest @@ -161,7 +161,6 @@ public class AttackStylesPluginTest hideWidgetEvent.setKey("removeWarnedStyles"); hideWidgetEvent.setNewValue("false"); attackPlugin.onConfigChanged(hideWidgetEvent); - when(attackConfig.removeWarnedStyles()).thenReturn(false); // verify that the aggressive and accurate attack style widgets are no longer hidden assertFalse(attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4, diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/bank/BankPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/bank/BankPluginTest.java index 974b9dc248..bc9caff9da 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/bank/BankPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/bank/BankPluginTest.java @@ -44,7 +44,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class BankPluginTest @@ -80,8 +80,6 @@ public class BankPluginTest when(client.getItemContainer(InventoryID.BANK)).thenReturn(itemContainer); ItemComposition comp = mock(ItemComposition.class); - when(comp.getId()) - .thenReturn(itemId); // 60k HA price * 30 = 1.8m when(comp.getPrice()) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/bank/ContainerCalculationTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/bank/ContainerCalculationTest.java index 8697f78859..ca52a5bff2 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/bank/ContainerCalculationTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/bank/ContainerCalculationTest.java @@ -42,7 +42,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ContainerCalculationTest @@ -77,8 +77,6 @@ public class ContainerCalculationTest ).toArray(new Item[0]); ItemComposition whipComp = mock(ItemComposition.class); - when(whipComp.getId()) - .thenReturn(ItemID.ABYSSAL_WHIP); when(whipComp.getPrice()) .thenReturn(7); // 7 * .6 = 4, 4 * 1m overflows when(itemManager.getItemComposition(ItemID.ABYSSAL_WHIP)) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java index 4f35f7b174..e4289fa2f2 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java @@ -41,7 +41,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class CerberusPluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 70a4a98ec1..175fd22a41 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -38,11 +38,11 @@ import net.runelite.client.config.ConfigManager; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ChatCommandsPluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java index 1c9aa48601..9af09b1d63 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java @@ -40,7 +40,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ChatFilterPluginTest @@ -132,7 +132,7 @@ public class ChatFilterPluginTest @Test public void testMessageFromFriendIsFiltered() { - when(client.isFriended("Iron Mammal", false)).thenReturn(true); + when(client.isClanMember("Iron Mammal")).thenReturn(false); when(chatFilterConfig.filterFriends()).thenReturn(true); assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal")); } @@ -148,7 +148,7 @@ public class ChatFilterPluginTest @Test public void testMessageFromClanIsFiltered() { - when(client.isClanMember("B0aty")).thenReturn(true); + when(client.isFriended("B0aty", false)).thenReturn(false); when(chatFilterConfig.filterClan()).thenReturn(true); assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("B0aty")); } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java index 5eda571f9a..de7bbc6e26 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java @@ -45,7 +45,7 @@ import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ChatNotificationsPluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java index 1384eb908c..65e9cdd3ed 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java @@ -42,12 +42,12 @@ import static org.junit.Assert.assertNotNull; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class CookingPluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java index 5fd260b110..326ea07a38 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java @@ -43,7 +43,7 @@ import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java index de5c346980..dccf97258a 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java @@ -42,14 +42,14 @@ import net.runelite.http.api.examine.ExamineClient; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ExaminePluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlotTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlotTest.java index f947c81ba5..d2c4bc84c1 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlotTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlotTest.java @@ -34,7 +34,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class GrandExchangeOfferSlotTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java index f1f21f2898..0d4114e215 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java @@ -28,6 +28,7 @@ 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.Actor; import net.runelite.api.AnimationID; import net.runelite.api.Client; import net.runelite.api.GameState; @@ -46,16 +47,15 @@ import net.runelite.client.Notifier; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class IdleNotifierPluginTest @@ -195,13 +195,11 @@ public class IdleNotifierPluginTest @Test public void checkCombatReset() { - when(player.getInteracting()).thenReturn(monster); + when(player.getInteracting()).thenReturn(mock(Actor.class)); plugin.onInteractingChanged(new InteractingChanged(player, monster)); plugin.onGameTick(new GameTick()); - when(player.getInteracting()).thenReturn(randomEvent); plugin.onInteractingChanged(new InteractingChanged(player, randomEvent)); plugin.onGameTick(new GameTick()); - when(player.getInteracting()).thenReturn(null); plugin.onInteractingChanged(new InteractingChanged(player, null)); plugin.onGameTick(new GameTick()); verify(notifier, times(0)).notify(any()); @@ -211,7 +209,7 @@ public class IdleNotifierPluginTest public void checkCombatLogout() { plugin.onInteractingChanged(new InteractingChanged(player, monster)); - when(player.getInteracting()).thenReturn(monster); + when(player.getInteracting()).thenReturn(mock(Actor.class)); plugin.onGameTick(new GameTick()); // Logout @@ -226,7 +224,6 @@ public class IdleNotifierPluginTest plugin.onGameStateChanged(gameStateChanged); // Tick - when(player.getInteracting()).thenReturn(null); plugin.onInteractingChanged(new InteractingChanged(player, null)); plugin.onGameTick(new GameTick()); verify(notifier, times(0)).notify(any()); @@ -266,13 +263,13 @@ public class IdleNotifierPluginTest { when(config.getSpecEnergyThreshold()).thenReturn(50); - when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); // 40% + when(client.getVar(eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); // 40% plugin.onGameTick(new GameTick()); // once to set lastSpecEnergy to 400 verify(notifier, never()).notify(any()); - when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); // 50% + when(client.getVar(eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); // 50% plugin.onGameTick(new GameTick()); - verify(notifier).notify(Matchers.eq("[" + PLAYER_NAME + "] has restored spec energy!")); + verify(notifier).notify(eq("[" + PLAYER_NAME + "] has restored spec energy!")); } @Test diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java index 703b0a7c51..a769cc3784 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java @@ -43,13 +43,13 @@ import net.runelite.client.ui.overlay.OverlayManager; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ItemChargePluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPluginTest.java index 16d3d06016..d9e15ae9a7 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPluginTest.java @@ -46,7 +46,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ItemsKeptOnDeathPluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPluginTest.java index fd0fe86f91..d34331e209 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPluginTest.java @@ -40,13 +40,13 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import org.mockito.Mock; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; @RunWith(MockitoJUnitRunner.class) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java index 34df2247f3..6646ca5aad 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java @@ -47,7 +47,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class MotherlodePluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java index 87f69cceb3..6b20c0fc3a 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java @@ -38,7 +38,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class NpcIndicatorsPluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java index 9aff61c346..631e94dcde 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java @@ -40,7 +40,6 @@ import static net.runelite.api.widgets.WidgetID.DIALOG_SPRITE_GROUP_ID; import static net.runelite.api.widgets.WidgetID.LEVEL_UP_GROUP_ID; import static net.runelite.api.widgets.WidgetInfo.DIALOG_SPRITE_TEXT; import static net.runelite.api.widgets.WidgetInfo.LEVEL_UP_LEVEL; -import static net.runelite.api.widgets.WidgetInfo.PACK; import net.runelite.client.Notifier; import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.ui.ClientUI; @@ -49,12 +48,13 @@ import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ScreenshotPluginTest @@ -101,7 +101,6 @@ public class ScreenshotPluginTest public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - when(screenshotConfig.screenshotRewards()).thenReturn(true); when(screenshotConfig.screenshotLevels()).thenReturn(true); when(screenshotConfig.screenshotValuableDrop()).thenReturn(true); when(screenshotConfig.screenshotUntradeableDrop()).thenReturn(true); @@ -150,7 +149,7 @@ public class ScreenshotPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", VALUABLE_DROP, null, 0); screenshotPlugin.onChatMessage(chatMessageEvent); - verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); + verify(drawManager).requestNextFrameListener(any(Consumer.class)); } @Test @@ -159,17 +158,14 @@ public class ScreenshotPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", UNTRADEABLE_DROP, null, 0); screenshotPlugin.onChatMessage(chatMessageEvent); - verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); + verify(drawManager).requestNextFrameListener(any(Consumer.class)); } @Test public void testHitpointsLevel99() { - Widget widget = mock(Widget.class); - when(widget.getId()).thenReturn(PACK(LEVEL_UP_GROUP_ID, 0)); - Widget levelChild = mock(Widget.class); - when(client.getWidget(Matchers.eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); + when(client.getWidget(eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); when(levelChild.getText()).thenReturn("Your Hitpoints are now 99."); @@ -182,17 +178,14 @@ public class ScreenshotPluginTest GameTick tick = new GameTick(); screenshotPlugin.onGameTick(tick); - verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); + verify(drawManager).requestNextFrameListener(any(Consumer.class)); } @Test public void testFiremakingLevel9() { - Widget widget = mock(Widget.class); - when(widget.getId()).thenReturn(PACK(LEVEL_UP_GROUP_ID, 0)); - Widget levelChild = mock(Widget.class); - when(client.getWidget(Matchers.eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); + when(client.getWidget(eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); when(levelChild.getText()).thenReturn("Your Firemaking level is now 9."); @@ -205,17 +198,14 @@ public class ScreenshotPluginTest GameTick tick = new GameTick(); screenshotPlugin.onGameTick(tick); - verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); + verify(drawManager).requestNextFrameListener(any(Consumer.class)); } @Test public void testAttackLevel70() { - Widget widget = mock(Widget.class); - when(widget.getId()).thenReturn(PACK(LEVEL_UP_GROUP_ID, 0)); - Widget levelChild = mock(Widget.class); - when(client.getWidget(Matchers.eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); + when(client.getWidget(eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); when(levelChild.getText()).thenReturn("Your Attack level is now 70."); @@ -228,17 +218,14 @@ public class ScreenshotPluginTest GameTick tick = new GameTick(); screenshotPlugin.onGameTick(tick); - verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); + verify(drawManager).requestNextFrameListener(any(Consumer.class)); } @Test public void testHunterLevel2() { - Widget widget = mock(Widget.class); - when(widget.getId()).thenReturn(PACK(DIALOG_SPRITE_GROUP_ID, 0)); - Widget levelChild = mock(Widget.class); - when(client.getWidget(Matchers.eq(DIALOG_SPRITE_TEXT))).thenReturn(levelChild); + when(client.getWidget(eq(DIALOG_SPRITE_TEXT))).thenReturn(levelChild); when(levelChild.getText()).thenReturn("Congratulations, you've just advanced a Hunter level.

Your Hunter level is now 2."); @@ -251,6 +238,6 @@ public class ScreenshotPluginTest GameTick tick = new GameTick(); screenshotPlugin.onGameTick(tick); - verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class)); + verify(drawManager).requestNextFrameListener(any(Consumer.class)); } } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java index 2781ddbb16..fb7e705877 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 @@ -55,15 +55,15 @@ import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class SlayerPluginTest @@ -710,7 +710,6 @@ public class SlayerPluginTest public void infoboxNotAddedOnLogin() { when(slayerConfig.taskName()).thenReturn(Task.BLOODVELD.getName()); - when(slayerConfig.showInfobox()).thenReturn(true); GameStateChanged loggingIn = new GameStateChanged(); loggingIn.setGameState(GameState.LOGGING_IN); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/smelting/SmeltingPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/smelting/SmeltingPluginTest.java index 1c8573f26c..581307f27f 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/smelting/SmeltingPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/smelting/SmeltingPluginTest.java @@ -37,7 +37,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class SmeltingPluginTest 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 618ad296c1..976b0e2970 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 @@ -45,7 +45,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class TimersPluginTest @@ -114,7 +114,6 @@ public class TimersPluginTest public void testDmmHalfTb() { when(timersConfig.showTeleblock()).thenReturn(true); - when(client.getWorldType()).thenReturn(EnumSet.of(WorldType.DEADMAN)); ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", DMM_HALF_TELEBLOCK_MESSAGE, "", 0); timersPlugin.onChatMessage(chatMessage); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timestamp/TimestampPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timestamp/TimestampPluginTest.java index e9033043cf..7520de61fd 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timestamp/TimestampPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/timestamp/TimestampPluginTest.java @@ -37,7 +37,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class TimestampPluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/wintertodt/WintertodtPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/wintertodt/WintertodtPluginTest.java index 7069d4f06a..3abf2f919f 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/wintertodt/WintertodtPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/wintertodt/WintertodtPluginTest.java @@ -42,7 +42,7 @@ import org.mockito.Mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class WintertodtPluginTest diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/xptracker/XpTrackerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/xptracker/XpTrackerPluginTest.java index 372b51d9ed..5c1724b1e5 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/xptracker/XpTrackerPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/xptracker/XpTrackerPluginTest.java @@ -27,13 +27,11 @@ package net.runelite.client.plugins.xptracker; import com.google.inject.Guice; import com.google.inject.testing.fieldbinder.Bind; import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.EnumSet; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.Player; import net.runelite.api.Skill; -import net.runelite.api.WorldType; import net.runelite.api.events.ExperienceChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; @@ -48,7 +46,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class XpTrackerPluginTest @@ -85,7 +83,6 @@ public class XpTrackerPluginTest { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - when(client.getWorldType()).thenReturn(EnumSet.of(WorldType.MEMBERS)); when(client.getLocalPlayer()).thenReturn(mock(Player.class)); xpTrackerPlugin.setXpPanel(mock(XpPanel.class)); diff --git a/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TextComponentTest.java b/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TextComponentTest.java index 067205bd3b..d30b04f681 100644 --- a/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TextComponentTest.java +++ b/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TextComponentTest.java @@ -30,15 +30,15 @@ import java.awt.Graphics2D; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class TextComponentTest diff --git a/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TooltipComponentTest.java b/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TooltipComponentTest.java index f50bf45530..3248b345f8 100644 --- a/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TooltipComponentTest.java +++ b/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/TooltipComponentTest.java @@ -28,7 +28,7 @@ import java.awt.FontMetrics; import static net.runelite.client.ui.overlay.components.TooltipComponent.calculateTextWidth; import static org.junit.Assert.assertEquals; import org.junit.Test; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; From fcbd26bbc9531febaf7171b9c391530e088d17bc Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 11 Oct 2019 20:11:24 +0100 Subject: [PATCH 32/63] menu entry swapper: add shift click teleport spell swap Co-authored-by: Adam --- .../MenuEntrySwapperConfig.java | 10 ++++ .../MenuEntrySwapperPlugin.java | 32 +++++++++++ .../MenuEntrySwapperPluginTest.java | 54 +++++++++++++++++++ 3 files changed, 96 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index e687522286..13f780a823 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -311,4 +311,14 @@ public interface MenuEntrySwapperConfig extends Config { return true; } + + @ConfigItem( + keyName = "swapTeleportSpell", + name = "Shift-click teleport spells", + description = "Swap teleport spells that have a second destination on shift" + ) + default boolean swapTeleportSpell() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index d19b47455f..91fddefb66 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -604,6 +604,38 @@ public class MenuEntrySwapperPlugin extends Plugin { swap("use", option, target, index); } + + if (shiftModifier && config.swapTeleportSpell()) + { + if (target.equals("varrock teleport")) + { + swapTeleport(target, option, "grand exchange", index); + } + else if (target.equals("camelot teleport")) + { + swapTeleport(target, option, "seers'", index); + } + else if (target.equals("watchtower teleport")) + { + swapTeleport(target, option, "yanille", index); + } + else if (target.equals("teleport to house")) + { + swapTeleport(target, option, "outside", index); + } + } + } + + private void swapTeleport(String target, String option, String optionA, int index) + { + if (option.equals("cast")) + { + swap(optionA, option, target, index); + } + else if (option.equals(optionA)) + { + swap("cast", option, target, index); + } } private static boolean shouldSwapPickpocket(String target) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPluginTest.java index d34331e209..19b101c931 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPluginTest.java @@ -42,6 +42,7 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import static org.mockito.ArgumentMatchers.any; import org.mockito.Mock; +import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -209,4 +210,57 @@ public class MenuEntrySwapperPluginTest menu("Pay (north)", "Kragen", MenuAction.NPC_THIRD_OPTION), }, argumentCaptor.getValue()); } + + @Test + public void testTeleport() + { + when(config.swapTeleportSpell()).thenReturn(true); + menuEntrySwapperPlugin.setShiftModifier(true); + + // Cast -> Grand Exchange + entries = new MenuEntry[]{ + menu("Cancel", "", MenuAction.CANCEL), + + menu("Configure", "Varrock Teleport", MenuAction.WIDGET_THIRD_OPTION), + menu("Grand Exchange", "Varrock Teleport", MenuAction.WIDGET_SECOND_OPTION), + menu("Cast", "Varrock Teleport", MenuAction.WIDGET_FIRST_OPTION), + }; + + menuEntrySwapperPlugin.onClientTick(new ClientTick()); + + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class); + verify(client).setMenuEntries(argumentCaptor.capture()); + + assertArrayEquals(new MenuEntry[]{ + menu("Cancel", "", MenuAction.CANCEL), + + menu("Configure", "Varrock Teleport", MenuAction.WIDGET_THIRD_OPTION), + menu("Cast", "Varrock Teleport", MenuAction.WIDGET_FIRST_OPTION), + menu("Grand Exchange", "Varrock Teleport", MenuAction.WIDGET_SECOND_OPTION), + }, argumentCaptor.getValue()); + + clearInvocations(client); + + // Grand Exchange -> Cast + entries = new MenuEntry[]{ + menu("Cancel", "", MenuAction.CANCEL), + + menu("Configure", "Varrock Teleport", MenuAction.WIDGET_THIRD_OPTION), + menu("Cast", "Varrock Teleport", MenuAction.WIDGET_SECOND_OPTION), + menu("Grand Exchange", "Varrock Teleport", MenuAction.WIDGET_FIRST_OPTION), + }; + + menuEntrySwapperPlugin.onClientTick(new ClientTick()); + + argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class); + verify(client).setMenuEntries(argumentCaptor.capture()); + + assertArrayEquals(new MenuEntry[]{ + menu("Cancel", "", MenuAction.CANCEL), + + menu("Configure", "Varrock Teleport", MenuAction.WIDGET_THIRD_OPTION), + menu("Grand Exchange", "Varrock Teleport", MenuAction.WIDGET_FIRST_OPTION), + menu("Cast", "Varrock Teleport", MenuAction.WIDGET_SECOND_OPTION), + }, argumentCaptor.getValue()); + } } \ No newline at end of file From 45c0774093ce9d105a45d46754c4beb518d208b4 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Thu, 24 Oct 2019 06:47:13 +0200 Subject: [PATCH 33/63] project: volumes support --- .../main/java/net/runelite/api/Client.java | 36 +++ .../runelite/api/events/VolumeChanged.java | 35 +++ .../client/plugins/music/MusicConfig.java | 89 ++++++ .../MusicPlugin.java} | 266 +++++++++++++++++- .../net/runelite/mixins/RSClientMixin.java | 11 +- .../java/net/runelite/rs/api/RSClient.java | 21 ++ .../net/runelite/rs/api/RSScriptEvent.java | 3 + .../java/net/runelite/rs/api/RSWidget.java | 16 ++ runescape-client/src/main/java/Client.java | 16 +- .../src/main/java/ClientPacket.java | 4 +- ...dExchangeOfferTotalQuantityComparator.java | 2 +- .../src/main/java/HealthBarUpdate.java | 6 +- .../src/main/java/InvDefinition.java | 4 +- .../src/main/java/KeyHandler.java | 2 +- .../src/main/java/MusicPatchNode2.java | 4 +- runescape-client/src/main/java/NetSocket.java | 19 +- runescape-client/src/main/java/class3.java | 4 +- runescape-client/src/main/java/class30.java | 2 +- 18 files changed, 496 insertions(+), 44 deletions(-) create mode 100644 runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java rename runelite-client/src/main/java/net/runelite/client/plugins/{musiclist/MusicListPlugin.java => music/MusicPlugin.java} (55%) 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 d7bd5efcc1..a12a2bec3f 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -952,6 +952,42 @@ public interface Client extends GameShell */ List getGraphicsObjects(); + /** + * Gets the music volume + * @return volume 0-255 inclusive + */ + int getMusicVolume(); + + /** + * Sets the music volume + * @param volume 0-255 inclusive + */ + void setMusicVolume(int volume); + + /** + * Gets the sound effect volume + * @return volume 0-127 inclusive + */ + int getSoundEffectVolume(); + + /** + * Sets the sound effect volume + * @param volume 0-127 inclusive + */ + void setSoundEffectVolume(int volume); + + /** + * Gets the area sound effect volume + * @return volume 0-127 inclusive + */ + int getAreaSoundEffectVolume(); + + /** + * Sets the area sound effect volume + * @param volume 0-127 inclusive + */ + void setAreaSoundEffectVolume(int volume); + /** * Play a sound effect at the player's current location. This is how UI, * and player-generated (e.g. mining, woodcutting) sound effects are diff --git a/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java new file mode 100644 index 0000000000..7f846cd214 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.events; + +public class VolumeChanged implements Event +{ + public static final VolumeChanged INSTANCE = new VolumeChanged(); + + private VolumeChanged() + { + // noop + } +} 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 new file mode 100644 index 0000000000..fa2ebbcbbd --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2019, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.music; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("music") +public interface MusicConfig extends Config +{ + @ConfigItem( + keyName = "musicVolume", + name = "", + description = "", + hidden = true + ) + default int getMusicVolume() + { + return 0; + } + + @ConfigItem( + keyName = "musicVolume", + name = "", + description = "", + hidden = true + ) + 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 = "", + description = "", + hidden = true + ) + void setAreaSoundEffectVolume(int vol); +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/musiclist/MusicListPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java similarity index 55% rename from runelite-client/src/main/java/net/runelite/client/plugins/musiclist/MusicListPlugin.java rename to runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java index 63bcb717ad..5d251e19ae 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/musiclist/MusicListPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2019, Anthony Chen + * Copyright (c) 2019, Adam * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,33 +23,43 @@ * (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.musiclist; +package net.runelite.client.plugins.music; +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 javax.inject.Singleton; import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; 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.vars.InterfaceTab; import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetConfig; import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetPositionMode; import net.runelite.api.widgets.WidgetType; import net.runelite.client.callback.ClientThread; +import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.EventBus; import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.game.chatbox.ChatboxTextInput; @@ -56,11 +67,11 @@ import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @PluginDescriptor( - name = "Music List", - description = "Adds search and filter for the music list" + name = "Music", + description = "Adds search and filter for the music list, and additional volume control" ) -@Singleton -public class MusicListPlugin extends Plugin +@Slf4j +public class MusicPlugin extends Plugin { @Inject private Client client; @@ -68,6 +79,9 @@ public class MusicListPlugin extends Plugin @Inject private ClientThread clientThread; + @Inject + private MusicConfig musicConfig; + @Inject private ChatboxPanelManager chatboxPanelManager; @@ -88,14 +102,17 @@ public class MusicListPlugin extends Plugin { addSubscriptions(); - clientThread.invoke(this::addMusicButtons); + clientThread.invoke(() -> + { + addMusicButtons(); + applyMusicVolumeConfig(); + updateMusicOptions(); + }); } @Override protected void shutDown() { - eventBus.unregister(this); - Widget header = client.getWidget(WidgetInfo.MUSIC_WINDOW); if (header != null) { @@ -103,13 +120,24 @@ public class MusicListPlugin extends Plugin } tracks = null; + + clientThread.invoke(this::teardownMusicOptions); + } + + @Provides + MusicConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(MusicConfig.class); } private void addSubscriptions() { + eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded); eventBus.subscribe(VarClientIntChanged.class, this, this::onVarClientIntChanged); + eventBus.subscribe(VolumeChanged.class, this, this::onVolumeChanged); + eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent); } private void onGameStateChanged(GameStateChanged gameStateChanged) @@ -132,6 +160,10 @@ public class MusicListPlugin extends Plugin currentMusicFilter = MusicState.ALL; addMusicButtons(); } + if (widgetLoaded.getGroupId() == WidgetID.OPTIONS_GROUP_ID) + { + updateMusicOptions(); + } } private void addMusicButtons() @@ -181,9 +213,48 @@ public class MusicListPlugin extends Plugin } } + + private void onVolumeChanged(VolumeChanged volumeChanged) + { + applyMusicVolumeConfig(); + } + + private void onConfigChanged(ConfigChanged configChanged) + { + if (configChanged.getGroup().equals("music")) + { + clientThread.invokeLater(this::applyMusicVolumeConfig); + } + } + + private void applyMusicVolumeConfig() + { + log.info("applyMusicVolumeConfig"); + + int musicVolume = musicConfig.getMusicVolume(); + if (musicVolume > 0) + { + client.setMusicVolume(musicVolume - 1); + } + + int soundEffectVolume = musicConfig.getSoundEffectVolume(); + if (soundEffectVolume > 0) + { + client.setSoundEffectVolume(soundEffectVolume - 1); + } + + int areaSoundEffectVolume = musicConfig.getAreaSoundEffectVolume(); + if (areaSoundEffectVolume > 0) + { + client.setAreaSoundEffectVolume(areaSoundEffectVolume - 1); + } + + updateMusicOptions(); + } + private boolean isOnMusicTab() { - return client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.MUSIC.getId(); + return client.getVar(VarClientInt.INTERFACE_TAB) == 13; } private boolean isChatboxOpen() @@ -304,4 +375,175 @@ public class MusicListPlugin 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(); + } + } + + private 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-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index e9e82eabaa..dd6457fe6d 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -50,6 +50,7 @@ import net.runelite.api.Ignore; import net.runelite.api.IndexDataBase; import net.runelite.api.IndexedSprite; import net.runelite.api.InventoryID; +import net.runelite.api.MenuEntry; import net.runelite.api.MenuOpcode; import static net.runelite.api.MenuOpcode.PLAYER_EIGTH_OPTION; import static net.runelite.api.MenuOpcode.PLAYER_FIFTH_OPTION; @@ -59,7 +60,6 @@ import static net.runelite.api.MenuOpcode.PLAYER_SECOND_OPTION; import static net.runelite.api.MenuOpcode.PLAYER_SEVENTH_OPTION; import static net.runelite.api.MenuOpcode.PLAYER_SIXTH_OPTION; import static net.runelite.api.MenuOpcode.PLAYER_THIRD_OPTION; -import net.runelite.api.MenuEntry; import net.runelite.api.MessageNode; import net.runelite.api.NPC; import net.runelite.api.Node; @@ -98,6 +98,7 @@ import net.runelite.api.events.PlayerSpawned; import net.runelite.api.events.ResizeableChanged; import net.runelite.api.events.UsernameChanged; import net.runelite.api.events.VarbitChanged; +import net.runelite.api.events.VolumeChanged; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.events.WidgetPressed; import net.runelite.api.hooks.Callbacks; @@ -1760,7 +1761,6 @@ public abstract class RSClientMixin implements RSClient return modulus; } - @Inject @Override public void setModulus(BigInteger modulus) @@ -1783,4 +1783,11 @@ public abstract class RSClientMixin implements RSClient client.promptCredentials(true); } } + + @Inject + @MethodHook("changeGameOptions") + public static void changeGameOptions(int var0) + { + client.getCallbacks().post(VolumeChanged.class, VolumeChanged.INSTANCE); + } } \ No newline at end of file diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index a0e6506b08..d068563f23 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -1038,9 +1038,30 @@ public interface RSClient extends RSGameShell, Client @Import("decimator") RSDecimator getSoundEffectResampler(); + @Import("musicVolume") + @Override + int getMusicVolume(); + + @Import("musicVolume") + @Override + void setMusicVolume(int volume); + + @Import("areaSoundEffectVolume") + @Override + int getAreaSoundEffectVolume(); + + @Import("areaSoundEffectVolume") + @Override + void setAreaSoundEffectVolume(int volume); + @Import("soundEffectVolume") + @Override int getSoundEffectVolume(); + @Import("soundEffectVolume") + @Override + void setSoundEffectVolume(int volume); + @Import("viewportWalking") void setViewportWalking(boolean viewportWalking); diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSScriptEvent.java b/runescape-api/src/main/java/net/runelite/rs/api/RSScriptEvent.java index 06a79327fa..49621b123d 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSScriptEvent.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSScriptEvent.java @@ -20,4 +20,7 @@ public interface RSScriptEvent extends ScriptEvent @Import("targetName") String getOpbase(); + + @Import("mouseX") + int getMouseX(); } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java b/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java index 8965d2e348..f292e9c117 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java @@ -496,4 +496,20 @@ public interface RSWidget extends Widget @Import("getSprite") RSSprite getSprite(boolean b); + + @Import("onRelease") + @Override + void setOnReleaseListener(Object[] o); + + @Import("varTransmitTriggers") + @Override + void setVarTransmitTrigger(int[] i); + + @Import("onHold") + @Override + void setOnHoldListener(Object[] o); + + @Import("onClick") + @Override + void setOnClickListener(Object[] o); } diff --git a/runescape-client/src/main/java/Client.java b/runescape-client/src/main/java/Client.java index f4f8b09f7c..5abeff1ee4 100644 --- a/runescape-client/src/main/java/Client.java +++ b/runescape-client/src/main/java/Client.java @@ -213,7 +213,8 @@ public final class Client extends GameShell implements Usernamed { @ObfuscatedGetter( intValue = 892519291 ) - static int field868; + @Export("areaSoundEffectVolume") + static int areaSoundEffectVolume; @ObfuscatedName("no") static int[] field820; @ObfuscatedName("nb") @@ -363,7 +364,8 @@ public final class Client extends GameShell implements Usernamed { @ObfuscatedGetter( intValue = -114703177 ) - static int field761; + @Export("musicVolume") + static int musicVolume; @ObfuscatedName("pu") @Export("mapIconYs") static int[] mapIconYs; @@ -1508,11 +1510,11 @@ public final class Client extends GameShell implements Usernamed { destinationX = 0; destinationY = 0; minimapState = 0; - field761 = 255; + musicVolume = 255; field666 = -1; field759 = false; soundEffectVolume = 127; - field868 = 127; + areaSoundEffectVolume = 127; soundEffectCount = 0; soundEffectIds = new int[50]; queuedSoundEffectLoops = new int[50]; @@ -4282,7 +4284,7 @@ public final class Client extends GameShell implements Usernamed { Varps.Varps_main[var5] = var16; } - NetSocket.method3472(var5); + NetSocket.changeGameOptions(var5); field782[++field823 - 1 & 31] = var5; var1.serverPacket = null; return true; @@ -4738,7 +4740,7 @@ public final class Client extends GameShell implements Usernamed { Varps.Varps_main[var16] = var40; } - NetSocket.method3472(var16); + NetSocket.changeGameOptions(var16); field782[++field823 - 1 & 31] = var16; var1.serverPacket = null; return true; @@ -4795,7 +4797,7 @@ public final class Client extends GameShell implements Usernamed { for (var16 = 0; var16 < Varps.Varps_main.length; ++var16) { if (Varps.Varps_temp[var16] != Varps.Varps_main[var16]) { Varps.Varps_main[var16] = Varps.Varps_temp[var16]; - NetSocket.method3472(var16); + NetSocket.changeGameOptions(var16); field782[++field823 - 1 & 31] = var16; } } diff --git a/runescape-client/src/main/java/ClientPacket.java b/runescape-client/src/main/java/ClientPacket.java index 4ff2dfbd93..1aa118148e 100644 --- a/runescape-client/src/main/java/ClientPacket.java +++ b/runescape-client/src/main/java/ClientPacket.java @@ -704,8 +704,8 @@ public class ClientPacket implements class181 { ) @Export("playSoundJingle") static void playSoundJingle(int var0, int var1) { - if (Client.field761 != 0 && var0 != -1) { - class83.method2068(ClanMate.archive11, var0, 0, Client.field761, false); + if (Client.musicVolume != 0 && var0 != -1) { + class83.method2068(ClanMate.archive11, var0, 0, Client.musicVolume, false); Client.field759 = true; } diff --git a/runescape-client/src/main/java/GrandExchangeOfferTotalQuantityComparator.java b/runescape-client/src/main/java/GrandExchangeOfferTotalQuantityComparator.java index d72e0548e2..e43f97006f 100644 --- a/runescape-client/src/main/java/GrandExchangeOfferTotalQuantityComparator.java +++ b/runescape-client/src/main/java/GrandExchangeOfferTotalQuantityComparator.java @@ -308,7 +308,7 @@ final class GrandExchangeOfferTotalQuantityComparator implements Comparator { var9 = var1.method5511(); if (var38 >= 0 && var4 >= 0 && var38 < 104 && var4 < 104) { var10 = var6 + 1; - if (class223.localPlayer.pathX[0] >= var38 - var10 && class223.localPlayer.pathX[0] <= var10 + var38 && class223.localPlayer.pathY[0] >= var4 - var10 && class223.localPlayer.pathY[0] <= var10 + var4 && Client.field868 != 0 && var7 > 0 && Client.soundEffectCount < 50) { + if (class223.localPlayer.pathX[0] >= var38 - var10 && class223.localPlayer.pathX[0] <= var10 + var38 && class223.localPlayer.pathY[0] >= var4 - var10 && class223.localPlayer.pathY[0] <= var10 + var4 && Client.areaSoundEffectVolume != 0 && var7 > 0 && Client.soundEffectCount < 50) { Client.soundEffectIds[Client.soundEffectCount] = var8; Client.queuedSoundEffectLoops[Client.soundEffectCount] = var7; Client.queuedSoundEffectDelays[Client.soundEffectCount] = var9; diff --git a/runescape-client/src/main/java/HealthBarUpdate.java b/runescape-client/src/main/java/HealthBarUpdate.java index 4808e17910..f708052a85 100644 --- a/runescape-client/src/main/java/HealthBarUpdate.java +++ b/runescape-client/src/main/java/HealthBarUpdate.java @@ -113,7 +113,7 @@ public class HealthBarUpdate extends Node { var8 = 0; } - var2 = (var3 - var8) * Client.field868 / var3; + var2 = (var3 - var8) * Client.areaSoundEffectVolume / var3; } else { var2 = Client.soundEffectVolume; } @@ -151,8 +151,8 @@ public class HealthBarUpdate extends Node { } if (!var12) { - if (Client.field761 != 0 && Client.field666 != -1) { - class83.method2068(class225.archive6, Client.field666, 0, Client.field761, false); + if (Client.musicVolume != 0 && Client.field666 != -1) { + class83.method2068(class225.archive6, Client.field666, 0, Client.musicVolume, false); } Client.field759 = false; diff --git a/runescape-client/src/main/java/InvDefinition.java b/runescape-client/src/main/java/InvDefinition.java index 79415563b7..1417e54281 100644 --- a/runescape-client/src/main/java/InvDefinition.java +++ b/runescape-client/src/main/java/InvDefinition.java @@ -437,7 +437,7 @@ public class InvDefinition extends DualNode { if (var14.cs1Instructions != null && var14.cs1Instructions[0][0] == 5) { int var12 = var14.cs1Instructions[0][1]; Varps.Varps_main[var12] = 1 - Varps.Varps_main[var12]; - NetSocket.method3472(var12); + NetSocket.changeGameOptions(var12); } } else if (opcode == 29) { PacketBufferNode var8 = InterfaceParent.getPacketBufferNode(ClientPacket.field2261, Client.packetWriter.isaacCipher); @@ -448,7 +448,7 @@ public class InvDefinition extends DualNode { int var12 = var14.cs1Instructions[0][1]; if (Varps.Varps_main[var12] != var14.cs1ComparisonValues[0]) { Varps.Varps_main[var12] = var14.cs1ComparisonValues[0]; - NetSocket.method3472(var12); + NetSocket.changeGameOptions(var12); } } } else if (opcode == 30) { diff --git a/runescape-client/src/main/java/KeyHandler.java b/runescape-client/src/main/java/KeyHandler.java index 515a356c44..27f2ff0577 100644 --- a/runescape-client/src/main/java/KeyHandler.java +++ b/runescape-client/src/main/java/KeyHandler.java @@ -320,7 +320,7 @@ public final class KeyHandler implements KeyListener, FocusListener { } else if (var29 == ScriptOpcodes.SET_VARP) { var11 = var6[var17]; Varps.Varps_main[var11] = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; - NetSocket.method3472(var11); + NetSocket.changeGameOptions(var11); } else if (var29 == ScriptOpcodes.SCONST) { Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = var3.stringOperands[var17]; } else if (var29 == ScriptOpcodes.JUMP) { diff --git a/runescape-client/src/main/java/MusicPatchNode2.java b/runescape-client/src/main/java/MusicPatchNode2.java index fa0eca9746..a5e9bec39c 100644 --- a/runescape-client/src/main/java/MusicPatchNode2.java +++ b/runescape-client/src/main/java/MusicPatchNode2.java @@ -64,9 +64,9 @@ public class MusicPatchNode2 { static void playSong(int var0) { if (var0 == -1 && !Client.field759) { VertexNormal.method2960(); - } else if (var0 != -1 && var0 != Client.field666 && Client.field761 != 0 && !Client.field759) { + } else if (var0 != -1 && var0 != Client.field666 && Client.musicVolume != 0 && !Client.field759) { Archive var1 = class225.archive6; - int var2 = Client.field761; + int var2 = Client.musicVolume; class197.field2386 = 1; class197.musicTrackArchive = var1; class188.musicTrackGroupId = var0; diff --git a/runescape-client/src/main/java/NetSocket.java b/runescape-client/src/main/java/NetSocket.java index be0b0995ae..42a66bbe21 100644 --- a/runescape-client/src/main/java/NetSocket.java +++ b/runescape-client/src/main/java/NetSocket.java @@ -378,7 +378,8 @@ public final class NetSocket extends AbstractSocket implements Runnable { signature = "(II)V", garbageValue = "-1514465632" ) - static final void method3472(int var0) { + @Export("changeGameOptions") + static final void changeGameOptions(int var0) { class325.method6190(); for (ObjectSound var1 = (ObjectSound)ObjectSound.objectSounds.last(); var1 != null; var1 = (ObjectSound)ObjectSound.objectSounds.previous()) { @@ -436,8 +437,8 @@ public final class NetSocket extends AbstractSocket implements Runnable { var3 = 0; } - if (var3 != Client.field761) { - if (Client.field761 == 0 && Client.field666 != -1) { + if (var3 != Client.musicVolume) { + if (Client.musicVolume == 0 && Client.field666 != -1) { class83.method2068(class225.archive6, Client.field666, 0, var3, false); Client.field759 = false; } else if (var3 == 0) { @@ -449,7 +450,7 @@ public final class NetSocket extends AbstractSocket implements Runnable { class49.midiPcmStream.method3760(var3); } - Client.field761 = var3; + Client.musicVolume = var3; } } @@ -489,23 +490,23 @@ public final class NetSocket extends AbstractSocket implements Runnable { if (var4 == 10) { if (var2 == 0) { - Client.field868 = 127; + Client.areaSoundEffectVolume = 127; } if (var2 == 1) { - Client.field868 = 96; + Client.areaSoundEffectVolume = 96; } if (var2 == 2) { - Client.field868 = 64; + Client.areaSoundEffectVolume = 64; } if (var2 == 3) { - Client.field868 = 32; + Client.areaSoundEffectVolume = 32; } if (var2 == 4) { - Client.field868 = 0; + Client.areaSoundEffectVolume = 0; } } diff --git a/runescape-client/src/main/java/class3.java b/runescape-client/src/main/java/class3.java index 0b53609bd4..af233e8cc4 100644 --- a/runescape-client/src/main/java/class3.java +++ b/runescape-client/src/main/java/class3.java @@ -167,13 +167,13 @@ public class class3 implements Enumerated { var5 += var4.y * 128 - var2; } - if (var5 - 64 <= var4.field1061 && Client.field868 != 0 && var0 == var4.plane) { + if (var5 - 64 <= var4.field1061 && Client.areaSoundEffectVolume != 0 && var0 == var4.plane) { var5 -= 64; if (var5 < 0) { var5 = 0; } - int var6 = (var4.field1061 - var5) * Client.field868 / var4.field1061; + int var6 = (var4.field1061 - var5) * Client.areaSoundEffectVolume / var4.field1061; if (var4.stream1 == null) { if (var4.soundEffectId >= 0) { SoundEffect var7 = SoundEffect.readSoundEffect(GrandExchangeOfferAgeComparator.archive4, var4.soundEffectId, 0); diff --git a/runescape-client/src/main/java/class30.java b/runescape-client/src/main/java/class30.java index 32c030e4b6..6c4842bfeb 100644 --- a/runescape-client/src/main/java/class30.java +++ b/runescape-client/src/main/java/class30.java @@ -122,7 +122,7 @@ public class class30 { ) @Export("addSequenceSoundEffect") static void addSequenceSoundEffect(SequenceDefinition var0, int var1, int var2, int var3) { - if (Client.soundEffectCount < 50 && Client.field868 != 0) { + if (Client.soundEffectCount < 50 && Client.areaSoundEffectVolume != 0) { if (var0.soundEffects != null && var1 < var0.soundEffects.length) { int var4 = var0.soundEffects[var1]; if (var4 != 0) { From 6a8fbf9868e41bff3f7dc9975189520b452d613e Mon Sep 17 00:00:00 2001 From: Lucwousin Date: Thu, 24 Oct 2019 10:10:08 +0200 Subject: [PATCH 34/63] Narrow down onVolumeChanged to only volume changed's --- .../java/net/runelite/mixins/RSClientMixin.java | 17 ++++++++++++++--- .../main/java/net/runelite/rs/api/RSClient.java | 3 +++ .../net/runelite/rs/api/RSVarpDefinition.java | 9 +++++++++ .../src/main/java/AbstractWorldMapData.java | 3 ++- runescape-client/src/main/java/Client.java | 4 ++-- runescape-client/src/main/java/NetSocket.java | 2 +- 6 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 runescape-api/src/main/java/net/runelite/rs/api/RSVarpDefinition.java diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index dd6457fe6d..3886e59522 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1784,10 +1784,21 @@ public abstract class RSClientMixin implements RSClient } } - @Inject - @MethodHook("changeGameOptions") + @Copy("changeGameOptions") + public static void rs$changeGameOptions(int var0) + { + throw new RuntimeException(); + } + + @Replace("changeGameOptions") public static void changeGameOptions(int var0) { - client.getCallbacks().post(VolumeChanged.class, VolumeChanged.INSTANCE); + rs$changeGameOptions(var0); + + int type = client.getVarpDefinition(var0).getType(); + if (type == 3 || type == 4 || type == 10) + { + client.getCallbacks().post(VolumeChanged.class, VolumeChanged.INSTANCE); + } } } \ No newline at end of file diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index d068563f23..d6ea54f4df 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -1117,4 +1117,7 @@ public interface RSClient extends RSGameShell, Client */ @Import("Login_promptCredentials") void promptCredentials(boolean clearPass); + + @Import("VarpDefinition_get") + RSVarpDefinition getVarpDefinition(int id); } \ No newline at end of file diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSVarpDefinition.java b/runescape-api/src/main/java/net/runelite/rs/api/RSVarpDefinition.java new file mode 100644 index 0000000000..8661abed13 --- /dev/null +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSVarpDefinition.java @@ -0,0 +1,9 @@ +package net.runelite.rs.api; + +import net.runelite.mapping.Import; + +public interface RSVarpDefinition extends RSDualNode +{ + @Import("type") + int getType(); +} diff --git a/runescape-client/src/main/java/AbstractWorldMapData.java b/runescape-client/src/main/java/AbstractWorldMapData.java index efdefeec98..0c2c508ce5 100644 --- a/runescape-client/src/main/java/AbstractWorldMapData.java +++ b/runescape-client/src/main/java/AbstractWorldMapData.java @@ -245,7 +245,8 @@ public abstract class AbstractWorldMapData { signature = "(IB)Liq;", garbageValue = "1" ) - public static VarpDefinition method288(int var0) { + @Export("VarpDefinition_get") + public static VarpDefinition VarpDefinition_get(int var0) { VarpDefinition var1 = (VarpDefinition)VarpDefinition.VarpDefinition_cached.get((long)var0); if (var1 != null) { return var1; diff --git a/runescape-client/src/main/java/Client.java b/runescape-client/src/main/java/Client.java index 5abeff1ee4..ed958509cf 100644 --- a/runescape-client/src/main/java/Client.java +++ b/runescape-client/src/main/java/Client.java @@ -2680,7 +2680,7 @@ public final class Client extends GameShell implements Usernamed { Tiles.friendSystem.clear(); for (var33 = 0; var33 < VarpDefinition.VarpDefinition_fileCount; ++var33) { - VarpDefinition var28 = AbstractWorldMapData.method288(var33); + VarpDefinition var28 = AbstractWorldMapData.VarpDefinition_get(var33); if (var28 != null) { Varps.Varps_temp[var33] = 0; Varps.Varps_main[var33] = 0; @@ -4870,7 +4870,7 @@ public final class Client extends GameShell implements Usernamed { if (ServerPacket.field2099 == var1.serverPacket) { for (var16 = 0; var16 < VarpDefinition.VarpDefinition_fileCount; ++var16) { - VarpDefinition var54 = AbstractWorldMapData.method288(var16); + VarpDefinition var54 = AbstractWorldMapData.VarpDefinition_get(var16); if (var54 != null) { Varps.Varps_temp[var16] = 0; Varps.Varps_main[var16] = 0; diff --git a/runescape-client/src/main/java/NetSocket.java b/runescape-client/src/main/java/NetSocket.java index 42a66bbe21..9207e17a34 100644 --- a/runescape-client/src/main/java/NetSocket.java +++ b/runescape-client/src/main/java/NetSocket.java @@ -388,7 +388,7 @@ public final class NetSocket extends AbstractSocket implements Runnable { } } - int var4 = AbstractWorldMapData.method288(var0).type; + int var4 = AbstractWorldMapData.VarpDefinition_get(var0).type; if (var4 != 0) { int var2 = Varps.Varps_main[var0]; if (var4 == 1) { From d56951e6d719383174904e3163a3060a1a3b90b7 Mon Sep 17 00:00:00 2001 From: Nathaniel Pather <12907920+NathanielPather@users.noreply.github.com> Date: Thu, 24 Oct 2019 19:04:33 +1000 Subject: [PATCH 35/63] npc health: add lvl 44 zombie health (#10121) --- runelite-client/src/main/resources/npc_health.json | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/resources/npc_health.json b/runelite-client/src/main/resources/npc_health.json index 6f39e21f79..a6b92c36a3 100644 --- a/runelite-client/src/main/resources/npc_health.json +++ b/runelite-client/src/main/resources/npc_health.json @@ -6,6 +6,7 @@ "Zombie_13": 22, "Zombie_18": 24, "Zombie_24": 30, + "Zombie_44": 40, "Summoned Zombie_13": 22, "Skeleton_22": 29, "Skeleton_21": 24, From 2e6138b6f615c5d32060ca33e3c9beaafe94bf87 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 19 Oct 2019 03:23:20 +0100 Subject: [PATCH 36/63] loot tracker: add HA prices Co-authored-by: Erik Rahka --- .../plugins/loottracker/LootTrackerBox.java | 22 ++++++++++--- .../loottracker/LootTrackerConfig.java | 10 ++++++ .../plugins/loottracker/LootTrackerItem.java | 2 ++ .../plugins/loottracker/LootTrackerPanel.java | 13 +++++--- .../loottracker/LootTrackerPlugin.java | 3 ++ .../loottracker/LootTrackerPriceType.java | 31 +++++++++++++++++++ 6 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index 55892d8e34..6438e82c60 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -69,6 +69,7 @@ class LootTrackerBox extends JPanel private final ItemManager itemManager; @Getter(AccessLevel.PACKAGE) private final String id; + private final LootTrackerPriceType priceType; @Getter private final List records = new ArrayList<>(); @@ -82,12 +83,14 @@ class LootTrackerBox extends JPanel final String id, @Nullable final String subtitle, final boolean hideIgnoredItems, + final LootTrackerPriceType priceType, final BiConsumer onItemToggle) { this.id = id; this.itemManager = itemManager; this.onItemToggle = onItemToggle; this.hideIgnoredItems = hideIgnoredItems; + this.priceType = priceType; setLayout(new BorderLayout(0, 1)); setBorder(new EmptyBorder(5, 0, 0, 0)); @@ -261,7 +264,7 @@ class LootTrackerBox extends JPanel continue; } - totalPrice += entry.getGePrice(); + totalPrice += priceType == LootTrackerPriceType.HIGH_ALCHEMY ? entry.getHaPrice() : entry.getGePrice(); int quantity = 0; for (final LootTrackerItem i : items) @@ -278,8 +281,9 @@ class LootTrackerBox extends JPanel { int newQuantity = entry.getQuantity() + quantity; long gePricePerItem = entry.getGePrice() == 0 ? 0 : (entry.getGePrice() / entry.getQuantity()); + long haPricePerItem = entry.getHaPrice() == 0 ? 0 : (entry.getHaPrice() / entry.getQuantity()); - items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, gePricePerItem * newQuantity, entry.isIgnored())); + items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, gePricePerItem * newQuantity, haPricePerItem * newQuantity, entry.isIgnored())); } else { @@ -287,7 +291,14 @@ class LootTrackerBox extends JPanel } } - items.sort((i1, i2) -> Long.compare(i2.getGePrice(), i1.getGePrice())); + if (priceType == LootTrackerPriceType.HIGH_ALCHEMY) + { + items.sort((i1, i2) -> Long.compare(i2.getHaPrice(), i1.getHaPrice())); + } + else + { + items.sort((i1, i2) -> Long.compare(i2.getGePrice(), i1.getGePrice())); + } // Calculates how many rows need to be display to fit all items final int rowSize = ((items.size() % ITEMS_PER_ROW == 0) ? 0 : 1) + items.size() / ITEMS_PER_ROW; @@ -353,7 +364,10 @@ class LootTrackerBox extends JPanel final String name = item.getName(); final int quantity = item.getQuantity(); final long gePrice = item.getGePrice(); + final long haPrice = item.getHaPrice(); final String ignoredLabel = item.isIgnored() ? " - Ignored" : ""; - return name + " x " + quantity + " (" + QuantityFormatter.quantityToStackSize(gePrice) + ") " + ignoredLabel; + return "" + name + " x " + quantity + ignoredLabel + + "
GE: " + QuantityFormatter.quantityToStackSize(gePrice) + + "
HA: " + QuantityFormatter.quantityToStackSize(haPrice) + ""; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java index bba5994d89..1b212ae81b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java @@ -49,6 +49,16 @@ public interface LootTrackerConfig extends Config ) void setIgnoredItems(String key); + @ConfigItem( + keyName = "priceType", + name = "Price Type", + description = "What type of price to use for calculating value." + ) + default LootTrackerPriceType priceType() + { + return LootTrackerPriceType.GRAND_EXCHANGE; + } + @ConfigItem( keyName = "saveLoot", name = "Submit loot tracker data", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java index 1ecf28a229..81aedb3a4a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java @@ -40,6 +40,8 @@ class LootTrackerItem @Getter private final long gePrice; @Getter + private final long haPrice; + @Getter @Setter private boolean ignored; } 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 a4f21447f5..59e23dbd96 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 @@ -518,7 +518,8 @@ class LootTrackerPanel extends PluginPanel overallPanel.setVisible(true); // Create box - final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(), hideIgnoredItems, plugin::toggleItem); + final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(), + hideIgnoredItems, config.priceType(), plugin::toggleItem); box.combine(record); // Create popup menu @@ -594,7 +595,8 @@ class LootTrackerPanel extends PluginPanel private void updateOverall() { long overallKills = 0; - long overallGp = 0; + long overallGe = 0; + long overallHa = 0; for (LootTrackerRecord record : records) { @@ -613,7 +615,8 @@ class LootTrackerPanel extends PluginPanel continue; } - overallGp += item.getGePrice(); + overallGe += item.getGePrice(); + overallHa += item.getHaPrice(); } if (present > 0) @@ -623,7 +626,9 @@ class LootTrackerPanel extends PluginPanel } overallKillsLabel.setText(htmlLabel("Total count: ", overallKills)); - overallGpLabel.setText(htmlLabel("Total value: ", overallGp)); + overallGpLabel.setText(htmlLabel("Total value: ", config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? overallHa : overallGe)); + overallGpLabel.setToolTipText("Total GE price: " + QuantityFormatter.formatNumber(overallGe) + + "
Total HA price: " + QuantityFormatter.formatNumber(overallHa) + ""); updateCollapseText(); } 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 cc021c3650..e1fbfb307c 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 @@ -54,6 +54,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.GameState; import net.runelite.api.InventoryID; import net.runelite.api.ItemComposition; @@ -637,6 +638,7 @@ public class LootTrackerPlugin extends Plugin final ItemComposition itemComposition = itemManager.getItemComposition(itemId); final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId; final long gePrice = (long) itemManager.getItemPrice(realItemId) * (long) quantity; + final long haPrice = (long) Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER) * (long) quantity; final boolean ignored = ignoredItems.contains(itemComposition.getName()); return new LootTrackerItem( @@ -644,6 +646,7 @@ public class LootTrackerPlugin extends Plugin itemComposition.getName(), quantity, gePrice, + haPrice, ignored); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java new file mode 100644 index 0000000000..e23ad8c2f2 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2019 Hydrox6 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.loottracker; + +public enum LootTrackerPriceType +{ + GRAND_EXCHANGE, + HIGH_ALCHEMY +} From 5b236b920ee3330d72dc1da25e64a973dcf27b3e Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 19 Oct 2019 03:25:42 +0100 Subject: [PATCH 37/63] loot tracker: add price type display --- .../client/plugins/loottracker/LootTrackerBox.java | 11 ++++++++++- .../client/plugins/loottracker/LootTrackerConfig.java | 10 ++++++++++ .../client/plugins/loottracker/LootTrackerPanel.java | 10 ++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index 6438e82c60..24e521d3be 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -70,6 +70,7 @@ class LootTrackerBox extends JPanel @Getter(AccessLevel.PACKAGE) private final String id; private final LootTrackerPriceType priceType; + private final boolean showPriceType; @Getter private final List records = new ArrayList<>(); @@ -84,6 +85,7 @@ class LootTrackerBox extends JPanel @Nullable final String subtitle, final boolean hideIgnoredItems, final LootTrackerPriceType priceType, + final boolean showPriceType, final BiConsumer onItemToggle) { this.id = id; @@ -91,6 +93,7 @@ class LootTrackerBox extends JPanel this.onItemToggle = onItemToggle; this.hideIgnoredItems = hideIgnoredItems; this.priceType = priceType; + this.showPriceType = showPriceType; setLayout(new BorderLayout(0, 1)); setBorder(new EmptyBorder(5, 0, 0, 0)); @@ -184,7 +187,13 @@ class LootTrackerBox extends JPanel { buildItems(); - priceLabel.setText(QuantityFormatter.quantityToStackSize(totalPrice) + " gp"); + String priceTypeString = " "; + if (showPriceType) + { + priceTypeString = priceType == LootTrackerPriceType.HIGH_ALCHEMY ? "HA: " : "GE: "; + } + + priceLabel.setText(priceTypeString + QuantityFormatter.quantityToStackSize(totalPrice) + " gp"); priceLabel.setToolTipText(QuantityFormatter.formatNumber(totalPrice) + " gp"); final long kills = getTotalKills(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java index 1b212ae81b..55fee8a6c4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java @@ -59,6 +59,16 @@ public interface LootTrackerConfig extends Config return LootTrackerPriceType.GRAND_EXCHANGE; } + @ConfigItem( + keyName = "showPriceType", + name = "Show Price Type", + description = "Whether to show a GE: or HA: next to the total values in the tracker" + ) + default boolean showPriceType() + { + return false; + } + @ConfigItem( keyName = "saveLoot", name = "Submit loot tracker data", 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 59e23dbd96..6001df2923 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 @@ -519,7 +519,7 @@ class LootTrackerPanel extends PluginPanel // Create box final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(), - hideIgnoredItems, config.priceType(), plugin::toggleItem); + hideIgnoredItems, config.priceType(), config.showPriceType(), plugin::toggleItem); box.combine(record); // Create popup menu @@ -625,8 +625,14 @@ class LootTrackerPanel extends PluginPanel } } + String priceType = ""; + if (config.showPriceType()) + { + priceType = config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? "HA " : "GE "; + } + overallKillsLabel.setText(htmlLabel("Total count: ", overallKills)); - overallGpLabel.setText(htmlLabel("Total value: ", config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? overallHa : overallGe)); + overallGpLabel.setText(htmlLabel("Total " + priceType + "value: ", config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? overallHa : overallGe)); overallGpLabel.setToolTipText("Total GE price: " + QuantityFormatter.formatNumber(overallGe) + "
Total HA price: " + QuantityFormatter.formatNumber(overallHa) + ""); updateCollapseText(); From 6a3264e68b0ba4e9ef5096d19065b2bf68beebc9 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:51:42 -0400 Subject: [PATCH 38/63] client: remove Cerberus plugin Removed at Jagex's request --- .../plugins/cerberus/CerberusGhost.java | 70 ----------- .../plugins/cerberus/CerberusOverlay.java | 77 ------------ .../plugins/cerberus/CerberusPlugin.java | 115 ------------------ .../plugins/cerberus/CerberusPluginTest.java | 92 -------------- 4 files changed, 354 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java delete mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java deleted file mode 100644 index 744085c9a4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.cerberus; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import java.util.Optional; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Skill; - -@Getter -@RequiredArgsConstructor -public enum CerberusGhost -{ - RANGE(NpcID.SUMMONED_SOUL, Skill.RANGED), - MAGE(NpcID.SUMMONED_SOUL_5868, Skill.MAGIC), - MELEE(NpcID.SUMMONED_SOUL_5869, Skill.ATTACK); - - private final int npcId; - private final Skill type; - - private static final Map MAP; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (final CerberusGhost ghost : values()) - { - builder.put(ghost.getNpcId(), ghost); - } - - MAP = builder.build(); - } - - /** - * Try to identify if NPC is ghost - * @param npc npc - * @return optional ghost - */ - public static Optional fromNPC(final NPC npc) - { - return npc == null ? Optional.empty() : Optional.ofNullable(MAP.get(npc.getId())); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java deleted file mode 100644 index 2f384fcd80..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.cerberus; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class CerberusOverlay extends Overlay -{ - private final CerberusPlugin plugin; - private final SkillIconManager iconManager; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - CerberusOverlay(final CerberusPlugin plugin, final SkillIconManager iconManager) - { - this.plugin = plugin; - this.iconManager = iconManager; - setPosition(OverlayPosition.BOTTOM_RIGHT); - panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getGhosts().isEmpty()) - { - return null; - } - - panelComponent.getChildren().clear(); - - // Ghosts are already sorted - plugin.getGhosts().stream() - // Iterate only through the correct amount of ghosts - .limit(CerberusGhost.values().length) - .forEach(npc -> CerberusGhost - .fromNPC(npc) - .ifPresent(ghost -> panelComponent - .getChildren() - .add(new ImageComponent(iconManager.getSkillImage(ghost.getType()))))); - - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java deleted file mode 100644 index 47f1adbec4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package net.runelite.client.plugins.cerberus; - -import com.google.common.collect.ComparisonChain; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.Getter; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Cerberus", - description = "Show what to pray against the summoned souls", - tags = {"bosses", "combat", "ghosts", "prayer", "pve", "overlay", "souls"} -) -@Singleton -public class CerberusPlugin extends Plugin -{ - @Getter - private final List ghosts = new ArrayList<>(); - - @Inject - private OverlayManager overlayManager; - - @Inject - private CerberusOverlay overlay; - - @Override - protected void startUp() throws Exception - { - overlayManager.add(overlay); - } - - @Override - protected void shutDown() throws Exception - { - overlayManager.remove(overlay); - ghosts.clear(); - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - GameState gameState = event.getGameState(); - if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING || gameState == GameState.CONNECTION_LOST) - { - ghosts.clear(); - } - } - - @Subscribe - public void onNpcSpawned(final NpcSpawned event) - { - final NPC npc = event.getNpc(); - CerberusGhost.fromNPC(npc).ifPresent(ghost -> ghosts.add(npc)); - } - - @Subscribe - public void onNpcDespawned(final NpcDespawned event) - { - ghosts.remove(event.getNpc()); - } - - @Subscribe - public void onGameTick(GameTick gameTick) - { - if (ghosts.isEmpty()) - { - return; - } - - ghosts.sort((a, b) -> ComparisonChain.start() - // First, sort by the southernmost ghost (e.g with lowest y) - .compare(a.getLocalLocation().getY(), b.getLocalLocation().getY()) - // Then, sort by the westernmost ghost (e.g with lowest x) - .compare(a.getLocalLocation().getX(), b.getLocalLocation().getX()) - // This will give use the current wave and order of the ghosts based on - // what ghost will attack first - .result()); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java deleted file mode 100644 index e4289fa2f2..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java +++ /dev/null @@ -1,92 +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.client.plugins.cerberus; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.Arrays; -import java.util.List; -import javax.inject.Inject; -import net.runelite.api.NPC; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.GameTick; -import net.runelite.client.ui.overlay.OverlayManager; -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class CerberusPluginTest -{ - @Mock - @Bind - OverlayManager overlayManager; - - @Inject - CerberusPlugin cerberusPlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testOnGameTick() - { - List ghosts = cerberusPlugin.getGhosts(); - ghosts.addAll(Arrays.asList( - mockNpc(new LocalPoint(0, 0)), - mockNpc(new LocalPoint(1, 0)), - mockNpc(new LocalPoint(0, 5)), - mockNpc(new LocalPoint(2, 0)), - mockNpc(new LocalPoint(2, 5)), - mockNpc(new LocalPoint(1, 5)) - )); - cerberusPlugin.onGameTick(new GameTick()); - - // Expected sort is by lowest y first, then by lowest x - assertEquals(ghosts.get(0).getLocalLocation(), new LocalPoint(0, 0)); - assertEquals(ghosts.get(1).getLocalLocation(), new LocalPoint(1, 0)); - assertEquals(ghosts.get(2).getLocalLocation(), new LocalPoint(2, 0)); - - assertEquals(ghosts.get(3).getLocalLocation(), new LocalPoint(0, 5)); - assertEquals(ghosts.get(4).getLocalLocation(), new LocalPoint(1, 5)); - assertEquals(ghosts.get(5).getLocalLocation(), new LocalPoint(2, 5)); - } - - private static NPC mockNpc(LocalPoint localPoint) - { - NPC npc = mock(NPC.class); - when(npc.getLocalLocation()).thenReturn(localPoint); - return npc; - } -} \ No newline at end of file From 54bb0f803fb3133c83f090586b84445053055715 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:52:29 -0400 Subject: [PATCH 39/63] client: remove reorderprayers plugin Removed at Jagex's request --- .../reorderprayers/PrayerTabState.java | 32 -- .../reorderprayers/ReorderPrayersConfig.java | 73 --- .../reorderprayers/ReorderPrayersPlugin.java | 453 ------------------ 3 files changed, 558 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java deleted file mode 100644 index 993a74f917..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java +++ /dev/null @@ -1,32 +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.client.plugins.reorderprayers; - -public enum PrayerTabState -{ - NONE, - PRAYERS, - QUICK_PRAYERS -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java deleted file mode 100644 index 7a73dae268..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java +++ /dev/null @@ -1,73 +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.client.plugins.reorderprayers; - -import net.runelite.api.Prayer; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup(ReorderPrayersPlugin.CONFIG_GROUP_KEY) -public interface ReorderPrayersConfig extends Config -{ - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_UNLOCK_REORDERING_KEY, - name = "Unlock Prayer Reordering", - description = "Configures whether or not you can reorder the prayers", - position = 1 - ) - default boolean unlockPrayerReordering() - { - return false; - } - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_UNLOCK_REORDERING_KEY, - name = "", - description = "" - ) - void unlockPrayerReordering(boolean unlock); - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_PRAYER_ORDER_KEY, - name = "Prayer Order", - description = "Configures the order of the prayers", - hidden = true, - position = 2 - ) - default String prayerOrder() - { - return ReorderPrayersPlugin.prayerOrderToString(Prayer.values()); - } - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_PRAYER_ORDER_KEY, - name = "", - description = "" - ) - void prayerOrder(String prayerOrder); - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java deleted file mode 100644 index 0c85f32c8e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java +++ /dev/null @@ -1,453 +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.client.plugins.reorderprayers; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.HashTable; -import net.runelite.api.Prayer; -import net.runelite.api.WidgetNode; -import net.runelite.api.events.ConfigChanged; -import net.runelite.api.events.DraggingWidgetChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.events.WidgetMenuOptionClicked; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetConfig.DRAG; -import static net.runelite.api.widgets.WidgetConfig.DRAG_ON; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.menus.WidgetMenuOption; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; - -@PluginDescriptor( - name = "Reorder Prayers", - description = "Reorder the prayers displayed on the Prayer panel" -) -public class ReorderPrayersPlugin extends Plugin -{ - - static final String CONFIG_GROUP_KEY = "reorderprayers"; - - static final String CONFIG_UNLOCK_REORDERING_KEY = "unlockPrayerReordering"; - - static final String CONFIG_PRAYER_ORDER_KEY = "prayerOrder"; - - private static final int PRAYER_WIDTH = 34; - - private static final int PRAYER_HEIGHT = 34; - - private static final int PRAYER_X_OFFSET = 37; - - private static final int PRAYER_Y_OFFSET = 37; - - private static final int QUICK_PRAYER_SPRITE_X_OFFSET = 2; - - private static final int QUICK_PRAYER_SPRITE_Y_OFFSET = 2; - - private static final int PRAYER_COLUMN_COUNT = 5; - - private static final int PRAYER_COUNT = Prayer.values().length; - - private static final List PRAYER_WIDGET_INFO_LIST = ImmutableList.of( - WidgetInfo.PRAYER_THICK_SKIN, - WidgetInfo.PRAYER_BURST_OF_STRENGTH, - WidgetInfo.PRAYER_CLARITY_OF_THOUGHT, - WidgetInfo.PRAYER_SHARP_EYE, - WidgetInfo.PRAYER_MYSTIC_WILL, - WidgetInfo.PRAYER_ROCK_SKIN, - WidgetInfo.PRAYER_SUPERHUMAN_STRENGTH, - WidgetInfo.PRAYER_IMPROVED_REFLEXES, - WidgetInfo.PRAYER_RAPID_RESTORE, - WidgetInfo.PRAYER_RAPID_HEAL, - WidgetInfo.PRAYER_PROTECT_ITEM, - WidgetInfo.PRAYER_HAWK_EYE, - WidgetInfo.PRAYER_MYSTIC_LORE, - WidgetInfo.PRAYER_STEEL_SKIN, - WidgetInfo.PRAYER_ULTIMATE_STRENGTH, - WidgetInfo.PRAYER_INCREDIBLE_REFLEXES, - WidgetInfo.PRAYER_PROTECT_FROM_MAGIC, - WidgetInfo.PRAYER_PROTECT_FROM_MISSILES, - WidgetInfo.PRAYER_PROTECT_FROM_MELEE, - WidgetInfo.PRAYER_EAGLE_EYE, - WidgetInfo.PRAYER_MYSTIC_MIGHT, - WidgetInfo.PRAYER_RETRIBUTION, - WidgetInfo.PRAYER_REDEMPTION, - WidgetInfo.PRAYER_SMITE, - WidgetInfo.PRAYER_PRESERVE, - WidgetInfo.PRAYER_CHIVALRY, - WidgetInfo.PRAYER_PIETY, - WidgetInfo.PRAYER_RIGOUR, - WidgetInfo.PRAYER_AUGURY - ); - - private static final List QUICK_PRAYER_CHILD_IDS = ImmutableList.of( - WidgetID.QuickPrayer.THICK_SKIN_CHILD_ID, - WidgetID.QuickPrayer.BURST_OF_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.CLARITY_OF_THOUGHT_CHILD_ID, - WidgetID.QuickPrayer.SHARP_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_WILL_CHILD_ID, - WidgetID.QuickPrayer.ROCK_SKIN_CHILD_ID, - WidgetID.QuickPrayer.SUPERHUMAN_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.IMPROVED_REFLEXES_CHILD_ID, - WidgetID.QuickPrayer.RAPID_RESTORE_CHILD_ID, - WidgetID.QuickPrayer.RAPID_HEAL_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_ITEM_CHILD_ID, - WidgetID.QuickPrayer.HAWK_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_LORE_CHILD_ID, - WidgetID.QuickPrayer.STEEL_SKIN_CHILD_ID, - WidgetID.QuickPrayer.ULTIMATE_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.INCREDIBLE_REFLEXES_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MAGIC_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MISSILES_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MELEE_CHILD_ID, - WidgetID.QuickPrayer.EAGLE_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_MIGHT_CHILD_ID, - WidgetID.QuickPrayer.RETRIBUTION_CHILD_ID, - WidgetID.QuickPrayer.REDEMPTION_CHILD_ID, - WidgetID.QuickPrayer.SMITE_CHILD_ID, - WidgetID.QuickPrayer.PRESERVE_CHILD_ID, - WidgetID.QuickPrayer.CHIVALRY_CHILD_ID, - WidgetID.QuickPrayer.PIETY_CHILD_ID, - WidgetID.QuickPrayer.RIGOUR_CHILD_ID, - WidgetID.QuickPrayer.AUGURY_CHILD_ID - ); - - private static final String LOCK = "Lock"; - - private static final String UNLOCK = "Unlock"; - - private static final String MENU_TARGET = "Reordering"; - - private static final WidgetMenuOption FIXED_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption FIXED_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB); - - @Inject - private Client client; - - @Inject - private ReorderPrayersConfig config; - - @Inject - private MenuManager menuManager; - - private Prayer[] prayerOrder; - - static String prayerOrderToString(Prayer[] prayerOrder) - { - return Arrays.stream(prayerOrder) - .map(Prayer::name) - .collect(Collectors.joining(",")); - } - - private static Prayer[] stringToPrayerOrder(String string) - { - return Arrays.stream(string.split(",")) - .map(Prayer::valueOf) - .toArray(Prayer[]::new); - } - - private static int getPrayerIndex(Widget widget) - { - int x = widget.getOriginalX() / PRAYER_X_OFFSET; - int y = widget.getOriginalY() / PRAYER_Y_OFFSET; - return x + y * PRAYER_COLUMN_COUNT; - } - - private static void setWidgetPosition(Widget widget, int x, int y) - { - widget.setRelativeX(x); - widget.setRelativeY(y); - widget.setOriginalX(x); - widget.setOriginalY(y); - } - - @Provides - ReorderPrayersConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ReorderPrayersConfig.class); - } - - @Override - protected void startUp() throws Exception - { - refreshPrayerTabOption(); - prayerOrder = stringToPrayerOrder(config.prayerOrder()); - reorderPrayers(); - } - - @Override - protected void shutDown() throws Exception - { - clearPrayerTabMenus(); - prayerOrder = Prayer.values(); - reorderPrayers(false); - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - reorderPrayers(); - } - } - - @Subscribe - public void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals(CONFIG_GROUP_KEY)) - { - if (event.getKey().equals(CONFIG_PRAYER_ORDER_KEY)) - { - prayerOrder = stringToPrayerOrder(config.prayerOrder()); - } - else if (event.getKey().equals(CONFIG_UNLOCK_REORDERING_KEY)) - { - refreshPrayerTabOption(); - } - reorderPrayers(); - } - } - - @Subscribe - public void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID) - { - reorderPrayers(); - } - } - - @Subscribe - public void onDraggingWidgetChanged(DraggingWidgetChanged event) - { - // is dragging widget and mouse button released - if (event.isDraggingWidget() && client.getMouseCurrentButton() == 0) - { - Widget draggedWidget = client.getDraggedWidget(); - Widget draggedOnWidget = client.getDraggedOnWidget(); - if (draggedWidget != null && draggedOnWidget != null) - { - int draggedGroupId = WidgetInfo.TO_GROUP(draggedWidget.getId()); - int draggedOnGroupId = WidgetInfo.TO_GROUP(draggedOnWidget.getId()); - if (draggedGroupId != WidgetID.PRAYER_GROUP_ID || draggedOnGroupId != WidgetID.PRAYER_GROUP_ID - || draggedOnWidget.getWidth() != PRAYER_WIDTH || draggedOnWidget.getHeight() != PRAYER_HEIGHT) - { - return; - } - // reset dragged on widget to prevent sending a drag widget packet to the server - client.setDraggedOnWidget(null); - - int fromPrayerIndex = getPrayerIndex(draggedWidget); - int toPrayerIndex = getPrayerIndex(draggedOnWidget); - - Prayer tmp = prayerOrder[toPrayerIndex]; - prayerOrder[toPrayerIndex] = prayerOrder[fromPrayerIndex]; - prayerOrder[fromPrayerIndex] = tmp; - - save(); - } - } - } - - @Subscribe - public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) - { - if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB - || event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB - || event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB) - { - config.unlockPrayerReordering(event.getMenuOption().equals(UNLOCK)); - } - } - - private void clearPrayerTabMenus() - { - menuManager.removeManagedCustomMenu(FIXED_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(FIXED_PRAYER_TAB_UNLOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_PRAYER_TAB_UNLOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK); - } - - private void refreshPrayerTabOption() - { - clearPrayerTabMenus(); - if (config.unlockPrayerReordering()) - { - menuManager.addManagedCustomMenu(FIXED_PRAYER_TAB_LOCK); - menuManager.addManagedCustomMenu(RESIZABLE_PRAYER_TAB_LOCK); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK); - } - else - { - menuManager.addManagedCustomMenu(FIXED_PRAYER_TAB_UNLOCK); - menuManager.addManagedCustomMenu(RESIZABLE_PRAYER_TAB_UNLOCK); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK); - } - } - - private PrayerTabState getPrayerTabState() - { - HashTable componentTable = client.getComponentTable(); - for (WidgetNode widgetNode : componentTable.getNodes()) - { - if (widgetNode.getId() == WidgetID.PRAYER_GROUP_ID) - { - return PrayerTabState.PRAYERS; - } - else if (widgetNode.getId() == WidgetID.QUICK_PRAYERS_GROUP_ID) - { - return PrayerTabState.QUICK_PRAYERS; - } - } - return PrayerTabState.NONE; - } - - private void save() - { - config.prayerOrder(prayerOrderToString(prayerOrder)); - } - - private void reorderPrayers() - { - reorderPrayers(config.unlockPrayerReordering()); - } - - private void reorderPrayers(boolean unlocked) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - PrayerTabState prayerTabState = getPrayerTabState(); - - if (prayerTabState == PrayerTabState.PRAYERS) - { - List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream() - .map(client::getWidget) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - - if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) - { - return; - } - - for (int index = 0; index < prayerOrder.length; index++) - { - Prayer prayer = prayerOrder[index]; - Widget prayerWidget = prayerWidgets.get(prayer.ordinal()); - - int widgetConfig = prayerWidget.getClickMask(); - if (unlocked) - { - // allow dragging of this widget - widgetConfig |= DRAG; - // allow this widget to be dragged on - widgetConfig |= DRAG_ON; - } - else - { - // remove drag flag - widgetConfig &= ~DRAG; - // remove drag on flag - widgetConfig &= ~DRAG_ON; - } - prayerWidget.setClickMask(widgetConfig); - - int x = index % PRAYER_COLUMN_COUNT; - int y = index / PRAYER_COLUMN_COUNT; - int widgetX = x * PRAYER_X_OFFSET; - int widgetY = y * PRAYER_Y_OFFSET; - setWidgetPosition(prayerWidget, widgetX, widgetY); - } - } - else if (prayerTabState == PrayerTabState.QUICK_PRAYERS) - { - Widget prayersContainer = client.getWidget(WidgetInfo.QUICK_PRAYER_PRAYERS); - if (prayersContainer == null) - { - return; - } - Widget[] prayerWidgets = prayersContainer.getDynamicChildren(); - if (prayerWidgets == null || prayerWidgets.length != PRAYER_COUNT * 3) - { - return; - } - - for (int index = 0; index < prayerOrder.length; index++) - { - Prayer prayer = prayerOrder[index]; - - int x = index % PRAYER_COLUMN_COUNT; - int y = index / PRAYER_COLUMN_COUNT; - - Widget prayerWidget = prayerWidgets[QUICK_PRAYER_CHILD_IDS.get(prayer.ordinal())]; - setWidgetPosition(prayerWidget, x * PRAYER_X_OFFSET, y * PRAYER_Y_OFFSET); - - int childId = PRAYER_COUNT + 2 * prayer.ordinal(); - - Widget prayerSpriteWidget = prayerWidgets[childId]; - setWidgetPosition(prayerSpriteWidget, - QUICK_PRAYER_SPRITE_X_OFFSET + x * PRAYER_X_OFFSET, - QUICK_PRAYER_SPRITE_Y_OFFSET + y * PRAYER_Y_OFFSET); - - Widget prayerToggleWidget = prayerWidgets[childId + 1]; - setWidgetPosition(prayerToggleWidget, x * PRAYER_X_OFFSET, y * PRAYER_Y_OFFSET); - } - } - } - -} From 543ce78710f1b078d3385ecdf80f49b12cde02d0 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:54:21 -0400 Subject: [PATCH 40/63] opponentinfo: remove Opponent's opponent Removed at Jagex's request --- .../opponentinfo/OpponentInfoConfig.java | 11 --------- .../opponentinfo/OpponentInfoOverlay.java | 23 ------------------- 2 files changed, 34 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java index 9f08e128af..6adb3af1f2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java @@ -53,17 +53,6 @@ public interface OpponentInfoConfig extends Config return HitpointsDisplayStyle.HITPOINTS; } - @ConfigItem( - keyName = "showOpponentsOpponent", - name = "Show opponent's opponent", - description = "Toggle showing opponent's opponent if within a multi-combat area", - position = 2 - ) - default boolean showOpponentsOpponent() - { - return true; - } - @ConfigItem( keyName = "showOpponentsInMenu", name = "Show opponents in menu", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java index f7945a5646..45c40cf939 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java @@ -37,7 +37,6 @@ import net.runelite.api.Client; import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import net.runelite.api.NPC; import net.runelite.api.Player; -import net.runelite.api.Varbits; import net.runelite.client.game.HiscoreManager; import net.runelite.client.game.NPCManager; import net.runelite.client.ui.overlay.Overlay; @@ -69,7 +68,6 @@ class OpponentInfoOverlay extends Overlay private int lastRatio = 0; private int lastHealthScale = 0; private String opponentName; - private String opponentsOpponentName; @Inject private OpponentInfoOverlay( @@ -128,17 +126,6 @@ class OpponentInfoOverlay extends Overlay } } } - - final Actor opponentsOpponent = opponent.getInteracting(); - if (opponentsOpponent != null - && (opponentsOpponent != client.getLocalPlayer() || client.getVar(Varbits.MULTICOMBAT_AREA) == 1)) - { - opponentsOpponentName = Text.removeTags(opponentsOpponent.getName()); - } - else - { - opponentsOpponentName = null; - } } if (opponentName == null) @@ -218,16 +205,6 @@ class OpponentInfoOverlay extends Overlay panelComponent.getChildren().add(progressBarComponent); } - // Opponents opponent - if (opponentsOpponentName != null && opponentInfoConfig.showOpponentsOpponent()) - { - textWidth = Math.max(textWidth, fontMetrics.stringWidth(opponentsOpponentName)); - panelComponent.setPreferredSize(new Dimension(textWidth, 0)); - panelComponent.getChildren().add(TitleComponent.builder() - .text(opponentsOpponentName) - .build()); - } - return panelComponent.render(graphics); } } From e2c72a676751f731a93b0b98a92663c08e742cfc Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:55:44 -0400 Subject: [PATCH 41/63] corp plugin: remove dark core attack deprioritization Removed at Jagex's request --- .../client/plugins/corp/CorpConfig.java | 11 ------- .../client/plugins/corp/CorpPlugin.java | 32 ------------------- 2 files changed, 43 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java index 4b2fe5bb9c..13475f7c44 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java @@ -31,17 +31,6 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("corp") public interface CorpConfig extends Config { - @ConfigItem( - keyName = "leftClickCore", - name = "Left click walk on core", - description = "Prioritizes Walk here over Attack on the Dark energy core", - position = 1 - ) - default boolean leftClickCore() - { - return true; - } - @ConfigItem( keyName = "showDamage", name = "Show damage overlay", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java index 627c9091e8..9ad661094c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java @@ -35,16 +35,12 @@ import net.runelite.api.Actor; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameState; -import net.runelite.api.MenuAction; -import static net.runelite.api.MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET; -import net.runelite.api.MenuEntry; import net.runelite.api.NPC; import net.runelite.api.NpcID; import net.runelite.api.Varbits; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.client.chat.ChatColorType; @@ -65,10 +61,6 @@ import net.runelite.client.ui.overlay.OverlayManager; @Slf4j public class CorpPlugin extends Plugin { - private static final int NPC_SECTION_ACTION = MenuAction.NPC_SECOND_OPTION.getId(); - private static final String ATTACK = "Attack"; - private static final String DARK_ENERGY_CORE = "Dark energy core"; - @Getter(AccessLevel.PACKAGE) private NPC corp; @@ -224,28 +216,4 @@ public class CorpPlugin extends Plugin players.add(source); } - - @Subscribe - public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) - { - if (menuEntryAdded.getType() != NPC_SECTION_ACTION - || !config.leftClickCore() || !menuEntryAdded.getOption().equals(ATTACK)) - { - return; - } - - final int npcIndex = menuEntryAdded.getIdentifier(); - final NPC npc = client.getCachedNPCs()[npcIndex]; - if (npc == null || !npc.getName().equals(DARK_ENERGY_CORE)) - { - return; - } - - // since this is the menu entry add event, this is the last menu entry - MenuEntry[] menuEntries = client.getMenuEntries(); - MenuEntry menuEntry = menuEntries[menuEntries.length - 1]; - - menuEntry.setType(NPC_SECTION_ACTION + MENU_ACTION_DEPRIORITIZE_OFFSET); - client.setMenuEntries(menuEntries); - } } From bc5838f0194f6ad75aa69be0743f13ef3afd564a Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:58:22 -0400 Subject: [PATCH 42/63] menuentryswapper: remove pickpocket swap Removed at Jagex's request --- .../menuentryswapper/MenuEntrySwapperConfig.java | 10 ---------- .../menuentryswapper/MenuEntrySwapperPlugin.java | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index 13f780a823..28229152f1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -202,16 +202,6 @@ public interface MenuEntrySwapperConfig extends Config return HouseAdvertisementMode.VIEW; } - @ConfigItem( - keyName = "swapPickpocket", - name = "Pickpocket", - description = "Swap Talk-to with Pickpocket" - ) - default boolean swapPickpocket() - { - return true; - } - @ConfigItem( keyName = "swapPay", name = "Pay", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 91fddefb66..eabce50cf3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -371,11 +371,6 @@ public class MenuEntrySwapperPlugin extends Plugin if (option.equals("talk-to")) { - if (config.swapPickpocket() && shouldSwapPickpocket(target)) - { - swap("pickpocket", option, target, index); - } - if (config.swapAbyssTeleport() && target.contains("mage of zamorak")) { swap("teleport", option, target, index); @@ -638,11 +633,6 @@ public class MenuEntrySwapperPlugin extends Plugin } } - private static boolean shouldSwapPickpocket(String target) - { - return !target.startsWith("villager") && !target.startsWith("bandit") && !target.startsWith("menaphite thug"); - } - @Subscribe public void onClientTick(ClientTick clientTick) { From 25c81187df67983760559c89f96856d6157a63aa Mon Sep 17 00:00:00 2001 From: ln Date: Fri, 25 Oct 2019 04:34:28 +0300 Subject: [PATCH 43/63] GPU: Floating point screen coordinates to eliminate vertex snapping --- .../runelite/client/plugins/gpu/common.glsl | 6 ++--- .../net/runelite/client/plugins/gpu/geom.glsl | 6 ++--- .../client/plugins/gpu/to_screen.glsl | 26 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl index 207e8300a1..55c3b9e6c3 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl @@ -74,9 +74,9 @@ bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, i vB += position - cameraPos; vC += position - cameraPos; - ivec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0; } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl index 28a339f788..0f7f1bad23 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl @@ -60,9 +60,9 @@ out float fogAmount; void main() { ivec3 cameraPos = ivec3(cameraX, cameraY, cameraZ); - ivec3 screenA = toScreen(vPosition[0] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 screenB = toScreen(vPosition[1] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 screenC = toScreen(vPosition[2] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 screenA = toScreen(vPosition[0] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 screenB = toScreen(vPosition[1] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 screenC = toScreen(vPosition[2] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); if (-screenA.z < 50 || -screenB.z < 50 || -screenC.z < 50) { // the client does not draw a triangle if any vertex distance is <50 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl index 612cf8fce8..1e9e63428d 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl @@ -26,22 +26,22 @@ /* * Convert a vertex to screen space */ -ivec3 toScreen(ivec3 vertex, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) { - int yawSin = int(65536.0f * sin(cameraYaw * UNIT)); - int yawCos = int(65536.0f * cos(cameraYaw * UNIT)); +vec3 toScreen(ivec3 vertex, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) { + float yawSin = sin(cameraYaw * UNIT); + float yawCos = cos(cameraYaw * UNIT); - int pitchSin = int(65536.0f * sin(cameraPitch * UNIT)); - int pitchCos = int(65536.0f * cos(cameraPitch * UNIT)); + float pitchSin = sin(cameraPitch * UNIT); + float pitchCos = cos(cameraPitch * UNIT); - int rotatedX = ((vertex.z * yawSin) + (vertex.x * yawCos)) >> 16; - int rotatedZ = ((vertex.z * yawCos) - (vertex.x * yawSin)) >> 16; + float rotatedX = (vertex.z * yawSin) + (vertex.x * yawCos); + float rotatedZ = (vertex.z * yawCos) - (vertex.x * yawSin); - int var13 = ((vertex.y * pitchCos) - (rotatedZ * pitchSin)) >> 16; - int var12 = ((vertex.y * pitchSin) + (rotatedZ * pitchCos)) >> 16; + float var13 = (vertex.y * pitchCos) - (rotatedZ * pitchSin); + float var12 = (vertex.y * pitchSin) + (rotatedZ * pitchCos); - int x = rotatedX * zoom / var12 + centerX; - int y = var13 * zoom / var12 + centerY; - int z = -var12; // in OpenGL depth is negative + float x = rotatedX * zoom / var12 + centerX; + float y = var13 * zoom / var12 + centerY; + float z = -var12; // in OpenGL depth is negative - return ivec3(x, y, z); + return vec3(x, y, z); } From 7bb95ef7c7d5270ccd0ddb8e4cdef9e43b894f28 Mon Sep 17 00:00:00 2001 From: SebastiaanVanspauwen <43320258+SebastiaanVanspauwen@users.noreply.github.com> Date: Fri, 25 Oct 2019 11:02:12 +0200 Subject: [PATCH 44/63] Worldmap: Fix incorrect Zeah quest start locations (#10135) --- .../runelite/client/plugins/worldmap/QuestStartLocation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 459abf02e0..bce9ec50c3 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 @@ -58,7 +58,7 @@ enum QuestStartLocation //Members' Quests ANIMAL_MAGNETISM(Quest.ANIMAL_MAGNETISM, new WorldPoint(3094, 3360, 0)), ANOTHER_SLICE_OF_HAM(Quest.ANOTHER_SLICE_OF_HAM, new WorldPoint(2799, 5428, 0)), - THE_ASCENT_OF_ARCEUUS(Quest.THE_ASCENT_OF_ARCEUUS, new WorldPoint(1700, 3742, 0)), + THE_ASCENT_OF_ARCEUUS(Quest.THE_ASCENT_OF_ARCEUUS, new WorldPoint(1699, 3742, 0)), BETWEEN_A_ROCK(Quest.BETWEEN_A_ROCK, new WorldPoint(2823, 10168, 0)), BIG_CHOMPY_BIRD_HUNTING(Quest.BIG_CHOMPY_BIRD_HUNTING, new WorldPoint(2629, 2981, 0)), BIOHAZARD(Quest.BIOHAZARD, new WorldPoint(2591, 3335, 0)), @@ -72,7 +72,7 @@ enum QuestStartLocation DARKNESS_OF_HALLOWVALE(Quest.DARKNESS_OF_HALLOWVALE, new WorldPoint(3494, 9628, 0)), DEATH_PLATEAU_TROLL_STRONGHOLD(new Quest[]{Quest.DEATH_PLATEAU, Quest.TROLL_STRONGHOLD}, new WorldPoint(2895, 3528, 0)), DEATH_TO_THE_DORGESHUUN(Quest.DEATH_TO_THE_DORGESHUUN, new WorldPoint(3316, 9613, 0)), - THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1780, 3569, 0)), + THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1781, 3570, 0)), DESERT_TREASURE(Quest.DESERT_TREASURE, new WorldPoint(3177, 3043, 0)), DEVIOUS_MINDS(Quest.DEVIOUS_MINDS, new WorldPoint(3405, 3492, 0)), THE_DIG_SITE(Quest.THE_DIG_SITE, new WorldPoint(3363, 3337, 0)), From f715c9f48dbc7c79a7c79e9eacf517b2063dc5ff Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 26 Oct 2019 08:48:05 +0100 Subject: [PATCH 45/63] clues: fix MultipleOfItemRequirement not working with non-stacking items --- .../clues/item/MultipleOfItemRequirement.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/MultipleOfItemRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/MultipleOfItemRequirement.java index 975d38c1d2..064d92eddc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/MultipleOfItemRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/MultipleOfItemRequirement.java @@ -48,11 +48,16 @@ public class MultipleOfItemRequirement implements ItemRequirement @Override public boolean fulfilledBy(Item[] items) { + int quantityFound = 0; for (Item item : items) { - if (item.getId() == itemId && item.getQuantity() >= quantity) + if (item.getId() == itemId) { - return true; + quantityFound += item.getQuantity(); + if (quantityFound >= quantity) + { + return true; + } } } From c2e7b61a685ae3e86841cce904e081f35ad6e481 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Oct 2019 19:07:52 -0400 Subject: [PATCH 46/63] cache: update npc definition and loader --- .../cache/definitions/NpcDefinition.java | 53 +++++++++--------- .../cache/definitions/loaders/NpcLoader.java | 56 +++++++++---------- .../cache/definitions/savers/NpcSaver.java | 48 ++++++++-------- 3 files changed, 77 insertions(+), 80 deletions(-) diff --git a/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java b/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java index 8ba160c97a..ddfabfe367 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java +++ b/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java @@ -31,38 +31,37 @@ import lombok.Data; @Data public class NpcDefinition { - public final int id; - public short[] recolorToFind; - public int rotation = 32; public String name = "null"; - public short[] recolorToReplace; + public int size = 1; public int[] models; - public int[] models_2; - public int stanceAnimation = -1; - public int anInt2165 = -1; - public int tileSpacesOccupied = 1; - public int walkAnimation = -1; - public short[] retextureToReplace; - public int rotate90RightAnimation = -1; - public boolean aBool2170 = true; - public int resizeX = 128; - public int contrast = 0; + public int[] chatheadModels; + public int standingAnimation = -1; + public int rotateLeftAnimation = -1; + public int rotateRightAnimation = -1; + public int walkingAnimation = -1; public int rotate180Animation = -1; - public int varbitIndex = -1; - public String[] options = new String[5]; - public boolean renderOnMinimap = true; - public int combatLevel = -1; + public int rotate90RightAnimation = -1; public int rotate90LeftAnimation = -1; - public int resizeY = 128; - public boolean hasRenderPriority = false; - public int ambient = 0; - public int headIcon = -1; - public int[] configs; + public short[] recolorToFind; + public short[] recolorToReplace; public short[] retextureToFind; + public short[] retextureToReplace; + public String[] actions = new String[5]; + public boolean isMinimapVisible = true; + public int combatLevel = -1; + public int widthScale = 128; + public int heightScale = 128; + public boolean hasRenderPriority; + public int ambient; + public int contrast; + public int headIcon = -1; + public int rotationSpeed = 32; + public int[] configs; + public int varbitId = -1; public int varpIndex = -1; - public boolean isClickable = true; - public int anInt2189 = -1; - public boolean aBool2190 = false; - public Map params = null; + public boolean isInteractable = true; + public boolean rotationFlag = true; + public boolean isPet; + public Map params; } diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java index 478ef2660a..0ce81f864b 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java @@ -24,13 +24,12 @@ */ package net.runelite.cache.definitions.loaders; +import java.util.HashMap; import net.runelite.cache.definitions.NpcDefinition; import net.runelite.cache.io.InputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; - public class NpcLoader { private static final Logger logger = LoggerFactory.getLogger(NpcLoader.class); @@ -67,7 +66,6 @@ public class NpcLoader { def.models[index] = stream.readUnsignedShort(); } - } else if (opcode == 2) { @@ -75,37 +73,37 @@ public class NpcLoader } else if (opcode == 12) { - def.tileSpacesOccupied = stream.readUnsignedByte(); + def.size = stream.readUnsignedByte(); } else if (opcode == 13) { - def.stanceAnimation = stream.readUnsignedShort(); + def.standingAnimation = stream.readUnsignedShort(); } else if (opcode == 14) { - def.walkAnimation = stream.readUnsignedShort(); + def.walkingAnimation = stream.readUnsignedShort(); } else if (opcode == 15) { - def.anInt2165 = stream.readUnsignedShort(); + def.rotateLeftAnimation = stream.readUnsignedShort(); } else if (opcode == 16) { - def.anInt2189 = stream.readUnsignedShort(); + def.rotateRightAnimation = stream.readUnsignedShort(); } else if (opcode == 17) { - def.walkAnimation = stream.readUnsignedShort(); + def.walkingAnimation = stream.readUnsignedShort(); def.rotate180Animation = stream.readUnsignedShort(); def.rotate90RightAnimation = stream.readUnsignedShort(); def.rotate90LeftAnimation = stream.readUnsignedShort(); } else if (opcode >= 30 && opcode < 35) { - def.options[opcode - 30] = stream.readString(); - if (def.options[opcode - 30].equalsIgnoreCase("Hidden")) + def.actions[opcode - 30] = stream.readString(); + if (def.actions[opcode - 30].equalsIgnoreCase("Hidden")) { - def.options[opcode - 30] = null; + def.actions[opcode - 30] = null; } } else if (opcode == 40) @@ -137,17 +135,17 @@ public class NpcLoader else if (opcode == 60) { length = stream.readUnsignedByte(); - def.models_2 = new int[length]; + def.chatheadModels = new int[length]; for (index = 0; index < length; ++index) { - def.models_2[index] = stream.readUnsignedShort(); + def.chatheadModels[index] = stream.readUnsignedShort(); } } else if (opcode == 93) { - def.renderOnMinimap = false; + def.isMinimapVisible = false; } else if (opcode == 95) { @@ -155,11 +153,11 @@ public class NpcLoader } else if (opcode == 97) { - def.resizeX = stream.readUnsignedShort(); + def.widthScale = stream.readUnsignedShort(); } else if (opcode == 98) { - def.resizeY = stream.readUnsignedShort(); + def.heightScale = stream.readUnsignedShort(); } else if (opcode == 99) { @@ -179,18 +177,18 @@ public class NpcLoader } else if (opcode == 103) { - def.rotation = stream.readUnsignedShort(); + def.rotationSpeed = stream.readUnsignedShort(); } else if (opcode == 106) { - def.varbitIndex = stream.readUnsignedShort(); - if ('\uffff' == def.varbitIndex) + def.varbitId = stream.readUnsignedShort(); + if (def.varbitId == 65535) { - def.varbitIndex = -1; + def.varbitId = -1; } def.varpIndex = stream.readUnsignedShort(); - if ('\uffff' == def.varpIndex) + if (def.varpIndex == 65535) { def.varpIndex = -1; } @@ -212,26 +210,26 @@ public class NpcLoader } else if (opcode == 107) { - def.isClickable = false; + def.isInteractable = false; } else if (opcode == 109) { - def.aBool2170 = false; + def.rotationFlag = false; } else if (opcode == 111) { - def.aBool2190 = true; + def.isPet = true; } else if (opcode == 118) { - def.varbitIndex = stream.readUnsignedShort(); - if ('\uffff' == def.varbitIndex) + def.varbitId = stream.readUnsignedShort(); + if (def.varbitId == 65535) { - def.varbitIndex = -1; + def.varbitId = -1; } def.varpIndex = stream.readUnsignedShort(); - if ('\uffff' == def.varpIndex) + if (def.varpIndex == 65535) { def.varpIndex = -1; } diff --git a/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java b/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java index 55d4b966e9..577681cf80 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java +++ b/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java @@ -47,45 +47,45 @@ public class NpcSaver out.writeByte(2); out.writeString(npc.name); } - if (npc.tileSpacesOccupied != 1) + if (npc.size != 1) { out.writeByte(12); - out.writeByte(npc.tileSpacesOccupied); + out.writeByte(npc.size); } - if (npc.stanceAnimation != -1) + if (npc.standingAnimation != -1) { out.writeByte(13); - out.writeShort(npc.stanceAnimation); + out.writeShort(npc.standingAnimation); } - if (npc.walkAnimation != -1) + if (npc.walkingAnimation != -1) { out.writeByte(14); - out.writeShort(npc.walkAnimation); + out.writeShort(npc.walkingAnimation); } - if (npc.anInt2165 != -1) + if (npc.rotateLeftAnimation != -1) { out.writeByte(15); - out.writeShort(npc.anInt2165); + out.writeShort(npc.rotateLeftAnimation); } - if (npc.anInt2189 != -1) + if (npc.rotateRightAnimation != -1) { out.writeByte(16); - out.writeShort(npc.anInt2189); + out.writeShort(npc.rotateRightAnimation); } if (npc.rotate180Animation != -1 || npc.rotate90LeftAnimation != -1 || npc.rotate90RightAnimation != -1) { out.writeByte(17); - out.writeShort(npc.walkAnimation); + out.writeShort(npc.walkingAnimation); out.writeShort(npc.rotate180Animation); out.writeShort(npc.rotate90RightAnimation); out.writeShort(npc.rotate90LeftAnimation); } for (int i = 0; i < 5; ++i) { - if (npc.options[i] != null) + if (npc.actions[i] != null) { out.writeByte(30 + i); - out.writeString(npc.options[i]); + out.writeString(npc.actions[i]); } } if (npc.recolorToFind != null && npc.recolorToReplace != null) @@ -108,16 +108,16 @@ public class NpcSaver out.writeShort(npc.retextureToReplace[i]); } } - if (npc.models_2 != null) + if (npc.chatheadModels != null) { out.writeByte(60); - out.writeByte(npc.models_2.length); - for (int modelId : npc.models_2) + out.writeByte(npc.chatheadModels.length); + for (int modelId : npc.chatheadModels) { out.writeShort(modelId); } } - if (!npc.renderOnMinimap) + if (!npc.isMinimapVisible) { out.writeByte(93); } @@ -127,9 +127,9 @@ public class NpcSaver out.writeShort(npc.combatLevel); } out.writeByte(97); - out.writeShort(npc.resizeX); + out.writeShort(npc.widthScale); out.writeByte(98); - out.writeShort(npc.resizeY); + out.writeShort(npc.heightScale); if (npc.hasRenderPriority) { out.writeByte(99); @@ -144,23 +144,23 @@ public class NpcSaver out.writeShort(npc.headIcon); } out.writeByte(103); - out.writeShort(npc.rotation); - if (!npc.isClickable) + out.writeShort(npc.rotationSpeed); + if (!npc.isInteractable) { out.writeByte(107); } - if (!npc.aBool2170) + if (!npc.rotationFlag) { out.writeByte(109); } - if (npc.aBool2190) + if (npc.isPet) { out.writeByte(111); } if (npc.configs != null) { out.writeByte(118); - out.writeShort(npc.varbitIndex); + out.writeShort(npc.varbitId); out.writeShort(npc.varpIndex); int[] c = npc.configs; From 7eda41452ba2985a479607eddc04cbb0e9ede9aa Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 26 Oct 2019 12:18:24 -0400 Subject: [PATCH 47/63] api: add source to sound effect events --- .../runelite/api/events/AreaSoundEffectPlayed.java | 11 +++++++++++ .../net/runelite/api/events/SoundEffectPlayed.java | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java index 488bff8264..e0f4c1fe28 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java @@ -24,14 +24,25 @@ */ package net.runelite.api.events; +import javax.annotation.Nullable; import lombok.Data; +import net.runelite.api.Actor; @Data public class AreaSoundEffectPlayed { + @Nullable + private final Actor source; private int soundId; private int sceneX; private int sceneY; private int range; private int delay; + + private boolean consumed; + + public void consume() + { + consumed = true; + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java index 127a9a2646..06002f717a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java @@ -24,11 +24,22 @@ */ package net.runelite.api.events; +import javax.annotation.Nullable; import lombok.Data; +import net.runelite.api.Actor; @Data public class SoundEffectPlayed { + @Nullable + private final Actor source; private int soundId; private int delay; + + private boolean consumed; + + public void consume() + { + consumed = true; + } } From 9f9205e65d144e444c57b5fe62ef7cd4d4625e7f Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 26 Oct 2019 12:18:49 -0400 Subject: [PATCH 48/63] devtools: add source to sound effect overlay --- .../net/runelite/client/plugins/devtools/SoundEffectOverlay.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java index fbe2254066..cb99746a90 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java @@ -123,6 +123,7 @@ class SoundEffectOverlay extends Overlay String text = "Id: " + event.getSoundId() + + " - S: " + (event.getSource() != null ? event.getSource().getName() : "") + " - L: " + event.getSceneX() + "," + event.getSceneY() + " - R: " + event.getRange() + " - D: " + event.getDelay(); From 79800944011b8a1b0f0073adc6674323b1588374 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 26 Oct 2019 12:19:28 -0400 Subject: [PATCH 49/63] music plugin: add option to mute other players area sounds --- .../client/plugins/music/MusicConfig.java | 11 +++++++++++ .../client/plugins/music/MusicPlugin.java | 15 +++++++++++++++ 2 files changed, 26 insertions(+) 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 da764e62c9..e425a10f08 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 @@ -31,6 +31,16 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("music") public interface MusicConfig extends Config { + @ConfigItem( + keyName = "muteOtherAreaSounds", + name = "Mute others' area sounds", + description = "Mute area sounds caused from other players" + ) + default boolean muteOtherAreaSounds() + { + return false; + } + @ConfigItem( keyName = "musicVolume", name = "", @@ -60,6 +70,7 @@ public interface MusicConfig extends Config { return 0; } + @ConfigItem( keyName = "soundEffectVolume", name = "", 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 167032278a..dd99b8ad5e 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 @@ -37,13 +37,16 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; +import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.GameState; +import net.runelite.api.Player; 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.AreaSoundEffectPlayed; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.ScriptCallbackEvent; @@ -532,4 +535,16 @@ public class MusicPlugin extends Plugin client.getIntStack()[client.getIntStackSize() - 1] = -1; } } + + @Subscribe + public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed) + { + Actor source = areaSoundEffectPlayed.getSource(); + if (source != client.getLocalPlayer() + && source instanceof Player + && musicConfig.muteOtherAreaSounds()) + { + areaSoundEffectPlayed.consume(); + } + } } \ No newline at end of file From 423d16fa8e9dc9ff9933b71fe3d53117391a5879 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 26 Oct 2019 21:58:50 -0400 Subject: [PATCH 50/63] http-service: make mongo database configurable --- .../net/runelite/http/service/config/ConfigService.java | 6 ++++-- http-service/src/main/resources/application.yaml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java index bbe8557d88..727620570f 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java @@ -51,6 +51,7 @@ import net.runelite.http.api.config.ConfigEntry; import net.runelite.http.api.config.Configuration; import org.bson.Document; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @Service @@ -66,11 +67,12 @@ public class ConfigService @Autowired public ConfigService( - MongoClient mongoClient + MongoClient mongoClient, + @Value("${mongo.database}") String databaseName ) { - MongoDatabase database = mongoClient.getDatabase("config"); + MongoDatabase database = mongoClient.getDatabase(databaseName); MongoCollection collection = database.getCollection("config"); this.mongoCollection = collection; diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml index ce902b76cb..f5e1a799d9 100644 --- a/http-service/src/main/resources/application.yaml +++ b/http-service/src/main/resources/application.yaml @@ -32,6 +32,7 @@ redis: mongo: jndiName: java:comp/env/mongodb/runelite + database: runelite # Twitter client for feed runelite: From 53e56720fc5d18d0b43c079841444e4e2e6bb50d Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 27 Oct 2019 21:08:34 +0100 Subject: [PATCH 51/63] raids plugin: add option to manually broadcast layout Closes #9541 Signed-off-by: Tomas Slusny --- .../client/plugins/raids/RaidsConfig.java | 2 +- .../client/plugins/raids/RaidsOverlay.java | 3 +++ .../client/plugins/raids/RaidsPlugin.java | 24 ++++++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 2323a15a49..f92e483eae 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -160,6 +160,6 @@ public interface RaidsConfig extends Config ) default boolean layoutMessage() { - return true; + return false; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index 5ca7214b57..9613d2e643 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -30,6 +30,7 @@ import java.awt.Graphics2D; import javax.inject.Inject; import lombok.Setter; import net.runelite.api.Client; +import static net.runelite.api.MenuAction.RUNELITE_OVERLAY; import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import net.runelite.client.plugins.raids.solver.Room; import net.runelite.client.ui.overlay.Overlay; @@ -44,6 +45,7 @@ import net.runelite.client.ui.overlay.components.TitleComponent; public class RaidsOverlay extends Overlay { private static final int OLM_PLANE = 0; + static final String BROADCAST_ACTION = "Broadcast layout"; private Client client; private RaidsPlugin plugin; @@ -63,6 +65,7 @@ public class RaidsOverlay extends Overlay this.plugin = plugin; this.config = config; getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay")); + getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, BROADCAST_ACTION, "Raids overlay")); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 6508792768..7c075b8767 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -39,6 +39,7 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.InstanceTemplates; +import net.runelite.api.MenuAction; import net.runelite.api.NullObjectID; import static net.runelite.api.Perspective.SCENE_SIZE; import net.runelite.api.Point; @@ -56,6 +57,7 @@ import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.OverlayMenuClicked; import net.runelite.client.game.SpriteManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -253,6 +255,17 @@ public class RaidsPlugin extends Plugin } } + @Subscribe + public void onOverlayMenuClicked(final OverlayMenuClicked event) + { + if (event.getEntry().getMenuAction() == MenuAction.RUNELITE_OVERLAY && + event.getEntry().getOption().equals(RaidsOverlay.BROADCAST_ACTION) && + event.getOverlay() == overlay) + { + sendRaidLayoutMessage(); + } + } + private void checkRaidPresence(boolean force) { if (client.getGameState() != GameState.LOGGED_IN) @@ -288,7 +301,11 @@ public class RaidsPlugin extends Plugin raid.updateLayout(layout); RotationSolver.solve(raid.getCombatRooms()); overlay.setScoutOverlayShown(true); - sendRaidLayoutMessage(); + + if (config.layoutMessage()) + { + sendRaidLayoutMessage(); + } } else if (!config.scoutOverlayAtBank()) { @@ -305,11 +322,6 @@ public class RaidsPlugin extends Plugin private void sendRaidLayoutMessage() { - if (!config.layoutMessage()) - { - return; - } - final String layout = getRaid().getLayout().toCodeString(); final String rooms = getRaid().toRoomString(); final String raidData = "[" + layout + "]: " + rooms; From 5344cd6ddbd0e435bad7a088dbc266738319a5fc Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 27 Oct 2019 16:20:37 -0400 Subject: [PATCH 52/63] menu swapper: add pyramid plunder start-minigame and quick-leave Co-authored-by: MrH4mm3r --- .../MenuEntrySwapperConfig.java | 20 +++++++++++++++++++ .../MenuEntrySwapperPlugin.java | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index 13f780a823..ddd3a1513c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -321,4 +321,24 @@ public interface MenuEntrySwapperConfig extends Config { return false; } + + @ConfigItem( + keyName = "swapStartMinigame", + name = "Pyramid Plunder Start-minigame", + description = "Swap Talk-to with Start-minigame at the Guardian Mummy" + ) + default boolean swapStartMinigame() + { + return true; + } + + @ConfigItem( + keyName = "swapQuickleave", + name = "Quick-Leave", + description = "Swap Leave Tomb with Quick-Leave at Pyramid Plunder" + ) + default boolean swapQuickLeave() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 91fddefb66..7d37fae388 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -458,6 +458,15 @@ public class MenuEntrySwapperPlugin extends Plugin { swap("enchant", option, target, index); } + + if (config.swapStartMinigame()) + { + swap("start-minigame", option, target, index); + } + } + else if (config.swapQuickLeave() && option.equals("leave tomb") && target.equals("tomb door")) + { + swap("quick-leave", option, target, index); } else if (config.swapTravel() && option.equals("pass") && target.equals("energy barrier")) { From 897cfffa015ac322a538da1df16b1fe92d4b6be8 Mon Sep 17 00:00:00 2001 From: trimbe Date: Sun, 27 Oct 2019 13:37:44 -0400 Subject: [PATCH 53/63] tabinterface: remember search after clicking deposit-x --- .../runelite/client/plugins/banktags/tabs/TabInterface.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index e6a3683daa..61b992036e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -606,9 +606,11 @@ public class TabInterface chatboxPanelManager.close(); } - if (event.getWidgetId() == WidgetInfo.BANK_ITEM_CONTAINER.getId() + if ((event.getWidgetId() == WidgetInfo.BANK_ITEM_CONTAINER.getId() + || event.getWidgetId() == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getId()) && event.getMenuAction() == MenuAction.EXAMINE_ITEM_BANK_EQ - && event.getMenuOption().equalsIgnoreCase("withdraw-x")) + && (event.getMenuOption().equalsIgnoreCase("withdraw-x") + || event.getMenuOption().equalsIgnoreCase("deposit-x"))) { waitSearchTick = true; rememberedSearch = client.getVar(VarClientStr.INPUT_TEXT); From 6beddcb1e956c4b726f2b4fb8605fe230be28a52 Mon Sep 17 00:00:00 2001 From: Harry Freeborough Date: Mon, 28 Oct 2019 09:44:17 +0000 Subject: [PATCH 54/63] Correct capitalisations of "RuneScape" (#10142) --- .../main/java/net/runelite/client/config/ChatColorConfig.java | 4 ++-- .../plugins/cluescrolls/clues/hotcold/HotColdSolver.java | 2 +- .../net/runelite/client/plugins/hiscore/HiscorePanel.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java index c9a3e40d3d..e57be2942b 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java @@ -164,7 +164,7 @@ public interface ChatColorConfig extends Config position = 45, keyName = "opaqueServerMessage", name = "Server message", - description = "Color of Server Messages (eg. 'Welcome to Runescape')" + description = "Color of Server Messages (eg. 'Welcome to RuneScape')" ) Color opaqueServerMessage(); @@ -404,7 +404,7 @@ public interface ChatColorConfig extends Config position = 75, keyName = "transparentServerMessage", name = "Server message (transparent)", - description = "Color of Server Messages (eg. 'Welcome to Runescape') (transparent)" + description = "Color of Server Messages (eg. 'Welcome to RuneScape') (transparent)" ) Color transparentServerMessage(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java index 87414f0387..052fef03ea 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java @@ -38,7 +38,7 @@ import net.runelite.api.coords.WorldPoint; *

* These puzzles are established by having some way to test the distance from the solution via "warmth", where being * colder means one is farther away from the target, and being warmer means one is closer to it, with the goal being to - * reach the most warm value to discover the solution point. Hot-cold puzzles in Old School Runescape are implemented + * reach the most warm value to discover the solution point. Hot-cold puzzles in Old School RuneScape are implemented * with specific set of solution points, so this solver will filter from a provided set of possible solutions as new * signals of temperatures and temperature changes are provided. */ diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java index 0ddb3372f3..d61f8866db 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java @@ -97,7 +97,7 @@ import net.runelite.http.api.hiscore.Skill; @Slf4j public class HiscorePanel extends PluginPanel { - /* The maximum allowed username length in runescape accounts */ + /* The maximum allowed username length in RuneScape accounts */ private static final int MAX_USERNAME_LENGTH = 12; /** @@ -345,7 +345,7 @@ public class HiscorePanel extends PluginPanel return; } - /* Runescape usernames can't be longer than 12 characters long */ + /* RuneScape usernames can't be longer than 12 characters long */ if (lookup.length() > MAX_USERNAME_LENGTH) { searchBar.setIcon(IconTextField.Icon.ERROR); From 151ea90b2fbf95ab1abf68a6300a7486ad118294 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 16:14:10 -0400 Subject: [PATCH 55/63] barrows plugin: remove minimap Removed at Jagex's request --- .../client/plugins/barrows/BarrowsConfig.java | 11 -- .../plugins/barrows/BarrowsOverlay.java | 134 +----------------- .../client/plugins/barrows/BarrowsPlugin.java | 97 +------------ 3 files changed, 2 insertions(+), 240 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java index 663e03fbb3..fe6a657e5e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java @@ -32,17 +32,6 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("barrows") public interface BarrowsConfig extends Config { - @ConfigItem( - keyName = "showMinimap", - name = "Show Minimap in tunnels", - description = "Configures whether or not the minimap is displayed", - position = 0 - ) - default boolean showMinimap() - { - return true; - } - @ConfigItem( keyName = "showBrotherLoc", name = "Show Brothers location", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java index 4ecdebccf3..d430ef0c01 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java @@ -28,16 +28,9 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; -import java.util.List; import javax.inject.Inject; import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.NPC; -import net.runelite.api.NPCComposition; -import net.runelite.api.ObjectComposition; import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.WallObject; import net.runelite.api.coords.LocalPoint; import net.runelite.api.widgets.Widget; import net.runelite.client.ui.overlay.Overlay; @@ -65,59 +58,9 @@ class BarrowsOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - Player local = client.getLocalPlayer(); - final Color npcColor = getMinimapDotColor(1); - final Color playerColor = getMinimapDotColor(2); Widget puzzleAnswer = plugin.getPuzzleAnswer(); - // tunnels are only on z=0 - if (!plugin.getWalls().isEmpty() && client.getPlane() == 0 && config.showMinimap()) - { - // NPC dots - graphics.setColor(npcColor); - final List npcs = client.getNpcs(); - for (NPC npc : npcs) - { - final NPCComposition composition = npc.getComposition(); - - if (composition != null && !composition.isMinimapVisible()) - { - continue; - } - - net.runelite.api.Point minimapLocation = npc.getMinimapLocation(); - if (minimapLocation != null) - { - graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 4, 4); - } - } - - // Player dots - graphics.setColor(playerColor); - final List players = client.getPlayers(); - for (Player player : players) - { - if (player == local) - { - // Skip local player as we draw square for it later - continue; - } - - net.runelite.api.Point minimapLocation = player.getMinimapLocation(); - if (minimapLocation != null) - { - graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 4, 4); - } - } - - // Render barrows walls/doors - renderObjects(graphics, local); - - // Local player square - graphics.setColor(playerColor); - graphics.fillRect(local.getMinimapLocation().getX(), local.getMinimapLocation().getY(), 3, 3); - } - else if (config.showBrotherLoc()) + if (config.showBrotherLoc()) { renderBarrowsBrothers(graphics); } @@ -132,81 +75,6 @@ class BarrowsOverlay extends Overlay return null; } - private void renderObjects(Graphics2D graphics, Player localPlayer) - { - LocalPoint localLocation = localPlayer.getLocalLocation(); - for (WallObject wall : plugin.getWalls()) - { - LocalPoint location = wall.getLocalLocation(); - if (localLocation.distanceTo(location) <= MAX_DISTANCE) - { - renderWalls(graphics, wall); - } - } - - for (GameObject ladder : plugin.getLadders()) - { - LocalPoint location = ladder.getLocalLocation(); - if (localLocation.distanceTo(location) <= MAX_DISTANCE) - { - renderLadders(graphics, ladder); - } - } - } - - private void renderWalls(Graphics2D graphics, WallObject wall) - { - net.runelite.api.Point minimapLocation = wall.getMinimapLocation(); - - if (minimapLocation == null) - { - return; - } - - ObjectComposition objectComp = client.getObjectDefinition(wall.getId()); - ObjectComposition impostor = objectComp.getImpostorIds() != null ? objectComp.getImpostor() : null; - - if (impostor != null && impostor.getActions()[0] != null) - { - graphics.setColor(Color.green); - } - else - { - graphics.setColor(Color.gray); - } - - graphics.fillRect(minimapLocation.getX(), minimapLocation.getY(), 3, 3); - } - - /** - * Get minimap dot color from client - * @param typeIndex index of minimap dot type (1 npcs, 2 players) - * @return color - */ - private Color getMinimapDotColor(int typeIndex) - { - final int pixel = client.getMapDots()[typeIndex].getPixels()[1]; - return new Color(pixel); - } - - private void renderLadders(Graphics2D graphics, GameObject ladder) - { - net.runelite.api.Point minimapLocation = ladder.getMinimapLocation(); - - if (minimapLocation == null) - { - return; - } - - ObjectComposition objectComp = client.getObjectDefinition(ladder.getId()); - - if (objectComp.getImpostorIds() != null && objectComp.getImpostor() != null) - { - graphics.setColor(Color.orange); - graphics.fillRect(minimapLocation.getX(), minimapLocation.getY(), 6, 6); - } - } - private void renderBarrowsBrothers(Graphics2D graphics) { for (BarrowsBrothers brother : BarrowsBrothers.values()) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java index 2d4db73d12..77619ba55a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java @@ -25,33 +25,19 @@ package net.runelite.client.plugins.barrows; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Sets; import com.google.inject.Provides; import java.time.temporal.ChronoUnit; -import java.util.HashSet; -import java.util.Set; import javax.inject.Inject; -import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; -import net.runelite.api.GameObject; import net.runelite.api.GameState; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; -import net.runelite.api.NullObjectID; -import net.runelite.api.ObjectID; import net.runelite.api.SpriteID; -import net.runelite.api.WallObject; import net.runelite.api.events.ConfigChanged; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WallObjectChanged; -import net.runelite.api.events.WallObjectDespawned; -import net.runelite.api.events.WallObjectSpawned; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; @@ -75,21 +61,10 @@ import net.runelite.client.util.QuantityFormatter; @PluginDescriptor( name = "Barrows Brothers", description = "Show helpful information for the Barrows minigame", - tags = {"combat", "minigame", "minimap", "bosses", "pve", "pvm"} + tags = {"combat", "minigame", "bosses", "pve", "pvm"} ) public class BarrowsPlugin extends Plugin { - @Getter(AccessLevel.PACKAGE) - private static final Set BARROWS_WALLS = Sets.newHashSet - ( - ObjectID.DOOR_20678, NullObjectID.NULL_20681, NullObjectID.NULL_20682, NullObjectID.NULL_20683, NullObjectID.NULL_20684, NullObjectID.NULL_20685, NullObjectID.NULL_20686, NullObjectID.NULL_20687, - NullObjectID.NULL_20688, NullObjectID.NULL_20689, NullObjectID.NULL_20690, NullObjectID.NULL_20691, NullObjectID.NULL_20692, NullObjectID.NULL_20693, NullObjectID.NULL_20694, NullObjectID.NULL_20695, - NullObjectID.NULL_20696, ObjectID.DOOR_20697, NullObjectID.NULL_20700, NullObjectID.NULL_20701, NullObjectID.NULL_20702, NullObjectID.NULL_20703, NullObjectID.NULL_20704, NullObjectID.NULL_20705, - NullObjectID.NULL_20706, NullObjectID.NULL_20707, NullObjectID.NULL_20708, NullObjectID.NULL_20709, NullObjectID.NULL_20710, NullObjectID.NULL_20711, NullObjectID.NULL_20712, NullObjectID.NULL_20713, - NullObjectID.NULL_20714, NullObjectID.NULL_20715, NullObjectID.NULL_20728, NullObjectID.NULL_20730 - ); - - private static final Set BARROWS_LADDERS = Sets.newHashSet(NullObjectID.NULL_20675, NullObjectID.NULL_20676, NullObjectID.NULL_20677); private static final ImmutableList POSSIBLE_SOLUTIONS = ImmutableList.of( WidgetInfo.BARROWS_PUZZLE_ANSWER1, WidgetInfo.BARROWS_PUZZLE_ANSWER2, @@ -99,12 +74,6 @@ public class BarrowsPlugin extends Plugin private static final long PRAYER_DRAIN_INTERVAL_MS = 18200; private static final int CRYPT_REGION_ID = 14231; - @Getter(AccessLevel.PACKAGE) - private final Set walls = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - private final Set ladders = new HashSet<>(); - private LoopTimer barrowsPrayerDrainTimer; private boolean wasInCrypt = false; @@ -156,8 +125,6 @@ public class BarrowsPlugin extends Plugin { overlayManager.remove(barrowsOverlay); overlayManager.remove(brotherOverlay); - walls.clear(); - ladders.clear(); puzzleAnswer = null; wasInCrypt = false; stopPrayerDrainTimer(); @@ -185,66 +152,6 @@ public class BarrowsPlugin extends Plugin } } - @Subscribe - public void onWallObjectSpawned(WallObjectSpawned event) - { - WallObject wallObject = event.getWallObject(); - if (BARROWS_WALLS.contains(wallObject.getId())) - { - walls.add(wallObject); - } - } - - @Subscribe - public void onWallObjectChanged(WallObjectChanged event) - { - WallObject previous = event.getPrevious(); - WallObject wallObject = event.getWallObject(); - - walls.remove(previous); - if (BARROWS_WALLS.contains(wallObject.getId())) - { - walls.add(wallObject); - } - } - - @Subscribe - public void onWallObjectDespawned(WallObjectDespawned event) - { - WallObject wallObject = event.getWallObject(); - walls.remove(wallObject); - } - - @Subscribe - public void onGameObjectSpawned(GameObjectSpawned event) - { - GameObject gameObject = event.getGameObject(); - if (BARROWS_LADDERS.contains(gameObject.getId())) - { - ladders.add(gameObject); - } - } - - @Subscribe - public void onGameObjectChanged(GameObjectChanged event) - { - GameObject previous = event.getPrevious(); - GameObject gameObject = event.getGameObject(); - - ladders.remove(previous); - if (BARROWS_LADDERS.contains(gameObject.getId())) - { - ladders.add(gameObject); - } - } - - @Subscribe - public void onGameObjectDespawned(GameObjectDespawned event) - { - GameObject gameObject = event.getGameObject(); - ladders.remove(gameObject); - } - @Subscribe public void onGameStateChanged(GameStateChanged event) { @@ -252,8 +159,6 @@ public class BarrowsPlugin extends Plugin { wasInCrypt = isInCrypt(); // on region changes the tiles get set to null - walls.clear(); - ladders.clear(); puzzleAnswer = null; } else if (event.getGameState() == GameState.LOGGED_IN) From a2166f121599c8c570c1f336400971c487f3844b Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 18:05:35 -0400 Subject: [PATCH 56/63] http-api: centralize json mediatype --- http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java | 2 ++ .../java/net/runelite/http/api/ge/GrandExchangeClient.java | 3 +-- .../net/runelite/http/api/loottracker/LootTrackerClient.java | 3 +-- .../src/main/java/net/runelite/http/api/xtea/XteaClient.java | 4 +--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java b/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java index 472c241f72..2f0ba34bc0 100644 --- a/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java +++ b/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java @@ -31,6 +31,7 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; import okhttp3.HttpUrl; import okhttp3.Interceptor; +import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -45,6 +46,7 @@ public class RuneLiteAPI public static final OkHttpClient CLIENT; public static final Gson GSON = new Gson(); + public static final MediaType JSON = MediaType.parse("application/json"); public static String userAgent; private static final String BASE = "https://api.runelite.net"; diff --git a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java index a1b97bc390..78e64d383a 100644 --- a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java +++ b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java @@ -30,10 +30,10 @@ import java.util.UUID; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; +import static net.runelite.http.api.RuneLiteAPI.JSON; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; -import okhttp3.MediaType; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; @@ -42,7 +42,6 @@ import okhttp3.Response; @AllArgsConstructor public class GrandExchangeClient { - private static final MediaType JSON = MediaType.parse("application/json"); private static final Gson GSON = RuneLiteAPI.GSON; private final UUID uuid; diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java index 59d1a567ff..71eb151364 100644 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java +++ b/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java @@ -36,10 +36,10 @@ import java.util.UUID; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; +import static net.runelite.http.api.RuneLiteAPI.JSON; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; -import okhttp3.MediaType; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; @@ -48,7 +48,6 @@ import okhttp3.Response; @AllArgsConstructor public class LootTrackerClient { - private static final MediaType JSON = MediaType.parse("application/json"); private static final Gson GSON = RuneLiteAPI.GSON; private final UUID uuid; diff --git a/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java b/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java index e4ee2c22b9..42b10e3239 100644 --- a/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java +++ b/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java @@ -31,10 +31,10 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; import net.runelite.http.api.RuneLiteAPI; +import static net.runelite.http.api.RuneLiteAPI.JSON; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; -import okhttp3.MediaType; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; @@ -43,8 +43,6 @@ import org.slf4j.LoggerFactory; public class XteaClient { - private static final MediaType JSON = MediaType.parse("application/json"); - private static final Logger logger = LoggerFactory.getLogger(XteaClient.class); public void submit(XteaRequest xteaRequest) From 66e7acd86f11b0ab2a813a759b6dcc87392b4672 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 24 Oct 2019 13:29:05 -0600 Subject: [PATCH 57/63] music: check parent and siblings for null --- .../client/plugins/music/MusicPlugin.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) 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 dd99b8ad5e..6f3496a922 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 @@ -411,13 +411,21 @@ public class MusicPlugin extends Plugin { { Widget handle = slider.getHandle(); - Widget[] siblings = handle.getParent().getChildren(); - if (siblings.length < handle.getIndex() || siblings[handle.getIndex()] != handle) + Widget parent = handle.getParent(); + if (parent == null) { continue; } - siblings[slider.getTrack().getIndex()] = null; - siblings[handle.getIndex()] = null; + else + { + Widget[] siblings = parent.getChildren(); + if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle) + { + continue; + } + siblings[slider.getTrack().getIndex()] = null; + siblings[handle.getIndex()] = null; + } } Object[] init = icon.getOnLoadListener(); @@ -444,11 +452,19 @@ public class MusicPlugin extends Plugin Widget handle = slider.getHandle(); if (handle != null) { - Widget[] siblings = handle.getParent().getChildren(); - if (siblings.length < handle.getIndex() || siblings[handle.getIndex()] != handle) + Widget parent = handle.getParent(); + if (parent == null) { handle = null; } + else + { + Widget[] siblings = parent.getChildren(); + if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle) + { + handle = null; + } + } } if (handle == null) { From b123ad667a8f4f14419f4c27454d7506820fdccb Mon Sep 17 00:00:00 2001 From: Joel <47850057+PERSS0N@users.noreply.github.com> Date: Tue, 29 Oct 2019 23:01:20 +0100 Subject: [PATCH 58/63] Add item mapping for Berserker Necklace (or) (#10158) --- .../src/main/java/net/runelite/client/game/ItemMapping.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java index 638dfcb19b..47cb63556e 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java @@ -106,6 +106,8 @@ public enum ItemMapping ITEM_FURY_ORNAMENT_KIT(FURY_ORNAMENT_KIT, AMULET_OF_FURY_OR), ITEM_TORMENTED_BRACELET(TORMENTED_BRACELET, TORMENTED_BRACELET_OR), ITEM_TORMENTED_ORNAMENT_KIT(TORMENTED_ORNAMENT_KIT, TORMENTED_BRACELET_OR), + ITEM_BERSERKER_NECKLACE(BERSERKER_NECKLACE, BERSERKER_NECKLACE_OR), + ITEM_BERSERKER_NECKLACE_ORNAMENT_KIT(BERSERKER_NECKLACE_ORNAMENT_KIT, BERSERKER_NECKLACE_OR), // Ensouled heads ITEM_ENSOULED_GOBLIN_HEAD(ENSOULED_GOBLIN_HEAD_13448, ENSOULED_GOBLIN_HEAD), From 2655654c9f052bfeb51cac53be63b62f13f3c4ea Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Wed, 30 Oct 2019 04:22:38 +0100 Subject: [PATCH 59/63] project: merge upstream --- .../cache/definitions/NpcDefinition.java | 53 +++++++++--------- .../cache/definitions/loaders/NpcLoader.java | 56 +++++++++---------- .../cache/definitions/savers/NpcSaver.java | 48 ++++++++-------- .../http/service/config/ConfigService.java | 6 +- .../src/main/resources/application.yaml | 1 + .../api/events/AreaSoundEffectPlayed.java | 11 ++++ .../api/events/SoundEffectPlayed.java | 11 ++++ .../runelite/api/events/VolumeChanged.java | 24 +++++--- .../plugins/devtools/SoundEffectOverlay.java | 1 + .../runelite/client/plugins/gpu/GLUtil.java | 3 + .../client/plugins/music/MusicConfig.java | 11 ++++ .../client/plugins/music/MusicPlugin.java | 18 +++++- .../client/plugins/raids/RaidsConfig.java | 2 +- .../client/plugins/raids/RaidsOverlay.java | 3 + .../client/plugins/raids/RaidsPlugin.java | 42 +++++++------- .../plugins/worldmap/QuestStartLocation.java | 4 +- .../runelite/client/plugins/gpu/common.glsl | 6 +- .../client/plugins/gpu/common_func.glsl | 6 +- .../net/runelite/client/plugins/gpu/geom.glsl | 6 +- .../client/plugins/gpu/to_screen.glsl | 26 ++++----- .../net/runelite/mixins/RSClientMixin.java | 3 +- .../net/runelite/mixins/SoundEffectMixin.java | 4 +- .../data/dump/wiki/NpcStatsDumper.java | 2 +- 23 files changed, 206 insertions(+), 141 deletions(-) diff --git a/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java b/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java index 8ba160c97a..ddfabfe367 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java +++ b/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java @@ -31,38 +31,37 @@ import lombok.Data; @Data public class NpcDefinition { - public final int id; - public short[] recolorToFind; - public int rotation = 32; public String name = "null"; - public short[] recolorToReplace; + public int size = 1; public int[] models; - public int[] models_2; - public int stanceAnimation = -1; - public int anInt2165 = -1; - public int tileSpacesOccupied = 1; - public int walkAnimation = -1; - public short[] retextureToReplace; - public int rotate90RightAnimation = -1; - public boolean aBool2170 = true; - public int resizeX = 128; - public int contrast = 0; + public int[] chatheadModels; + public int standingAnimation = -1; + public int rotateLeftAnimation = -1; + public int rotateRightAnimation = -1; + public int walkingAnimation = -1; public int rotate180Animation = -1; - public int varbitIndex = -1; - public String[] options = new String[5]; - public boolean renderOnMinimap = true; - public int combatLevel = -1; + public int rotate90RightAnimation = -1; public int rotate90LeftAnimation = -1; - public int resizeY = 128; - public boolean hasRenderPriority = false; - public int ambient = 0; - public int headIcon = -1; - public int[] configs; + public short[] recolorToFind; + public short[] recolorToReplace; public short[] retextureToFind; + public short[] retextureToReplace; + public String[] actions = new String[5]; + public boolean isMinimapVisible = true; + public int combatLevel = -1; + public int widthScale = 128; + public int heightScale = 128; + public boolean hasRenderPriority; + public int ambient; + public int contrast; + public int headIcon = -1; + public int rotationSpeed = 32; + public int[] configs; + public int varbitId = -1; public int varpIndex = -1; - public boolean isClickable = true; - public int anInt2189 = -1; - public boolean aBool2190 = false; - public Map params = null; + public boolean isInteractable = true; + public boolean rotationFlag = true; + public boolean isPet; + public Map params; } diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java index 478ef2660a..0ce81f864b 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java @@ -24,13 +24,12 @@ */ package net.runelite.cache.definitions.loaders; +import java.util.HashMap; import net.runelite.cache.definitions.NpcDefinition; import net.runelite.cache.io.InputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; - public class NpcLoader { private static final Logger logger = LoggerFactory.getLogger(NpcLoader.class); @@ -67,7 +66,6 @@ public class NpcLoader { def.models[index] = stream.readUnsignedShort(); } - } else if (opcode == 2) { @@ -75,37 +73,37 @@ public class NpcLoader } else if (opcode == 12) { - def.tileSpacesOccupied = stream.readUnsignedByte(); + def.size = stream.readUnsignedByte(); } else if (opcode == 13) { - def.stanceAnimation = stream.readUnsignedShort(); + def.standingAnimation = stream.readUnsignedShort(); } else if (opcode == 14) { - def.walkAnimation = stream.readUnsignedShort(); + def.walkingAnimation = stream.readUnsignedShort(); } else if (opcode == 15) { - def.anInt2165 = stream.readUnsignedShort(); + def.rotateLeftAnimation = stream.readUnsignedShort(); } else if (opcode == 16) { - def.anInt2189 = stream.readUnsignedShort(); + def.rotateRightAnimation = stream.readUnsignedShort(); } else if (opcode == 17) { - def.walkAnimation = stream.readUnsignedShort(); + def.walkingAnimation = stream.readUnsignedShort(); def.rotate180Animation = stream.readUnsignedShort(); def.rotate90RightAnimation = stream.readUnsignedShort(); def.rotate90LeftAnimation = stream.readUnsignedShort(); } else if (opcode >= 30 && opcode < 35) { - def.options[opcode - 30] = stream.readString(); - if (def.options[opcode - 30].equalsIgnoreCase("Hidden")) + def.actions[opcode - 30] = stream.readString(); + if (def.actions[opcode - 30].equalsIgnoreCase("Hidden")) { - def.options[opcode - 30] = null; + def.actions[opcode - 30] = null; } } else if (opcode == 40) @@ -137,17 +135,17 @@ public class NpcLoader else if (opcode == 60) { length = stream.readUnsignedByte(); - def.models_2 = new int[length]; + def.chatheadModels = new int[length]; for (index = 0; index < length; ++index) { - def.models_2[index] = stream.readUnsignedShort(); + def.chatheadModels[index] = stream.readUnsignedShort(); } } else if (opcode == 93) { - def.renderOnMinimap = false; + def.isMinimapVisible = false; } else if (opcode == 95) { @@ -155,11 +153,11 @@ public class NpcLoader } else if (opcode == 97) { - def.resizeX = stream.readUnsignedShort(); + def.widthScale = stream.readUnsignedShort(); } else if (opcode == 98) { - def.resizeY = stream.readUnsignedShort(); + def.heightScale = stream.readUnsignedShort(); } else if (opcode == 99) { @@ -179,18 +177,18 @@ public class NpcLoader } else if (opcode == 103) { - def.rotation = stream.readUnsignedShort(); + def.rotationSpeed = stream.readUnsignedShort(); } else if (opcode == 106) { - def.varbitIndex = stream.readUnsignedShort(); - if ('\uffff' == def.varbitIndex) + def.varbitId = stream.readUnsignedShort(); + if (def.varbitId == 65535) { - def.varbitIndex = -1; + def.varbitId = -1; } def.varpIndex = stream.readUnsignedShort(); - if ('\uffff' == def.varpIndex) + if (def.varpIndex == 65535) { def.varpIndex = -1; } @@ -212,26 +210,26 @@ public class NpcLoader } else if (opcode == 107) { - def.isClickable = false; + def.isInteractable = false; } else if (opcode == 109) { - def.aBool2170 = false; + def.rotationFlag = false; } else if (opcode == 111) { - def.aBool2190 = true; + def.isPet = true; } else if (opcode == 118) { - def.varbitIndex = stream.readUnsignedShort(); - if ('\uffff' == def.varbitIndex) + def.varbitId = stream.readUnsignedShort(); + if (def.varbitId == 65535) { - def.varbitIndex = -1; + def.varbitId = -1; } def.varpIndex = stream.readUnsignedShort(); - if ('\uffff' == def.varpIndex) + if (def.varpIndex == 65535) { def.varpIndex = -1; } diff --git a/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java b/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java index 55d4b966e9..577681cf80 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java +++ b/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java @@ -47,45 +47,45 @@ public class NpcSaver out.writeByte(2); out.writeString(npc.name); } - if (npc.tileSpacesOccupied != 1) + if (npc.size != 1) { out.writeByte(12); - out.writeByte(npc.tileSpacesOccupied); + out.writeByte(npc.size); } - if (npc.stanceAnimation != -1) + if (npc.standingAnimation != -1) { out.writeByte(13); - out.writeShort(npc.stanceAnimation); + out.writeShort(npc.standingAnimation); } - if (npc.walkAnimation != -1) + if (npc.walkingAnimation != -1) { out.writeByte(14); - out.writeShort(npc.walkAnimation); + out.writeShort(npc.walkingAnimation); } - if (npc.anInt2165 != -1) + if (npc.rotateLeftAnimation != -1) { out.writeByte(15); - out.writeShort(npc.anInt2165); + out.writeShort(npc.rotateLeftAnimation); } - if (npc.anInt2189 != -1) + if (npc.rotateRightAnimation != -1) { out.writeByte(16); - out.writeShort(npc.anInt2189); + out.writeShort(npc.rotateRightAnimation); } if (npc.rotate180Animation != -1 || npc.rotate90LeftAnimation != -1 || npc.rotate90RightAnimation != -1) { out.writeByte(17); - out.writeShort(npc.walkAnimation); + out.writeShort(npc.walkingAnimation); out.writeShort(npc.rotate180Animation); out.writeShort(npc.rotate90RightAnimation); out.writeShort(npc.rotate90LeftAnimation); } for (int i = 0; i < 5; ++i) { - if (npc.options[i] != null) + if (npc.actions[i] != null) { out.writeByte(30 + i); - out.writeString(npc.options[i]); + out.writeString(npc.actions[i]); } } if (npc.recolorToFind != null && npc.recolorToReplace != null) @@ -108,16 +108,16 @@ public class NpcSaver out.writeShort(npc.retextureToReplace[i]); } } - if (npc.models_2 != null) + if (npc.chatheadModels != null) { out.writeByte(60); - out.writeByte(npc.models_2.length); - for (int modelId : npc.models_2) + out.writeByte(npc.chatheadModels.length); + for (int modelId : npc.chatheadModels) { out.writeShort(modelId); } } - if (!npc.renderOnMinimap) + if (!npc.isMinimapVisible) { out.writeByte(93); } @@ -127,9 +127,9 @@ public class NpcSaver out.writeShort(npc.combatLevel); } out.writeByte(97); - out.writeShort(npc.resizeX); + out.writeShort(npc.widthScale); out.writeByte(98); - out.writeShort(npc.resizeY); + out.writeShort(npc.heightScale); if (npc.hasRenderPriority) { out.writeByte(99); @@ -144,23 +144,23 @@ public class NpcSaver out.writeShort(npc.headIcon); } out.writeByte(103); - out.writeShort(npc.rotation); - if (!npc.isClickable) + out.writeShort(npc.rotationSpeed); + if (!npc.isInteractable) { out.writeByte(107); } - if (!npc.aBool2170) + if (!npc.rotationFlag) { out.writeByte(109); } - if (npc.aBool2190) + if (npc.isPet) { out.writeByte(111); } if (npc.configs != null) { out.writeByte(118); - out.writeShort(npc.varbitIndex); + out.writeShort(npc.varbitId); out.writeShort(npc.varpIndex); int[] c = npc.configs; diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java index bbe8557d88..727620570f 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java @@ -51,6 +51,7 @@ import net.runelite.http.api.config.ConfigEntry; import net.runelite.http.api.config.Configuration; import org.bson.Document; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @Service @@ -66,11 +67,12 @@ public class ConfigService @Autowired public ConfigService( - MongoClient mongoClient + MongoClient mongoClient, + @Value("${mongo.database}") String databaseName ) { - MongoDatabase database = mongoClient.getDatabase("config"); + MongoDatabase database = mongoClient.getDatabase(databaseName); MongoCollection collection = database.getCollection("config"); this.mongoCollection = collection; diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml index ce902b76cb..f5e1a799d9 100644 --- a/http-service/src/main/resources/application.yaml +++ b/http-service/src/main/resources/application.yaml @@ -32,6 +32,7 @@ redis: mongo: jndiName: java:comp/env/mongodb/runelite + database: runelite # Twitter client for feed runelite: diff --git a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java index 084ba26f73..13f76eab65 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java @@ -24,14 +24,25 @@ */ package net.runelite.api.events; +import javax.annotation.Nullable; import lombok.Data; +import net.runelite.api.Actor; @Data public class AreaSoundEffectPlayed implements Event { + @Nullable + private final Actor source; private int soundId; private int sceneX; private int sceneY; private int range; private int delay; + + private boolean consumed; + + public void consume() + { + consumed = true; + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java index 640a5f1282..628ba5b58d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java @@ -24,11 +24,22 @@ */ package net.runelite.api.events; +import javax.annotation.Nullable; import lombok.Data; +import net.runelite.api.Actor; @Data public class SoundEffectPlayed implements Event { + @Nullable + private final Actor source; private int soundId; private int delay; + + private boolean consumed; + + public void consume() + { + consumed = true; + } } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java index 7f846cd214..d5aa7da10e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java @@ -1,15 +1,16 @@ /* - * Copyright (c) 2017, Adam + * Copyright (c) 2019, Adam + * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. + * 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 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 @@ -24,12 +25,17 @@ */ package net.runelite.api.events; +import lombok.Value; + +@Value public class VolumeChanged implements Event { - public static final VolumeChanged INSTANCE = new VolumeChanged(); - - private VolumeChanged() + public enum Type { - // noop + MUSIC, + EFFECTS, + AREA } -} + + private final Type type; +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java index e98e0ef01e..ea9f060ee6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java @@ -110,6 +110,7 @@ class SoundEffectOverlay extends Overlay String text = "Id: " + event.getSoundId() + + " - S: " + (event.getSource() != null ? event.getSource().getName() : "") + " - L: " + event.getSceneX() + "," + event.getSceneY() + " - R: " + event.getRange() + " - D: " + event.getDelay(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GLUtil.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GLUtil.java index 48b597c2c0..7c51d67e62 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GLUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GLUtil.java @@ -27,7 +27,9 @@ package net.runelite.client.plugins.gpu; import com.jogamp.opengl.GL4; import java.io.InputStream; import java.util.Scanner; +import lombok.extern.slf4j.Slf4j; +@Slf4j class GLUtil { private static final int ERR_LEN = 1024; @@ -197,6 +199,7 @@ class GLUtil else { String err = glGetShaderInfoLog(gl, shader); + log.info(String.valueOf(program)); throw new ShaderException(err); } } 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 fa2ebbcbbd..94f30fd07c 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 @@ -31,6 +31,16 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("music") public interface MusicConfig extends Config { + @ConfigItem( + keyName = "muteOtherAreaSounds", + name = "Mute others' area sounds", + description = "Mute area sounds caused from other players" + ) + default boolean muteOtherAreaSounds() + { + return false; + } + @ConfigItem( keyName = "musicVolume", name = "", @@ -60,6 +70,7 @@ public interface MusicConfig extends Config { return 0; } + @ConfigItem( keyName = "soundEffectVolume", name = "", 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 5d251e19ae..183e1deee7 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 @@ -38,13 +38,16 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.GameState; +import net.runelite.api.Player; 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.AreaSoundEffectPlayed; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.ScriptCallbackEvent; @@ -138,6 +141,7 @@ public class MusicPlugin extends Plugin eventBus.subscribe(VarClientIntChanged.class, this, this::onVarClientIntChanged); eventBus.subscribe(VolumeChanged.class, this, this::onVolumeChanged); eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent); + eventBus.subscribe(AreaSoundEffectPlayed.class, this, this::onAreaSoundEffectPlayed); } private void onGameStateChanged(GameStateChanged gameStateChanged) @@ -216,6 +220,7 @@ public class MusicPlugin extends Plugin private void onVolumeChanged(VolumeChanged volumeChanged) { + log.info(volumeChanged.getType().toString()); applyMusicVolumeConfig(); } @@ -229,8 +234,6 @@ public class MusicPlugin extends Plugin private void applyMusicVolumeConfig() { - log.info("applyMusicVolumeConfig"); - int musicVolume = musicConfig.getMusicVolume(); if (musicVolume > 0) { @@ -546,4 +549,15 @@ public class MusicPlugin extends Plugin client.getIntStack()[client.getIntStackSize() - 1] = -1; } } + + private void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed) + { + Actor source = areaSoundEffectPlayed.getSource(); + if (source != client.getLocalPlayer() + && source instanceof Player + && musicConfig.muteOtherAreaSounds()) + { + areaSoundEffectPlayed.consume(); + } + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index b52e719b2b..419ec8cefb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -203,7 +203,7 @@ public interface RaidsConfig extends Config ) default boolean displayLayoutMessage() { - return true; + return false; } @ConfigTitleSection( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index c8c2d2bdd3..0288f106d9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -41,6 +41,7 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.runelite.api.Client; +import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY; import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; import net.runelite.api.SpriteID; import net.runelite.api.widgets.WidgetInfo; @@ -72,6 +73,7 @@ public class RaidsOverlay extends Overlay private static final int SMALL_ICON_SIZE = 21; private static final int TITLE_COMPONENT_HEIGHT = 20; private static final int LINE_COMPONENT_HEIGHT = 16; + static final String BROADCAST_ACTION = "Broadcast layout"; private final PanelComponent panelComponent = new PanelComponent(); private final ItemManager itemManager; private final SpriteManager spriteManager; @@ -101,6 +103,7 @@ public class RaidsOverlay extends Overlay this.itemManager = itemManager; this.spriteManager = spriteManager; getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay")); + getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, BROADCAST_ACTION, "Raids overlay")); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 6e345fe977..b433251e6f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -550,21 +550,27 @@ public class RaidsPlugin extends Plugin private void onOverlayMenuClicked(OverlayMenuClicked event) { OverlayMenuEntry entry = event.getEntry(); - if (entry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY && - entry.getTarget().equals("Raids party overlay")) + if (entry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY) { - switch (entry.getOption()) + if (entry.getTarget().equals("Raids party overlay")) { - case RaidsPartyOverlay.PARTY_OVERLAY_RESET: - startingPartyMembers.clear(); - updatePartyMembers(true); - missingPartyMembers.clear(); - break; - case RaidsPartyOverlay.PARTY_OVERLAY_REFRESH: - updatePartyMembers(true); - break; - default: - break; + switch (entry.getOption()) + { + case RaidsPartyOverlay.PARTY_OVERLAY_RESET: + startingPartyMembers.clear(); + updatePartyMembers(true); + missingPartyMembers.clear(); + break; + case RaidsPartyOverlay.PARTY_OVERLAY_REFRESH: + updatePartyMembers(true); + break; + default: + break; + } + } + else if (entry.getOption().equals(RaidsOverlay.BROADCAST_ACTION) && event.getOverlay() == overlay) + { + sendRaidLayoutMessage(); } } } @@ -670,7 +676,10 @@ public class RaidsPlugin extends Plugin raid.updateLayout(layout); RotationSolver.solve(raid.getCombatRooms()); setOverlayStatus(true); - sendRaidLayoutMessage(); + if (this.displayLayoutMessage) + { + sendRaidLayoutMessage(); + } Matcher puzzleMatch = PUZZLES.matcher(raid.getFullRotationString()); final List puzzles = new ArrayList<>(); while (puzzleMatch.find()) @@ -709,11 +718,6 @@ public class RaidsPlugin extends Plugin private void sendRaidLayoutMessage() { - if (!this.displayLayoutMessage) - { - return; - } - final String layout = getRaid().getLayout().toCodeString(); final String rooms = getRaid().toRoomString(); final String raidData = "[" + layout + "]: " + rooms; 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 5991410161..3014e0f0b5 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 @@ -58,7 +58,7 @@ enum QuestStartLocation //Members' Quests ANIMAL_MAGNETISM(Quest.ANIMAL_MAGNETISM, new WorldPoint(3094, 3360, 0)), ANOTHER_SLICE_OF_HAM(Quest.ANOTHER_SLICE_OF_HAM, new WorldPoint(2799, 5428, 0)), - THE_ASCENT_OF_ARCEUUS(Quest.THE_ASCENT_OF_ARCEUUS, new WorldPoint(1700, 3742, 0)), + THE_ASCENT_OF_ARCEUUS(Quest.THE_ASCENT_OF_ARCEUUS, new WorldPoint(1699, 3742, 0)), BETWEEN_A_ROCK(Quest.BETWEEN_A_ROCK, new WorldPoint(2823, 10168, 0)), BIG_CHOMPY_BIRD_HUNTING(Quest.BIG_CHOMPY_BIRD_HUNTING, new WorldPoint(2629, 2981, 0)), BIOHAZARD(Quest.BIOHAZARD, new WorldPoint(2591, 3335, 0)), @@ -72,7 +72,7 @@ enum QuestStartLocation DARKNESS_OF_HALLOWVALE(Quest.DARKNESS_OF_HALLOWVALE, new WorldPoint(3494, 9628, 0)), DEATH_PLATEAU_TROLL_STRONGHOLD(new Quest[]{Quest.DEATH_PLATEAU, Quest.TROLL_STRONGHOLD}, new WorldPoint(2895, 3528, 0)), DEATH_TO_THE_DORGESHUUN(Quest.DEATH_TO_THE_DORGESHUUN, new WorldPoint(3316, 9613, 0)), - THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1780, 3569, 0)), + THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1781, 3570, 0)), DESERT_TREASURE(Quest.DESERT_TREASURE, new WorldPoint(3177, 3043, 0)), DEVIOUS_MINDS(Quest.DEVIOUS_MINDS, new WorldPoint(3405, 3492, 0)), THE_DIG_SITE(Quest.THE_DIG_SITE, new WorldPoint(3363, 3337, 0)), diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl index 207e8300a1..55c3b9e6c3 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl @@ -74,9 +74,9 @@ bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, i vB += position - cameraPos; vC += position - cameraPos; - ivec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0; } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common_func.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common_func.glsl index 89b5231d3d..cde151872a 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common_func.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common_func.glsl @@ -74,9 +74,9 @@ bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, i vB += position - cameraPos; vC += position - cameraPos; - ivec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0; } \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl index 28a339f788..0f7f1bad23 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl @@ -60,9 +60,9 @@ out float fogAmount; void main() { ivec3 cameraPos = ivec3(cameraX, cameraY, cameraZ); - ivec3 screenA = toScreen(vPosition[0] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 screenB = toScreen(vPosition[1] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); - ivec3 screenC = toScreen(vPosition[2] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 screenA = toScreen(vPosition[0] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 screenB = toScreen(vPosition[1] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); + vec3 screenC = toScreen(vPosition[2] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); if (-screenA.z < 50 || -screenB.z < 50 || -screenC.z < 50) { // the client does not draw a triangle if any vertex distance is <50 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl index 612cf8fce8..1e9e63428d 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl @@ -26,22 +26,22 @@ /* * Convert a vertex to screen space */ -ivec3 toScreen(ivec3 vertex, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) { - int yawSin = int(65536.0f * sin(cameraYaw * UNIT)); - int yawCos = int(65536.0f * cos(cameraYaw * UNIT)); +vec3 toScreen(ivec3 vertex, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) { + float yawSin = sin(cameraYaw * UNIT); + float yawCos = cos(cameraYaw * UNIT); - int pitchSin = int(65536.0f * sin(cameraPitch * UNIT)); - int pitchCos = int(65536.0f * cos(cameraPitch * UNIT)); + float pitchSin = sin(cameraPitch * UNIT); + float pitchCos = cos(cameraPitch * UNIT); - int rotatedX = ((vertex.z * yawSin) + (vertex.x * yawCos)) >> 16; - int rotatedZ = ((vertex.z * yawCos) - (vertex.x * yawSin)) >> 16; + float rotatedX = (vertex.z * yawSin) + (vertex.x * yawCos); + float rotatedZ = (vertex.z * yawCos) - (vertex.x * yawSin); - int var13 = ((vertex.y * pitchCos) - (rotatedZ * pitchSin)) >> 16; - int var12 = ((vertex.y * pitchSin) + (rotatedZ * pitchCos)) >> 16; + float var13 = (vertex.y * pitchCos) - (rotatedZ * pitchSin); + float var12 = (vertex.y * pitchSin) + (rotatedZ * pitchCos); - int x = rotatedX * zoom / var12 + centerX; - int y = var13 * zoom / var12 + centerY; - int z = -var12; // in OpenGL depth is negative + float x = rotatedX * zoom / var12 + centerX; + float y = var13 * zoom / var12 + centerY; + float z = -var12; // in OpenGL depth is negative - return ivec3(x, y, z); + return vec3(x, y, z); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 3886e59522..1df200fe01 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1798,7 +1798,8 @@ public abstract class RSClientMixin implements RSClient int type = client.getVarpDefinition(var0).getType(); if (type == 3 || type == 4 || type == 10) { - client.getCallbacks().post(VolumeChanged.class, VolumeChanged.INSTANCE); + VolumeChanged volumeChanged = new VolumeChanged(null); + client.getCallbacks().post(VolumeChanged.class, volumeChanged); } } } \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java index 92738df760..827b67e537 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java @@ -120,7 +120,7 @@ public abstract class SoundEffectMixin implements RSClient { // Regular sound effect - SoundEffectPlayed event = new SoundEffectPlayed(); + SoundEffectPlayed event = new SoundEffectPlayed(null); event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]); event.setDelay(client.getQueuedSoundEffectDelays()[soundIndex]); client.getCallbacks().post(SoundEffectPlayed.class, event); @@ -133,7 +133,7 @@ public abstract class SoundEffectMixin implements RSClient int y = (packedLocation >> 8) & 0xFF; int range = (packedLocation) & 0xFF; - AreaSoundEffectPlayed event = new AreaSoundEffectPlayed(); + AreaSoundEffectPlayed event = new AreaSoundEffectPlayed(null); event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]); event.setSceneX(x); event.setSceneY(y); diff --git a/wiki-scraper/src/main/java/net/runelite/data/dump/wiki/NpcStatsDumper.java b/wiki-scraper/src/main/java/net/runelite/data/dump/wiki/NpcStatsDumper.java index 746e41542b..31d6d47f43 100644 --- a/wiki-scraper/src/main/java/net/runelite/data/dump/wiki/NpcStatsDumper.java +++ b/wiki-scraper/src/main/java/net/runelite/data/dump/wiki/NpcStatsDumper.java @@ -260,7 +260,7 @@ public class NpcStatsDumper private static boolean isAttackableNpc(final NpcDefinition n) { - for (final String s : n.getOptions()) + for (final String s : n.getActions()) { if ("attack".equalsIgnoreCase(s)) { From b3991f219d99945ee67aab7aec90792514a47376 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Wed, 30 Oct 2019 05:46:45 +0100 Subject: [PATCH 60/63] project: music plugin --- .../client/plugins/music/MusicPlugin.java | 3 -- .../net/runelite/mixins/RSClientMixin.java | 20 ++++++++++- .../java/net/runelite/rs/api/RSClient.java | 18 ++++++++-- .../net/runelite/rs/api/RSMidiPcmStream.java | 33 +++++++++++++++++++ runescape-client/src/main/java/Client.java | 9 ++--- .../src/main/java/ClientPacket.java | 2 +- .../src/main/java/DynamicObject.java | 4 +-- .../src/main/java/HealthBarUpdate.java | 4 +-- .../src/main/java/MidiPcmStream.java | 3 +- .../src/main/java/MouseRecorder.java | 2 +- .../src/main/java/MusicPatchNode2.java | 6 ++-- runescape-client/src/main/java/NetSocket.java | 8 ++--- runescape-client/src/main/java/TileItem.java | 3 +- .../src/main/java/UserComparator4.java | 2 +- .../src/main/java/WorldMapData_0.java | 2 +- .../src/main/java/WorldMapSprite.java | 2 +- runescape-client/src/main/java/class83.java | 6 ++-- 17 files changed, 97 insertions(+), 30 deletions(-) create mode 100644 runescape-api/src/main/java/net/runelite/rs/api/RSMidiPcmStream.java 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 2c23510a81..5c1b2d5b87 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 @@ -37,7 +37,6 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; -import lombok.extern.slf4j.Slf4j; import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.GameState; @@ -73,7 +72,6 @@ import net.runelite.client.plugins.PluginDescriptor; name = "Music", description = "Adds search and filter for the music list, and additional volume control" ) -@Slf4j public class MusicPlugin extends Plugin { @Inject @@ -220,7 +218,6 @@ public class MusicPlugin extends Plugin private void onVolumeChanged(VolumeChanged volumeChanged) { - log.info(volumeChanged.getType().toString()); applyMusicVolumeConfig(); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 1df200fe01..2cacebda23 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1784,6 +1784,24 @@ public abstract class RSClientMixin implements RSClient } } + @Inject + @Override + public void setMusicVolume(int volume) + { + if (volume > 0 && client.getMusicVolume() <= 0 && client.getcurrentTrackGroupId() != -1) + { + client.playMusicTrack(client.getMusicTracks(), client.getcurrentTrackGroupId(), 0, volume, false); + } + + client.setClientMusicVolume(volume); + client.setMusicTrackVolume(volume); + if (client.getMidiPcmStream() != null) + { + client.getMidiPcmStream().setPcmStreamVolume(volume); + } + } + + @Copy("changeGameOptions") public static void rs$changeGameOptions(int var0) { @@ -1798,7 +1816,7 @@ public abstract class RSClientMixin implements RSClient int type = client.getVarpDefinition(var0).getType(); if (type == 3 || type == 4 || type == 10) { - VolumeChanged volumeChanged = new VolumeChanged(null); + VolumeChanged volumeChanged = new VolumeChanged(type == 3 ? VolumeChanged.Type.MUSIC : type == 4 ? VolumeChanged.Type.EFFECTS : VolumeChanged.Type.AREA); client.getCallbacks().post(VolumeChanged.class, volumeChanged); } } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index f863d9afbe..9220907d8c 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -449,6 +449,9 @@ public interface RSClient extends RSGameShell, Client @Import("SpriteBuffer_spritePalette") void setIndexedSpritePalette(int[] indexedSpritePalette); + @Import("archive6") + RSAbstractArchive getMusicTracks(); + @Import("archive8") @Override RSAbstractArchive getIndexSprites(); @@ -1047,8 +1050,7 @@ public interface RSClient extends RSGameShell, Client int getMusicVolume(); @Import("musicVolume") - @Override - void setMusicVolume(int volume); + void setClientMusicVolume(int volume); @Import("areaSoundEffectVolume") @Override @@ -1066,9 +1068,21 @@ public interface RSClient extends RSGameShell, Client @Override void setSoundEffectVolume(int volume); + @Import("musicTrackVolume") + void setMusicTrackVolume(int volume); + @Import("viewportWalking") void setViewportWalking(boolean viewportWalking); + @Import("playMusicTrack") + void playMusicTrack(RSAbstractArchive var0, int var1, int var2, int var3, boolean var4); + + @Import("midiPcmStream") + RSMidiPcmStream getMidiPcmStream(); + + @Import("currentTrackGroupId") + int getcurrentTrackGroupId(); + @Import("crossSprites") @Override RSSprite[] getCrossSprites(); diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSMidiPcmStream.java b/runescape-api/src/main/java/net/runelite/rs/api/RSMidiPcmStream.java new file mode 100644 index 0000000000..596fed9c2a --- /dev/null +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSMidiPcmStream.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018, trimbe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.rs.api; + +import net.runelite.mapping.Import; + +public interface RSMidiPcmStream +{ + @Import("setPcmStreamVolume") + void setPcmStreamVolume(int volume); +} diff --git a/runescape-client/src/main/java/Client.java b/runescape-client/src/main/java/Client.java index ed958509cf..b180621394 100644 --- a/runescape-client/src/main/java/Client.java +++ b/runescape-client/src/main/java/Client.java @@ -202,7 +202,8 @@ public final class Client extends GameShell implements Usernamed { @ObfuscatedGetter( intValue = -910754411 ) - static int field666; + @Export("currentTrackGroupId") + static int currentTrackGroupId; @ObfuscatedName("mo") @ObfuscatedGetter( intValue = -1946560921 @@ -1511,7 +1512,7 @@ public final class Client extends GameShell implements Usernamed { destinationY = 0; minimapState = 0; musicVolume = 255; - field666 = -1; + currentTrackGroupId = -1; field759 = false; soundEffectVolume = 127; areaSoundEffectVolume = 127; @@ -1653,7 +1654,7 @@ public final class Client extends GameShell implements Usernamed { var5 = 0; } - class49.midiPcmStream.method3760(var5); + class49.midiPcmStream.setPcmStreamVolume(var5); } else { class49.midiPcmStream.clear(); class49.midiPcmStream.removeAll(); @@ -1765,7 +1766,7 @@ public final class Client extends GameShell implements Usernamed { if (class49.midiPcmStream.loadMusicTrack(class197.musicTrack, class197.musicPatchesArchive, FriendLoginUpdate.soundCache, 22050)) { class49.midiPcmStream.clearAll(); - class49.midiPcmStream.method3760(TileItem.field1223); + class49.midiPcmStream.setPcmStreamVolume(TileItem.musicTrackVolume); class49.midiPcmStream.setMusicTrack(class197.musicTrack, WorldMapSectionType.musicTrackBoolean); class197.field2386 = 0; class197.musicTrack = null; diff --git a/runescape-client/src/main/java/ClientPacket.java b/runescape-client/src/main/java/ClientPacket.java index 1aa118148e..0a4c2d67e8 100644 --- a/runescape-client/src/main/java/ClientPacket.java +++ b/runescape-client/src/main/java/ClientPacket.java @@ -705,7 +705,7 @@ public class ClientPacket implements class181 { @Export("playSoundJingle") static void playSoundJingle(int var0, int var1) { if (Client.musicVolume != 0 && var0 != -1) { - class83.method2068(ClanMate.archive11, var0, 0, Client.musicVolume, false); + class83.playMusicTrack(ClanMate.archive11, var0, 0, Client.musicVolume, false); Client.field759 = true; } diff --git a/runescape-client/src/main/java/DynamicObject.java b/runescape-client/src/main/java/DynamicObject.java index 4fca28b6c8..70af692726 100644 --- a/runescape-client/src/main/java/DynamicObject.java +++ b/runescape-client/src/main/java/DynamicObject.java @@ -213,10 +213,10 @@ public class DynamicObject extends Entity { class197.musicTrackArchive = null; class188.musicTrackGroupId = -1; class49.musicTrackFileId = -1; - TileItem.field1223 = 0; + TileItem.musicTrackVolume = 0; WorldMapSectionType.musicTrackBoolean = false; MusicPatchNode2.field2382 = 2; - Client.field666 = -1; + Client.currentTrackGroupId = -1; Client.field759 = false; ClientPacket.method3581(); MouseRecorder.updateGameState(10); diff --git a/runescape-client/src/main/java/HealthBarUpdate.java b/runescape-client/src/main/java/HealthBarUpdate.java index f708052a85..9ee52efe8e 100644 --- a/runescape-client/src/main/java/HealthBarUpdate.java +++ b/runescape-client/src/main/java/HealthBarUpdate.java @@ -151,8 +151,8 @@ public class HealthBarUpdate extends Node { } if (!var12) { - if (Client.musicVolume != 0 && Client.field666 != -1) { - class83.method2068(class225.archive6, Client.field666, 0, Client.musicVolume, false); + if (Client.musicVolume != 0 && Client.currentTrackGroupId != -1) { + class83.playMusicTrack(class225.archive6, Client.currentTrackGroupId, 0, Client.musicVolume, false); } Client.field759 = false; diff --git a/runescape-client/src/main/java/MidiPcmStream.java b/runescape-client/src/main/java/MidiPcmStream.java index 8517ab3ad0..1328296848 100644 --- a/runescape-client/src/main/java/MidiPcmStream.java +++ b/runescape-client/src/main/java/MidiPcmStream.java @@ -131,7 +131,8 @@ public class MidiPcmStream extends PcmStream { signature = "(II)V", garbageValue = "-1812413582" ) - public synchronized void method3760(int var1) { + @Export("setPcmStreamVolume") + public synchronized void setPcmStreamVolume(int var1) { this.field2393 = var1; } diff --git a/runescape-client/src/main/java/MouseRecorder.java b/runescape-client/src/main/java/MouseRecorder.java index 27b34c85d8..e4c96908da 100644 --- a/runescape-client/src/main/java/MouseRecorder.java +++ b/runescape-client/src/main/java/MouseRecorder.java @@ -205,7 +205,7 @@ public class MouseRecorder implements Runnable { class197.musicTrackArchive = null; class188.musicTrackGroupId = -1; class49.musicTrackFileId = -1; - TileItem.field1223 = 0; + TileItem.musicTrackVolume = 0; WorldMapSectionType.musicTrackBoolean = false; MusicPatchNode2.field2382 = 2; DirectByteArrayCopier.method3924(true); diff --git a/runescape-client/src/main/java/MusicPatchNode2.java b/runescape-client/src/main/java/MusicPatchNode2.java index a5e9bec39c..b8d9652cc8 100644 --- a/runescape-client/src/main/java/MusicPatchNode2.java +++ b/runescape-client/src/main/java/MusicPatchNode2.java @@ -64,19 +64,19 @@ public class MusicPatchNode2 { static void playSong(int var0) { if (var0 == -1 && !Client.field759) { VertexNormal.method2960(); - } else if (var0 != -1 && var0 != Client.field666 && Client.musicVolume != 0 && !Client.field759) { + } else if (var0 != -1 && var0 != Client.currentTrackGroupId && Client.musicVolume != 0 && !Client.field759) { Archive var1 = class225.archive6; int var2 = Client.musicVolume; class197.field2386 = 1; class197.musicTrackArchive = var1; class188.musicTrackGroupId = var0; class49.musicTrackFileId = 0; - TileItem.field1223 = var2; + TileItem.musicTrackVolume = var2; WorldMapSectionType.musicTrackBoolean = false; field2382 = 2; } - Client.field666 = var0; + Client.currentTrackGroupId = var0; } @ObfuscatedName("ic") diff --git a/runescape-client/src/main/java/NetSocket.java b/runescape-client/src/main/java/NetSocket.java index 9207e17a34..91bd0f9c49 100644 --- a/runescape-client/src/main/java/NetSocket.java +++ b/runescape-client/src/main/java/NetSocket.java @@ -438,16 +438,16 @@ public final class NetSocket extends AbstractSocket implements Runnable { } if (var3 != Client.musicVolume) { - if (Client.musicVolume == 0 && Client.field666 != -1) { - class83.method2068(class225.archive6, Client.field666, 0, var3, false); + if (Client.musicVolume == 0 && Client.currentTrackGroupId != -1) { + class83.playMusicTrack(class225.archive6, Client.currentTrackGroupId, 0, var3, false); Client.field759 = false; } else if (var3 == 0) { VertexNormal.method2960(); Client.field759 = false; } else if (class197.field2386 != 0) { - TileItem.field1223 = var3; + TileItem.musicTrackVolume = var3; } else { - class49.midiPcmStream.method3760(var3); + class49.midiPcmStream.setPcmStreamVolume(var3); } Client.musicVolume = var3; diff --git a/runescape-client/src/main/java/TileItem.java b/runescape-client/src/main/java/TileItem.java index 434cb090cf..ed26f437dc 100644 --- a/runescape-client/src/main/java/TileItem.java +++ b/runescape-client/src/main/java/TileItem.java @@ -17,7 +17,8 @@ public final class TileItem extends Entity { @ObfuscatedGetter( intValue = 1727946021 ) - public static int field1223; + @Export("musicTrackVolume") + public static int musicTrackVolume; @ObfuscatedName("z") @ObfuscatedGetter( intValue = -1488876063 diff --git a/runescape-client/src/main/java/UserComparator4.java b/runescape-client/src/main/java/UserComparator4.java index b378fd8030..57a91245ec 100644 --- a/runescape-client/src/main/java/UserComparator4.java +++ b/runescape-client/src/main/java/UserComparator4.java @@ -43,7 +43,7 @@ public class UserComparator4 implements Comparator { public static void method3349(AbstractArchive var0, String var1, String var2, int var3, boolean var4) { int var5 = var0.getGroupId(var1); int var6 = var0.getFileId(var5, var2); - class83.method2068(var0, var5, var6, var3, var4); + class83.playMusicTrack(var0, var5, var6, var3, var4); } @ObfuscatedName("ka") diff --git a/runescape-client/src/main/java/WorldMapData_0.java b/runescape-client/src/main/java/WorldMapData_0.java index e53aa1e1bd..4ad065e0e8 100644 --- a/runescape-client/src/main/java/WorldMapData_0.java +++ b/runescape-client/src/main/java/WorldMapData_0.java @@ -263,7 +263,7 @@ public class WorldMapData_0 extends AbstractWorldMapData { class197.musicTrackArchive = var1; class188.musicTrackGroupId = var6; class49.musicTrackFileId = var7; - TileItem.field1223 = var4; + TileItem.musicTrackVolume = var4; WorldMapSectionType.musicTrackBoolean = var5; MusicPatchNode2.field2382 = var0; } diff --git a/runescape-client/src/main/java/WorldMapSprite.java b/runescape-client/src/main/java/WorldMapSprite.java index 8b9b430622..ead6c24039 100644 --- a/runescape-client/src/main/java/WorldMapSprite.java +++ b/runescape-client/src/main/java/WorldMapSprite.java @@ -107,7 +107,7 @@ public final class WorldMapSprite { class197.musicTrackArchive = null; class188.musicTrackGroupId = -1; class49.musicTrackFileId = -1; - TileItem.field1223 = 0; + TileItem.musicTrackVolume = 0; WorldMapSectionType.musicTrackBoolean = false; MusicPatchNode2.field2382 = 2; } diff --git a/runescape-client/src/main/java/class83.java b/runescape-client/src/main/java/class83.java index 029b7c87e1..7f501cdb88 100644 --- a/runescape-client/src/main/java/class83.java +++ b/runescape-client/src/main/java/class83.java @@ -1,5 +1,6 @@ import java.awt.Component; import java.math.BigInteger; +import net.runelite.mapping.Export; import net.runelite.mapping.ObfuscatedGetter; import net.runelite.mapping.ObfuscatedName; import net.runelite.mapping.ObfuscatedSignature; @@ -37,12 +38,13 @@ public class class83 { signature = "(Lhp;IIIZI)V", garbageValue = "-476776598" ) - public static void method2068(AbstractArchive var0, int var1, int var2, int var3, boolean var4) { + @Export("playMusicTrack") + public static void playMusicTrack(AbstractArchive var0, int var1, int var2, int var3, boolean var4) { class197.field2386 = 1; class197.musicTrackArchive = var0; class188.musicTrackGroupId = var1; class49.musicTrackFileId = var2; - TileItem.field1223 = var3; + TileItem.musicTrackVolume = var3; WorldMapSectionType.musicTrackBoolean = var4; MusicPatchNode2.field2382 = 10000; } From 55346c7d2be388edbe16e3527e0567b724ae13e2 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 30 Oct 2019 16:45:22 +0000 Subject: [PATCH 61/63] Release 1.5.37 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 6a683c0e03..e355391bfe 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index ca731fa5a2..d8ed86bfd6 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 95fcd5d703..6f32c3c191 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 3e232bdfa2..52bc773799 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 16b8e5144e..b4deda4435 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 Web Service diff --git a/pom.xml b/pom.xml index 916d842e82..fbe2464789 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.37 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index c10f81c453..08d3f7c90b 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index b687358a57..620355d3a2 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 021c41e297..4e5dd0dd4e 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index ebf7d9280f..9dd0bf267a 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index e6219a3749..957e7b6d6d 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 script-assembler-plugin From ca58d24c7fe8c946465374d2ff8f3e2e240bd043 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 30 Oct 2019 16:45:29 +0000 Subject: [PATCH 62/63] Bump for 1.5.38-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 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index e355391bfe..8abbbf789c 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index d8ed86bfd6..56849519e9 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 6f32c3c191..ac77ad1b00 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 52bc773799..cc418be40b 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index b4deda4435..49a3c8e21c 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index fbe2464789..e0932e7c09 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.37 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 08d3f7c90b..4a6e08e602 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 620355d3a2..9c42616649 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 4e5dd0dd4e..f09264a9c0 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 9dd0bf267a..1dae652ba0 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 957e7b6d6d..51dec4da8a 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT script-assembler-plugin From 8f8d831a164fbd9d7105161192abff215e4ee520 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Thu, 31 Oct 2019 05:17:04 +0100 Subject: [PATCH 63/63] infoplugin: Fix info panel --- .../client/plugins/info/InfoPanel.java | 72 +------------------ .../client/plugins/info/InfoPlugin.java | 14 +--- 2 files changed, 3 insertions(+), 83 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java index 632f9f248f..5b36fb0afa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java @@ -34,23 +34,17 @@ import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; -import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; import javax.inject.Singleton; -import javax.swing.Box; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; -import javax.swing.event.HyperlinkEvent; import net.runelite.api.Client; import static net.runelite.client.RuneLite.LOGS_DIR; import net.runelite.client.RuneLiteProperties; -import net.runelite.client.account.SessionManager; import net.runelite.client.config.ConfigManager; -import net.runelite.client.events.SessionClose; -import net.runelite.client.events.SessionOpen; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; import net.runelite.client.ui.PluginPanel; @@ -58,10 +52,8 @@ import net.runelite.client.util.ImageUtil; import net.runelite.client.util.LinkBrowser; @Singleton -public class InfoPanel extends PluginPanel +class InfoPanel extends PluginPanel { - private static final String RUNELITE_LOGIN = "https://runelite_login/"; - private static final ImageIcon ARROW_RIGHT_ICON; private static final ImageIcon GITHUB_ICON; private static final ImageIcon FOLDER_ICON; @@ -69,21 +61,12 @@ public class InfoPanel extends PluginPanel private static final ImageIcon PATREON_ICON; private static final ImageIcon IMPORT_ICON; - private final JLabel loggedLabel = new JLabel(); - private final JRichTextPane emailLabel = new JRichTextPane(); private JPanel syncPanel; - private JPanel actionsContainer; @Inject @Nullable private Client client; - @Inject - private SessionManager sessionManager; - - @Inject - private ScheduledExecutorService executor; - @Inject private ConfigManager configManager; @@ -127,28 +110,11 @@ public class InfoPanel extends PluginPanel revision.setText(htmlLabel("Oldschool revision: ", engineVer)); - loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - loggedLabel.setFont(smallFont); - - emailLabel.setForeground(Color.WHITE); - emailLabel.setFont(smallFont); - emailLabel.enableAutoLinkHandler(false); - emailLabel.addHyperlinkListener(e -> - { - if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType()) && e.getURL() != null && e.getURL().toString().equals(RUNELITE_LOGIN)) - { - executor.execute(sessionManager::login); - } - }); - versionPanel.add(version); versionPanel.add(plusVersion); versionPanel.add(revision); - versionPanel.add(Box.createGlue()); - versionPanel.add(loggedLabel); - versionPanel.add(emailLabel); - actionsContainer = new JPanel(); + JPanel actionsContainer = new JPanel(); actionsContainer.setBorder(new EmptyBorder(10, 0, 0, 0)); actionsContainer.setLayout(new GridLayout(5, 1, 0, 10)); @@ -173,8 +139,6 @@ public class InfoPanel extends PluginPanel add(versionPanel, BorderLayout.NORTH); add(actionsContainer, BorderLayout.CENTER); - - updateLoggedIn(); } /** @@ -267,40 +231,8 @@ public class InfoPanel extends PluginPanel return container; } - private void updateLoggedIn() - { - final String name = sessionManager.getAccountSession() != null - ? sessionManager.getAccountSession().getUsername() - : null; - - if (name != null) - { - emailLabel.setContentType("text/plain"); - emailLabel.setText(name); - loggedLabel.setText("Logged in as"); - actionsContainer.add(syncPanel, 0); - } - else - { - //emailLabel.setContentType("text/html"); - //emailLabel.setText("Login to sync settings to the cloud."); - //loggedLabel.setText("Not logged in"); - actionsContainer.remove(syncPanel); - } - } - private static String htmlLabel(String key, String value) { return "" + key + "" + value + ""; } - - public void onSessionOpen(SessionOpen sessionOpen) - { - updateLoggedIn(); - } - - public void onSessionClose(SessionClose e) - { - updateLoggedIn(); - } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPlugin.java index 79fd350150..26e4bcfbbc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPlugin.java @@ -28,8 +28,6 @@ import java.awt.image.BufferedImage; import javax.inject.Inject; import javax.inject.Singleton; import net.runelite.client.eventbus.EventBus; -import net.runelite.client.events.SessionClose; -import net.runelite.client.events.SessionOpen; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.ClientToolbar; @@ -53,12 +51,10 @@ public class InfoPlugin extends Plugin private NavigationButton navButton; - private InfoPanel panel; - @Override protected void startUp() throws Exception { - panel = injector.getInstance(InfoPanel.class); + InfoPanel panel = injector.getInstance(InfoPanel.class); panel.init(); final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "info_icon.png"); @@ -71,8 +67,6 @@ public class InfoPlugin extends Plugin .build(); clientToolbar.addNavigation(navButton); - - addSubscriptions(); } @Override @@ -82,10 +76,4 @@ public class InfoPlugin extends Plugin clientToolbar.removeNavigation(navButton); } - - private void addSubscriptions() - { - eventbus.subscribe(SessionOpen.class, this, event -> panel.onSessionOpen(event)); - eventbus.subscribe(SessionClose.class, this, event -> panel.onSessionClose(event)); - } }