From 28d95e0b656c8c7bbb5352c262a12e3d45623ba7 Mon Sep 17 00:00:00 2001 From: Magic fTail Date: Mon, 10 Sep 2018 22:15:02 +0200 Subject: [PATCH] WorldMapPlugin: Add tooltip to minigame icons Add tooltip showing the name of the minigame on the worldmap --- .../plugins/worldmap/MinigameLocation.java | 83 +++++++++++++++++++ .../plugins/worldmap/MinigamePoint.java | 38 +++++++++ .../plugins/worldmap/WorldMapConfig.java | 23 +++-- .../plugins/worldmap/WorldMapPlugin.java | 22 +++++ 4 files changed, 160 insertions(+), 6 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigamePoint.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java new file mode 100644 index 0000000000..1b87a8f067 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2018, Magic fTail + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.worldmap; + +import lombok.Getter; +import net.runelite.api.coords.WorldPoint; + +@Getter +enum MinigameLocation +{ + BARBARIAN_ASSAULT("Barbarian Assault", new WorldPoint(2531, 3569, 0)), + BURGH_DE_ROTT_RAMBLE("Burgh de Rott Ramble", new WorldPoint(3434, 3487, 0)), + CASTLE_WARS("Castle Wars", new WorldPoint(2439, 3092, 0)), + DUEL_ARENA("Duel Arena", new WorldPoint(3313, 3238, 0)), + MAGE_ARENA("Mage Arena", new WorldPoint(3095, 3957, 0)), + NIGHTMARE_ZONE("Nightmare Zone", new WorldPoint(2606, 3115, 0)), + PEST_CONTROL_NOVICE("Pest Control Novice", new WorldPoint(2660, 2637, 0)), + PEST_CONTROL_INTERMEDIATE("Pest Control Intermediate", new WorldPoint(2638, 2641, 0)), + PEST_CONTROL_VETERAN("Pest Control Veteran", new WorldPoint(2632, 2648, 0)), + TEMPLE_TREKKING("Temple Trekking", new WorldPoint(3479, 3240, 0)), + TZHAAR_FIGHT_CAVE("TzHaar Fight Cave", new WorldPoint(2437, 5168, 0)), + TZHAAR_FIGHT_PIT("TzHaar Fight Pit", new WorldPoint(2398, 5177, 0)), + LAST_MAN_STANDING("Last Man Standing", new WorldPoint(3403, 3177, 0)), + INFERNO("Inferno", new WorldPoint(2495, 5118, 0)), + BRIMHAVEN_AGILITY_ARENA("Brimhaven Agility Arena", new WorldPoint(2809, 3191, 0)), + FISHING_TRAWLER("Fishing Trawler", new WorldPoint(2667, 3163, 0)), + GNOME_BALL("Gnome Ball", new WorldPoint(2381, 3488, 0)), + GNOME_RESTAURANT("Gnome Restaurant", new WorldPoint(2436, 3502, 0)), + IMPETUOUS_IMPULSES("Impetuous Impulses", new WorldPoint(2425, 4445, 0)), + MAGE_TRAINING_ARENA("Mage Training Arena", new WorldPoint(3362, 3318, 0)), + PYRAMID_PLUNDER("Pyramid Plunder", new WorldPoint(3288, 2787, 0)), + RANGING_GUILD("Ranging Guild", new WorldPoint(2671, 3419, 0)), + ROGUES_DEN("Rogues' Den", new WorldPoint(2905, 3537, 0)), + SORCERESSS_GARDEN("Sorceress's Garden", new WorldPoint(3285, 3180, 0)), + TROUBLE_BREWING("Trouble Brewing", new WorldPoint(3811, 3021, 0)), + VOLCANIC_MINE("Volcanic Mine", new WorldPoint(3812, 3810, 0)), + TAI_BWO_WANNAI_CLEANUP("Tai Bwo Wannai Cleanup", new WorldPoint(2795, 3066, 0)), + BURTHORPE_GAMES_ROOM("Burthorpe Games Room", new WorldPoint(2900, 3565, 0)), + RAT_PITS_PORT_SARIM("Rat Pits", new WorldPoint(3015, 3232, 0)), + RAT_PITS_VARROCK("Rat Pits", new WorldPoint(3266, 3400, 0)), + RAT_PITS_ARDOUGNE("Rat Pits", new WorldPoint(2561, 3318, 0)), + RAT_PITS_KELDAGRIM("Rat Pits", new WorldPoint(2913, 10188, 0)), + TEARS_OF_GUTHIX("Tears of Guthix", new WorldPoint(3257, 9517, 0)), + CLAN_WARS_1("Clan Wars", new WorldPoint(3349, 3164, 0)), + CLAN_WARS_2("Clan Wars", new WorldPoint(3365, 3175, 0)), + CLAN_WARS_3("Clan Wars", new WorldPoint(3374, 3159, 0)), + ANIMATION_ROOM("Animation Room", new WorldPoint(2853, 3537, 0)), + DUMMY_ROOM("Dummy Room", new WorldPoint(2857, 3551, 0)), + CATAPULT_ROOM("Catapult Room", new WorldPoint(2842, 3545, 0)), + SHOT_PUT_ROOM("Shot Put Room", new WorldPoint(2863, 3550, 0)); + + private final String tooltip; + private final WorldPoint location; + + MinigameLocation(String tooltip, WorldPoint location) + { + this.tooltip = tooltip; + this.location = location; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigamePoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigamePoint.java new file mode 100644 index 0000000000..bd670aa023 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigamePoint.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018, Magic fTail + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.worldmap; + +import java.awt.image.BufferedImage; +import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; + +class MinigamePoint extends WorldMapPoint +{ + MinigamePoint(MinigameLocation data, BufferedImage icon) + { + super(data.getLocation(), icon); + setTooltip(data.getTooltip()); + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java index 0cfb68e823..31cf455c00 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java @@ -87,11 +87,22 @@ public interface WorldMapConfig extends Config return true; } + @ConfigItem( + keyName = WorldMapPlugin.CONFIG_KEY_MINIGAME_TOOLTIP, + name = "Show minigame name in tooltip", + description = "Display the name of the minigame in the icon tooltip", + position = 6 + ) + default boolean minigameTooltip() + { + return true; + } + @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_ANCIENT_TELEPORT_ICON, name = "Show Ancient Magicks destinations", description = "Show icons at the destinations for teleports in the Ancient Spellbook", - position = 6 + position = 7 ) default boolean ancientTeleportIcon() { @@ -102,7 +113,7 @@ public interface WorldMapConfig extends Config keyName = WorldMapPlugin.CONFIG_KEY_LUNAR_TELEPORT_ICON, name = "Show Lunar Spellbook destinations", description = "Show icons at the destinations for teleports in the Lunar Spellbook", - position = 7 + position = 8 ) default boolean lunarTeleportIcon() { @@ -113,7 +124,7 @@ public interface WorldMapConfig extends Config keyName = WorldMapPlugin.CONFIG_KEY_ARCEUUS_TELEPORT_ICON, name = "Show Arceuus Spellbook destinations", description = "Show icons at the destinations for teleports in the Arceuus Spellbook", - position = 8 + position = 9 ) default boolean arceuusTeleportIcon() { @@ -124,7 +135,7 @@ public interface WorldMapConfig extends Config keyName = WorldMapPlugin.CONFIG_KEY_JEWELLERY_TELEPORT_ICON, name = "Show jewellery teleport locations", description = "Show icons at the destinations for teleports from jewellery", - position = 9 + position = 10 ) default boolean jewelleryTeleportIcon() { @@ -135,7 +146,7 @@ public interface WorldMapConfig extends Config keyName = WorldMapPlugin.CONFIG_KEY_SCROLL_TELEPORT_ICON, name = "Show teleport scroll locations", description = "Show icons at the destinations for teleports from scrolls", - position = 10 + position = 11 ) default boolean scrollTeleportIcon() { @@ -146,7 +157,7 @@ public interface WorldMapConfig extends Config keyName = WorldMapPlugin.CONFIG_KEY_MISC_TELEPORT_ICON, name = "Show misc teleport locations", description = "Show icons at the destinations for miscellaneous teleport items", - position = 11 + position = 12 ) default boolean miscellaneousTeleportIcon() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java index bb60566745..f486ca58e9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java @@ -64,6 +64,7 @@ public class WorldMapPlugin extends Plugin static final String CONFIG_KEY_JEWELLERY_TELEPORT_ICON = "jewelleryIcon"; static final String CONFIG_KEY_SCROLL_TELEPORT_ICON = "scrollIcon"; static final String CONFIG_KEY_MISC_TELEPORT_ICON = "miscellaneousTeleportIcon"; + static final String CONFIG_KEY_MINIGAME_TOOLTIP = "minigameTooltip"; static { @@ -132,6 +133,18 @@ public class WorldMapPlugin extends Plugin .forEach(worldMapPointManager::add); } break; + case CONFIG_KEY_MINIGAME_TOOLTIP: + if (config.minigameTooltip()) + { + Arrays.stream(MinigameLocation.values()) + .map(value -> new MinigamePoint(value, BLANK_ICON)) + .forEach(worldMapPointManager::add); + } + else + { + worldMapPointManager.removeIf(MinigamePoint.class::isInstance); + } + break; case CONFIG_KEY_NORMAL_TELEPORT_ICON: case CONFIG_KEY_ANCIENT_TELEPORT_ICON: case CONFIG_KEY_LUNAR_TELEPORT_ICON: @@ -157,6 +170,7 @@ public class WorldMapPlugin extends Plugin .map(FairyRingLocation::getFairyRingPoint) .forEach(worldMapPointManager::add); } + if (config.agilityShortcutTooltips()) { Arrays.stream(AgilityShortcutLocation.values()) @@ -164,6 +178,13 @@ public class WorldMapPlugin extends Plugin .forEach(worldMapPointManager::add); } + if (config.minigameTooltip()) + { + Arrays.stream(MinigameLocation.values()) + .map(value -> new MinigamePoint(value, BLANK_ICON)) + .forEach(worldMapPointManager::add); + } + if (config.normalTeleportIcon() || config.ancientTeleportIcon() || config.lunarTeleportIcon() @@ -182,6 +203,7 @@ public class WorldMapPlugin extends Plugin worldMapPointManager.removeIf(FairyRingPoint.class::isInstance); worldMapPointManager.removeIf(AgilityShortcutPoint.class::isInstance); worldMapPointManager.removeIf(TeleportPoint.class::isInstance); + worldMapPointManager.removeIf(MinigamePoint.class::isInstance); } @Subscribe