From 92556d168ab1eeeb2093b0b57b8eb1b65de5e3cc Mon Sep 17 00:00:00 2001 From: TorkelV Date: Sun, 30 Dec 2018 16:40:20 +0100 Subject: [PATCH] Add farming patch type to tooltips on world map (#7105) Closes #7091 --- .../worldmap/FarmingPatchLocation.java | 97 +++++++++++++++++++ .../plugins/worldmap/FarmingPatchPoint.java | 39 ++++++++ .../plugins/worldmap/WorldMapConfig.java | 13 ++- .../plugins/worldmap/WorldMapPlugin.java | 14 ++- 4 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchPoint.java 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 new file mode 100644 index 0000000000..5c2a260e13 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2018, Torkel Velure + * 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 FarmingPatchLocation +{ + ALLOTMENT("Allotment", new WorldPoint(3793, 2836, 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) + ), + BELLADONNA("Belladonna", new WorldPoint(3084, 3356, 0)), + BUSH("Bush", + new WorldPoint(2938, 3223, 0), + new WorldPoint(2589, 3862, 0), + new WorldPoint(3182, 3356, 0), + new WorldPoint(2615, 3224, 0) + ), + CACTUS("Cactus", new WorldPoint(3313, 3201, 0)), + CALQUAT("Calquat", new WorldPoint(2793, 3099, 0)), + FRUIT_TREE("Fruit Tree", + new WorldPoint(2487, 3181, 0), + new WorldPoint(2343, 3160, 0), + new WorldPoint(2472, 3445, 0), + new WorldPoint(2858, 3432, 0), + new WorldPoint(2765, 3211, 0) + ), + GRAPES("Grapes", new WorldPoint(1807, 3555, 0)), + HARDWOOD("Hardwood", + new WorldPoint(3707, 3838, 0) + ), + HERB("Herb", + new WorldPoint(3789, 2840, 0), + new WorldPoint(2847, 3933, 0), + new WorldPoint(2828, 3696, 0) + ), + HOPS("Hops", + new WorldPoint(2572, 3102, 0), + new WorldPoint(2661, 3523, 0), + new WorldPoint(3224, 3313, 0), + new WorldPoint(3812, 3334, 0) + ), + MUSHROOM("Mushroom", new WorldPoint(3449, 3471, 0)), + SEAWEED("Seaweed", new WorldPoint(3730, 10271, 0)), + SPIRIT_TREE("Spirit Tree", + new WorldPoint(3056, 3259, 0), + new WorldPoint(1690, 3540, 0), + new WorldPoint(3614, 3856, 0), + new WorldPoint(2799, 3205, 0) + ), + TREE("Tree", + new WorldPoint(3226, 3457, 0), + new WorldPoint(2933, 3436, 0), + new WorldPoint(3189, 3233, 0), + new WorldPoint(2434, 3418, 0), + new WorldPoint(3005, 3375, 0) + ); + + private final String tooltip; + private final WorldPoint[] locations; + + FarmingPatchLocation(String description, WorldPoint... locations) + { + this.tooltip = "Farming patch - " + description; + this.locations = locations; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchPoint.java new file mode 100644 index 0000000000..79b380c220 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchPoint.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018, Torkel Velure + * 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.api.coords.WorldPoint; +import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; + +class FarmingPatchPoint extends WorldMapPoint +{ + FarmingPatchPoint(WorldPoint point, String tooltip, BufferedImage icon) + { + super(point, icon); + setTooltip(tooltip); + } +} 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 5a98f88262..def0a43c9b 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 @@ -174,4 +174,15 @@ public interface WorldMapConfig extends Config { return true; } -} + + @ConfigItem( + keyName = WorldMapPlugin.CONFIG_KEY_FARMING_PATCH_TOOLTIPS, + name = "Show farming patch type", + description = "Display the type of farming patches in the icon tooltip", + position = 14 + ) + default boolean farmingPatchTooltips() + { + return true; + } +} \ No newline at end of file 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 cf47de484a..a342a7f582 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 @@ -44,7 +44,7 @@ import net.runelite.client.util.ImageUtil; @PluginDescriptor( name = "World Map", description = "Enhance the world map to display additional information", - tags = {"agility", "fairy", "rings", "teleports"} + tags = {"agility", "fairy", "farming", "rings", "teleports"} ) public class WorldMapPlugin extends Plugin { @@ -66,6 +66,7 @@ public class WorldMapPlugin extends Plugin static final String CONFIG_KEY_MISC_TELEPORT_ICON = "miscellaneousTeleportIcon"; static final String CONFIG_KEY_QUEST_START_TOOLTIPS = "questStartTooltips"; static final String CONFIG_KEY_MINIGAME_TOOLTIP = "minigameTooltip"; + static final String CONFIG_KEY_FARMING_PATCH_TOOLTIPS = "farmingpatchTooltips"; static { @@ -115,6 +116,7 @@ public class WorldMapPlugin extends Plugin worldMapPointManager.removeIf(QuestStartPoint.class::isInstance); worldMapPointManager.removeIf(TeleportPoint.class::isInstance); worldMapPointManager.removeIf(MinigamePoint.class::isInstance); + worldMapPointManager.removeIf(FarmingPatchPoint.class::isInstance); agilityLevel = 0; } @@ -187,6 +189,16 @@ public class WorldMapPlugin extends Plugin .forEach(worldMapPointManager::add); } + worldMapPointManager.removeIf(FarmingPatchPoint.class::isInstance); + if (config.farmingPatchTooltips()) + { + Arrays.stream(FarmingPatchLocation.values()).forEach(location -> + Arrays.stream(location.getLocations()) + .map(point -> new FarmingPatchPoint(point, location.getTooltip(), BLANK_ICON)) + .forEach(worldMapPointManager::add) + ); + } + worldMapPointManager.removeIf(TeleportPoint.class::isInstance); Arrays.stream(TeleportLocationData.values()) .filter(data ->