worldmap: add tooltips to agility courses

This commit is contained in:
melkypie
2020-05-02 15:27:26 +03:00
parent 3847276416
commit fa615a07f2
4 changed files with 150 additions and 18 deletions

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2020, melky <https://github.com/melkypie>
* 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 AgilityCourseLocation
{
AGILITY_PYRAMID("Agility Pyramid", new WorldPoint(3347, 2827, 0)),
AL_KHARID_ROOFTOP_COURSE("Al Kharid Rooftop Course", new WorldPoint(3272, 3195, 0)),
APE_ATOLL_AGILITY_COURSE("Ape Atoll Agility Course", new WorldPoint(2752, 2742, 0)),
ARDOUGNE_ROOFTOP_COURSE("Ardougne Rooftop Course", new WorldPoint(2673, 3298, 0)),
BARBARIAN_OUTPOST_AGILITY_COURSE("Barbarian Outpost Agility Course", new WorldPoint(2544, 3569, 0)),
BRIMHAVEN_AGILITY_ARENA("Brimhaven Agility Arena", new WorldPoint(2806, 3193, 0)),
CANIFIS_ROOFTOP_COURSE("Canifis Rooftop Course", new WorldPoint(3506, 3490, 0)),
DRAYNOR_VILLAGE_ROOFTOP_COURSE("Draynor Village Rooftop Course", new WorldPoint(3103, 3279, 0)),
FALADOR_ROOFTOP_COURSE("Falador Rooftop Course", new WorldPoint(3035, 3342, 0)),
GNOME_STRONGHOLD_AGILITY_COURSE("Gnome Stronghold Agility Course", new WorldPoint(2474, 3436, 0)),
PENGUIN_AGILITY_COURSE("Penguin Agility Course", new WorldPoint(2638, 4041, 0)),
POLLNIVNEACH_ROOFTOP_COURSE("Pollnivneach Rooftop Course", new WorldPoint(3350, 2963, 0)),
PRIFDDINAS_AGILITY_COURSE("Prifddinas Agility Course", new WorldPoint(3253, 6109, 0)),
RELLEKKA_ROOFTOP_COURSE("Rellekka Rooftop Course", new WorldPoint(2624, 3677, 0)),
SEERS_VILLAGE_ROOFTOP_COURSE("Seers' Village Rooftop Course", new WorldPoint(2728, 3488, 0)),
VARROCK_ROOFTOP_COURSE("Varrock Rooftop Course", new WorldPoint(3219, 3414, 0)),
WEREWOLF_AGILITY_COURSE("Werewolf Agility Course", new WorldPoint(3542, 3463, 0)),
WILDERNESS_AGILITY_COURSE("Wilderness Agility Course", new WorldPoint(2997, 3916, 0));
private final String tooltip;
private final WorldPoint location;
AgilityCourseLocation(String tooltip, WorldPoint location)
{
this.tooltip = tooltip;
this.location = location;
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 2020, melky <https://github.com/melkypie>
* 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 AgilityCoursePoint extends WorldMapPoint
{
AgilityCoursePoint(AgilityCourseLocation data, BufferedImage icon, boolean showTooltip)
{
super(data.getLocation(), icon);
if (showTooltip)
{
setTooltip(data.getTooltip());
}
}
}

View File

@@ -76,11 +76,22 @@ public interface WorldMapConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = WorldMapPlugin.CONFIG_KEY_AGILITY_COURSE_TOOLTIPS,
name = "Show agility course in tooltip",
description = "Displays the name of the agility course in the tooltip",
position = 5
)
default boolean agilityCourseTooltip()
{
return true;
}
@ConfigItem( @ConfigItem(
keyName = WorldMapPlugin.CONFIG_KEY_NORMAL_TELEPORT_ICON, keyName = WorldMapPlugin.CONFIG_KEY_NORMAL_TELEPORT_ICON,
name = "Show Standard Spellbook destinations", name = "Show Standard Spellbook destinations",
description = "Show icons at the destinations for teleports in the Standard Spellbook", description = "Show icons at the destinations for teleports in the Standard Spellbook",
position = 5 position = 6
) )
default boolean normalTeleportIcon() default boolean normalTeleportIcon()
{ {
@@ -91,7 +102,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_MINIGAME_TOOLTIP, keyName = WorldMapPlugin.CONFIG_KEY_MINIGAME_TOOLTIP,
name = "Show minigame name in tooltip", name = "Show minigame name in tooltip",
description = "Display the name of the minigame in the icon tooltip", description = "Display the name of the minigame in the icon tooltip",
position = 6 position = 7
) )
default boolean minigameTooltip() default boolean minigameTooltip()
{ {
@@ -102,7 +113,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_ANCIENT_TELEPORT_ICON, keyName = WorldMapPlugin.CONFIG_KEY_ANCIENT_TELEPORT_ICON,
name = "Show Ancient Magicks destinations", name = "Show Ancient Magicks destinations",
description = "Show icons at the destinations for teleports in the Ancient Spellbook", description = "Show icons at the destinations for teleports in the Ancient Spellbook",
position = 7 position = 8
) )
default boolean ancientTeleportIcon() default boolean ancientTeleportIcon()
{ {
@@ -113,7 +124,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_LUNAR_TELEPORT_ICON, keyName = WorldMapPlugin.CONFIG_KEY_LUNAR_TELEPORT_ICON,
name = "Show Lunar Spellbook destinations", name = "Show Lunar Spellbook destinations",
description = "Show icons at the destinations for teleports in the Lunar Spellbook", description = "Show icons at the destinations for teleports in the Lunar Spellbook",
position = 8 position = 9
) )
default boolean lunarTeleportIcon() default boolean lunarTeleportIcon()
{ {
@@ -124,7 +135,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_ARCEUUS_TELEPORT_ICON, keyName = WorldMapPlugin.CONFIG_KEY_ARCEUUS_TELEPORT_ICON,
name = "Show Arceuus Spellbook destinations", name = "Show Arceuus Spellbook destinations",
description = "Show icons at the destinations for teleports in the Arceuus Spellbook", description = "Show icons at the destinations for teleports in the Arceuus Spellbook",
position = 9 position = 10
) )
default boolean arceuusTeleportIcon() default boolean arceuusTeleportIcon()
{ {
@@ -135,7 +146,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_JEWELLERY_TELEPORT_ICON, keyName = WorldMapPlugin.CONFIG_KEY_JEWELLERY_TELEPORT_ICON,
name = "Show jewellery teleport locations", name = "Show jewellery teleport locations",
description = "Show icons at the destinations for teleports from jewellery", description = "Show icons at the destinations for teleports from jewellery",
position = 10 position = 11
) )
default boolean jewelleryTeleportIcon() default boolean jewelleryTeleportIcon()
{ {
@@ -146,7 +157,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_SCROLL_TELEPORT_ICON, keyName = WorldMapPlugin.CONFIG_KEY_SCROLL_TELEPORT_ICON,
name = "Show teleport scroll locations", name = "Show teleport scroll locations",
description = "Show icons at the destinations for teleports from scrolls", description = "Show icons at the destinations for teleports from scrolls",
position = 11 position = 12
) )
default boolean scrollTeleportIcon() default boolean scrollTeleportIcon()
{ {
@@ -157,7 +168,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_MISC_TELEPORT_ICON, keyName = WorldMapPlugin.CONFIG_KEY_MISC_TELEPORT_ICON,
name = "Show misc teleport locations", name = "Show misc teleport locations",
description = "Show icons at the destinations for miscellaneous teleport items", description = "Show icons at the destinations for miscellaneous teleport items",
position = 12 position = 13
) )
default boolean miscellaneousTeleportIcon() default boolean miscellaneousTeleportIcon()
{ {
@@ -168,7 +179,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_QUEST_START_TOOLTIPS, keyName = WorldMapPlugin.CONFIG_KEY_QUEST_START_TOOLTIPS,
name = "Show quest names and status", name = "Show quest names and status",
description = "Indicates the names of quests and shows completion status", description = "Indicates the names of quests and shows completion status",
position = 13 position = 14
) )
default boolean questStartTooltips() default boolean questStartTooltips()
{ {
@@ -179,7 +190,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_FARMING_PATCH_TOOLTIPS, keyName = WorldMapPlugin.CONFIG_KEY_FARMING_PATCH_TOOLTIPS,
name = "Show farming patch type", name = "Show farming patch type",
description = "Display the type of farming patches in the icon tooltip", description = "Display the type of farming patches in the icon tooltip",
position = 14 position = 15
) )
default boolean farmingPatchTooltips() default boolean farmingPatchTooltips()
{ {
@@ -190,7 +201,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_TOOLTIPS, keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_TOOLTIPS,
name = "Show rare tree type", name = "Show rare tree type",
description = "Display the type of rare tree in the icon tooltip", description = "Display the type of rare tree in the icon tooltip",
position = 15 position = 16
) )
default boolean rareTreeTooltips() default boolean rareTreeTooltips()
{ {
@@ -201,7 +212,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_LEVEL_ICON, keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_LEVEL_ICON,
name = "Indicate unavailable trees", name = "Indicate unavailable trees",
description = "Indicate rare trees you do not have the level to cut on the icon", description = "Indicate rare trees you do not have the level to cut on the icon",
position = 16 position = 17
) )
default boolean rareTreeLevelIcon() default boolean rareTreeLevelIcon()
{ {
@@ -212,7 +223,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_TRANSPORATION_TELEPORT_TOOLTIPS, keyName = WorldMapPlugin.CONFIG_KEY_TRANSPORATION_TELEPORT_TOOLTIPS,
name = "Show transporation tooltips", name = "Show transporation tooltips",
description = "Indicates types and destinations of Transporation", description = "Indicates types and destinations of Transporation",
position = 17 position = 18
) )
default boolean transportationTeleportTooltips() default boolean transportationTeleportTooltips()
{ {
@@ -223,7 +234,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_RUNECRAFTING_ALTAR_ICON, keyName = WorldMapPlugin.CONFIG_KEY_RUNECRAFTING_ALTAR_ICON,
name = "Show runecrafting altar locations", name = "Show runecrafting altar locations",
description = "Show the icons of runecrafting altars", description = "Show the icons of runecrafting altars",
position = 18 position = 19
) )
default boolean runecraftingAltarIcon() default boolean runecraftingAltarIcon()
{ {
@@ -234,7 +245,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_MINING_SITE_TOOLTIPS, keyName = WorldMapPlugin.CONFIG_KEY_MINING_SITE_TOOLTIPS,
name = "Show mining site tooltips", name = "Show mining site tooltips",
description = "Indicates the ore available at mining sites", description = "Indicates the ore available at mining sites",
position = 19 position = 20
) )
default boolean miningSiteTooltips() default boolean miningSiteTooltips()
{ {
@@ -245,7 +256,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_DUNGEON_TOOLTIPS, keyName = WorldMapPlugin.CONFIG_KEY_DUNGEON_TOOLTIPS,
name = "Show dungeon tooltips", name = "Show dungeon tooltips",
description = "Indicates the names of dungeons", description = "Indicates the names of dungeons",
position = 20 position = 21
) )
default boolean dungeonTooltips() default boolean dungeonTooltips()
{ {
@@ -256,7 +267,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_HUNTER_AREA_TOOLTIPS, keyName = WorldMapPlugin.CONFIG_KEY_HUNTER_AREA_TOOLTIPS,
name = "Show hunter area tooltips", name = "Show hunter area tooltips",
description = "Indicates the creatures inside a hunting area", description = "Indicates the creatures inside a hunting area",
position = 21 position = 22
) )
default boolean hunterAreaTooltips() default boolean hunterAreaTooltips()
{ {
@@ -267,7 +278,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_FISHING_SPOT_TOOLTIPS, keyName = WorldMapPlugin.CONFIG_KEY_FISHING_SPOT_TOOLTIPS,
name = "Show fishing spot tooltips", name = "Show fishing spot tooltips",
description = "Indicates the type of fish fishable at the fishing spot", description = "Indicates the type of fish fishable at the fishing spot",
position = 22 position = 23
) )
default boolean fishingSpotTooltips() default boolean fishingSpotTooltips()
{ {

View File

@@ -67,6 +67,7 @@ public class WorldMapPlugin extends Plugin
static final String CONFIG_KEY_FAIRY_RING_ICON = "fairyRingIcon"; static final String CONFIG_KEY_FAIRY_RING_ICON = "fairyRingIcon";
static final String CONFIG_KEY_AGILITY_SHORTCUT_TOOLTIPS = "agilityShortcutTooltips"; static final String CONFIG_KEY_AGILITY_SHORTCUT_TOOLTIPS = "agilityShortcutTooltips";
static final String CONFIG_KEY_AGILITY_SHORTCUT_LEVEL_ICON = "agilityShortcutIcon"; static final String CONFIG_KEY_AGILITY_SHORTCUT_LEVEL_ICON = "agilityShortcutIcon";
static final String CONFIG_KEY_AGILITY_COURSE_TOOLTIPS = "agilityCourseTooltips";
static final String CONFIG_KEY_NORMAL_TELEPORT_ICON = "standardSpellbookIcon"; static final String CONFIG_KEY_NORMAL_TELEPORT_ICON = "standardSpellbookIcon";
static final String CONFIG_KEY_ANCIENT_TELEPORT_ICON = "ancientSpellbookIcon"; static final String CONFIG_KEY_ANCIENT_TELEPORT_ICON = "ancientSpellbookIcon";
static final String CONFIG_KEY_LUNAR_TELEPORT_ICON = "lunarSpellbookIcon"; static final String CONFIG_KEY_LUNAR_TELEPORT_ICON = "lunarSpellbookIcon";
@@ -164,6 +165,7 @@ public class WorldMapPlugin extends Plugin
worldMapPointManager.removeIf(RunecraftingAltarPoint.class::isInstance); worldMapPointManager.removeIf(RunecraftingAltarPoint.class::isInstance);
worldMapPointManager.removeIf(DungeonPoint.class::isInstance); worldMapPointManager.removeIf(DungeonPoint.class::isInstance);
worldMapPointManager.removeIf(FishingSpotPoint.class::isInstance); worldMapPointManager.removeIf(FishingSpotPoint.class::isInstance);
worldMapPointManager.removeIf(AgilityCoursePoint.class::isInstance);
agilityLevel = 0; agilityLevel = 0;
woodcuttingLevel = 0; woodcuttingLevel = 0;
} }
@@ -233,6 +235,21 @@ public class WorldMapPlugin extends Plugin
} }
} }
private void updateAgilityCourseIcons()
{
worldMapPointManager.removeIf(AgilityCoursePoint.class::isInstance);
if (config.agilityCourseTooltip())
{
Arrays.stream(AgilityCourseLocation.values())
.filter(value -> value.getLocation() != null)
.map(value -> new AgilityCoursePoint(value,
BLANK_ICON,
config.agilityCourseTooltip()))
.forEach(worldMapPointManager::add);
}
}
private void updateRareTreeIcons() private void updateRareTreeIcons()
{ {
worldMapPointManager.removeIf(RareTreePoint.class::isInstance); worldMapPointManager.removeIf(RareTreePoint.class::isInstance);
@@ -253,6 +270,7 @@ public class WorldMapPlugin extends Plugin
private void updateShownIcons() private void updateShownIcons()
{ {
updateAgilityIcons(); updateAgilityIcons();
updateAgilityCourseIcons();
updateRareTreeIcons(); updateRareTreeIcons();
updateQuestStartPointIcons(); updateQuestStartPointIcons();