Merge pull request #11436 from melkypie/worldmap-agilitycourse

Add agility course tooltips and indicate rooftop courses in worldmap
This commit is contained in:
Tomas Slusny
2020-05-07 22:04:41 +02:00
committed by GitHub
5 changed files with 169 additions and 18 deletions

View File

@@ -0,0 +1,63 @@
/*
* 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;
private final boolean rooftopCourse;
AgilityCourseLocation(String tooltip, WorldPoint location)
{
this.tooltip = tooltip;
this.location = location;
this.rooftopCourse = this.name().contains("ROOFTOP_COURSE");
}
}

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,33 @@ public interface WorldMapConfig extends Config
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(
keyName = WorldMapPlugin.CONFIG_KEY_AGILITY_COURSE_ROOFTOP_ICON,
name = "Indicate rooftop courses",
description = "Replace the agility icon with a mark of grace for rooftop courses",
position = 6
)
default boolean agilityCourseRooftop()
{
return true;
}
@ConfigItem(
keyName = WorldMapPlugin.CONFIG_KEY_NORMAL_TELEPORT_ICON,
name = "Show Standard Spellbook destinations",
description = "Show icons at the destinations for teleports in the Standard Spellbook",
position = 5
position = 7
)
default boolean normalTeleportIcon()
{
@@ -91,7 +113,7 @@ public interface WorldMapConfig extends Config
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
position = 8
)
default boolean minigameTooltip()
{
@@ -102,7 +124,7 @@ public interface WorldMapConfig extends Config
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 = 7
position = 9
)
default boolean ancientTeleportIcon()
{
@@ -113,7 +135,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 = 8
position = 10
)
default boolean lunarTeleportIcon()
{
@@ -124,7 +146,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 = 9
position = 11
)
default boolean arceuusTeleportIcon()
{
@@ -135,7 +157,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 = 10
position = 12
)
default boolean jewelleryTeleportIcon()
{
@@ -146,7 +168,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 = 11
position = 13
)
default boolean scrollTeleportIcon()
{
@@ -157,7 +179,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 = 12
position = 14
)
default boolean miscellaneousTeleportIcon()
{
@@ -168,7 +190,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_QUEST_START_TOOLTIPS,
name = "Show quest names and status",
description = "Indicates the names of quests and shows completion status",
position = 13
position = 15
)
default boolean questStartTooltips()
{
@@ -179,7 +201,7 @@ public interface WorldMapConfig extends Config
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
position = 16
)
default boolean farmingPatchTooltips()
{
@@ -190,7 +212,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_TOOLTIPS,
name = "Show rare tree type",
description = "Display the type of rare tree in the icon tooltip",
position = 15
position = 17
)
default boolean rareTreeTooltips()
{
@@ -201,7 +223,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_LEVEL_ICON,
name = "Indicate unavailable trees",
description = "Indicate rare trees you do not have the level to cut on the icon",
position = 16
position = 18
)
default boolean rareTreeLevelIcon()
{
@@ -212,7 +234,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_TRANSPORATION_TELEPORT_TOOLTIPS,
name = "Show transporation tooltips",
description = "Indicates types and destinations of Transporation",
position = 17
position = 19
)
default boolean transportationTeleportTooltips()
{
@@ -223,7 +245,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_RUNECRAFTING_ALTAR_ICON,
name = "Show runecrafting altar locations",
description = "Show the icons of runecrafting altars",
position = 18
position = 20
)
default boolean runecraftingAltarIcon()
{
@@ -234,7 +256,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_MINING_SITE_TOOLTIPS,
name = "Show mining site tooltips",
description = "Indicates the ore available at mining sites",
position = 19
position = 21
)
default boolean miningSiteTooltips()
{
@@ -245,7 +267,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_DUNGEON_TOOLTIPS,
name = "Show dungeon tooltips",
description = "Indicates the names of dungeons",
position = 20
position = 22
)
default boolean dungeonTooltips()
{
@@ -256,7 +278,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_HUNTER_AREA_TOOLTIPS,
name = "Show hunter area tooltips",
description = "Indicates the creatures inside a hunting area",
position = 21
position = 23
)
default boolean hunterAreaTooltips()
{
@@ -267,7 +289,7 @@ public interface WorldMapConfig extends Config
keyName = WorldMapPlugin.CONFIG_KEY_FISHING_SPOT_TOOLTIPS,
name = "Show fishing spot tooltips",
description = "Indicates the type of fish fishable at the fishing spot",
position = 22
position = 24
)
default boolean fishingSpotTooltips()
{

View File

@@ -61,12 +61,15 @@ public class WorldMapPlugin extends Plugin
private static final BufferedImage STARTED_ICON;
private static final BufferedImage FINISHED_ICON;
private static final BufferedImage MINING_SITE_ICON;
private static final BufferedImage ROOFTOP_COURSE_ICON;
static final String CONFIG_KEY = "worldmap";
static final String CONFIG_KEY_FAIRY_RING_TOOLTIPS = "fairyRingTooltips";
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_LEVEL_ICON = "agilityShortcutIcon";
static final String CONFIG_KEY_AGILITY_COURSE_TOOLTIPS = "agilityCourseTooltips";
static final String CONFIG_KEY_AGILITY_COURSE_ROOFTOP_ICON = "agilityCourseRooftopIcon";
static final String CONFIG_KEY_NORMAL_TELEPORT_ICON = "standardSpellbookIcon";
static final String CONFIG_KEY_ANCIENT_TELEPORT_ICON = "ancientSpellbookIcon";
static final String CONFIG_KEY_LUNAR_TELEPORT_ICON = "lunarSpellbookIcon";
@@ -119,6 +122,10 @@ public class WorldMapPlugin extends Plugin
MINING_SITE_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB);
final BufferedImage miningSiteIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "mining_site_icon.png");
MINING_SITE_ICON.getGraphics().drawImage(miningSiteIcon, 1, 1, null);
ROOFTOP_COURSE_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB);
final BufferedImage rooftopCourseIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "rooftop_course_icon.png");
ROOFTOP_COURSE_ICON.getGraphics().drawImage(rooftopCourseIcon, 1, 1, null);
}
@Inject
@@ -164,6 +171,7 @@ public class WorldMapPlugin extends Plugin
worldMapPointManager.removeIf(RunecraftingAltarPoint.class::isInstance);
worldMapPointManager.removeIf(DungeonPoint.class::isInstance);
worldMapPointManager.removeIf(FishingSpotPoint.class::isInstance);
worldMapPointManager.removeIf(AgilityCoursePoint.class::isInstance);
agilityLevel = 0;
woodcuttingLevel = 0;
}
@@ -233,6 +241,21 @@ public class WorldMapPlugin extends Plugin
}
}
private void updateAgilityCourseIcons()
{
worldMapPointManager.removeIf(AgilityCoursePoint.class::isInstance);
if (config.agilityCourseTooltip() || config.agilityCourseRooftop())
{
Arrays.stream(AgilityCourseLocation.values())
.filter(value -> value.getLocation() != null)
.map(value -> new AgilityCoursePoint(value,
config.agilityCourseRooftop() && value.isRooftopCourse() ? ROOFTOP_COURSE_ICON : BLANK_ICON,
config.agilityCourseTooltip()))
.forEach(worldMapPointManager::add);
}
}
private void updateRareTreeIcons()
{
worldMapPointManager.removeIf(RareTreePoint.class::isInstance);
@@ -253,6 +276,7 @@ public class WorldMapPlugin extends Plugin
private void updateShownIcons()
{
updateAgilityIcons();
updateAgilityCourseIcons();
updateRareTreeIcons();
updateQuestStartPointIcons();

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B