clue scroll: add toggle for hint arrows
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Seth <http://github.com/sethtroll>
|
||||
* 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.cluescrolls;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup(
|
||||
name = "Clue Scroll",
|
||||
keyName = "cluescroll",
|
||||
description = "Configuration for the clue scroll plugin"
|
||||
)
|
||||
public interface ClueScrollConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "displayHintArrows",
|
||||
name = "Display hint arrows",
|
||||
description = "Configures whether or not to display hint arrows for clues"
|
||||
)
|
||||
default boolean displayHintArrows()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
package net.runelite.client.plugins.cluescrolls;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
@@ -50,6 +51,7 @@ import net.runelite.api.Tile;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
@@ -58,6 +60,7 @@ import net.runelite.api.queries.InventoryItemQuery;
|
||||
import net.runelite.api.queries.NPCQuery;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -119,9 +122,18 @@ public class ClueScrollPlugin extends Plugin
|
||||
@Inject
|
||||
private ClueScrollWorldOverlay clueScrollWorldOverlay;
|
||||
|
||||
@Inject
|
||||
private ClueScrollConfig config;
|
||||
|
||||
private Integer clueItemId;
|
||||
private boolean clueItemChanged = false;
|
||||
|
||||
@Provides
|
||||
ClueScrollConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(ClueScrollConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Overlay> getOverlays()
|
||||
{
|
||||
@@ -175,6 +187,15 @@ public class ClueScrollPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("cluescroll") && !config.displayHintArrows())
|
||||
{
|
||||
client.clearHintArrow();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(final GameStateChanged event)
|
||||
{
|
||||
@@ -197,7 +218,7 @@ public class ClueScrollPlugin extends Plugin
|
||||
{
|
||||
final WorldPoint location = ((LocationClueScroll) clue).getLocation();
|
||||
|
||||
if (location != null)
|
||||
if (config.displayHintArrows() && location != null)
|
||||
{
|
||||
client.setHintArrow(location);
|
||||
}
|
||||
@@ -213,7 +234,7 @@ public class ClueScrollPlugin extends Plugin
|
||||
npcsToMark = queryRunner.runQuery(query);
|
||||
|
||||
// Set hint arrow to first NPC found as there can only be 1 hint arrow
|
||||
if (npcsToMark.length >= 1)
|
||||
if (config.displayHintArrows() && npcsToMark.length >= 1)
|
||||
{
|
||||
client.setHintArrow(npcsToMark[0]);
|
||||
}
|
||||
@@ -245,7 +266,7 @@ public class ClueScrollPlugin extends Plugin
|
||||
.toArray(GameObject[]::new);
|
||||
|
||||
// Set hint arrow to first object found as there can only be 1 hint arrow
|
||||
if (objectsToMark.length >= 1)
|
||||
if (config.displayHintArrows() && objectsToMark.length >= 1)
|
||||
{
|
||||
client.setHintArrow(objectsToMark[0].getWorldLocation());
|
||||
}
|
||||
@@ -300,7 +321,11 @@ public class ClueScrollPlugin extends Plugin
|
||||
|
||||
clueItemChanged = false;
|
||||
clue = null;
|
||||
client.clearHintArrow();
|
||||
|
||||
if (config.displayHintArrows())
|
||||
{
|
||||
client.clearHintArrow();
|
||||
}
|
||||
}
|
||||
|
||||
private ClueScroll findClueScroll()
|
||||
|
||||
Reference in New Issue
Block a user