woodcutting: Add clue nest notification config (#14132)
This commit is contained in:
@@ -28,6 +28,7 @@ import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Units;
|
||||
import net.runelite.client.plugins.woodcutting.config.ClueNestTier;
|
||||
|
||||
@ConfigGroup("woodcutting")
|
||||
public interface WoodcuttingConfig extends Config
|
||||
@@ -57,6 +58,17 @@ public interface WoodcuttingConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "clueNestNotifyTier",
|
||||
name = "Clue nest notification",
|
||||
description = "Configures the clue tier from which to start notifying of a clue nest spawn"
|
||||
)
|
||||
default ClueNestTier clueNestNotifyTier()
|
||||
{
|
||||
return ClueNestTier.BEGINNER;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "showWoodcuttingStats",
|
||||
name = "Show session stats",
|
||||
description = "Configures whether to display woodcutting session stats"
|
||||
@@ -67,7 +79,7 @@ public interface WoodcuttingConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
position = 5,
|
||||
keyName = "showRedwoods",
|
||||
name = "Show Redwood trees",
|
||||
description = "Configures whether to show a indicator for redwood trees"
|
||||
@@ -78,7 +90,7 @@ public interface WoodcuttingConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
position = 6,
|
||||
keyName = "showRespawnTimers",
|
||||
name = "Show respawn timers",
|
||||
description = "Configures whether to display the respawn timer overlay"
|
||||
|
||||
@@ -51,6 +51,7 @@ import net.runelite.api.events.GameObjectDespawned;
|
||||
import net.runelite.api.events.GameObjectSpawned;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ItemSpawned;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -58,6 +59,7 @@ import net.runelite.client.events.OverlayMenuClicked;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.woodcutting.config.ClueNestTier;
|
||||
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||
@@ -107,6 +109,7 @@ public class WoodcuttingPlugin extends Plugin
|
||||
private final List<TreeRespawn> respawns = new ArrayList<>();
|
||||
private boolean recentlyLoggedIn;
|
||||
private int currentPlane;
|
||||
private ClueNestTier clueTierSpawned;
|
||||
|
||||
@Provides
|
||||
WoodcuttingConfig getConfig(ConfigManager configManager)
|
||||
@@ -130,6 +133,7 @@ public class WoodcuttingPlugin extends Plugin
|
||||
treeObjects.clear();
|
||||
session = null;
|
||||
axe = null;
|
||||
clueTierSpawned = null;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -148,6 +152,7 @@ public class WoodcuttingPlugin extends Plugin
|
||||
public void onGameTick(GameTick gameTick)
|
||||
{
|
||||
recentlyLoggedIn = false;
|
||||
clueTierSpawned = null;
|
||||
currentPlane = client.getPlane();
|
||||
|
||||
respawns.removeIf(TreeRespawn::isExpired);
|
||||
@@ -190,11 +195,26 @@ public class WoodcuttingPlugin extends Plugin
|
||||
|
||||
if (event.getMessage().contains("A bird's nest falls out of the tree") && config.showNestNotification())
|
||||
{
|
||||
notifier.notify("A bird nest has spawned!");
|
||||
if (clueTierSpawned == null || clueTierSpawned.ordinal() >= config.clueNestNotifyTier().ordinal())
|
||||
{
|
||||
notifier.notify("A bird nest has spawned!");
|
||||
}
|
||||
// Clear the clue tier that has previously spawned
|
||||
clueTierSpawned = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemSpawned(ItemSpawned itemSpawned)
|
||||
{
|
||||
if (clueTierSpawned == null)
|
||||
{
|
||||
// This will be set only if one of the clue nests has spawned. It will then be reset the next game tick.
|
||||
clueTierSpawned = ClueNestTier.getTierFromItem(itemSpawned.getItem().getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameObjectSpawned(final GameObjectSpawned event)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Tal <https://github.com/talsk>
|
||||
* 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.woodcutting.config;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.runelite.api.ItemID;
|
||||
|
||||
public enum ClueNestTier
|
||||
{
|
||||
BEGINNER,
|
||||
EASY,
|
||||
MEDIUM,
|
||||
HARD,
|
||||
ELITE,
|
||||
DISABLED;
|
||||
|
||||
|
||||
private static final ImmutableMap<Integer, ClueNestTier> CLUE_NEST_ID_TO_TIER = new ImmutableMap.Builder<Integer, ClueNestTier>()
|
||||
.put(ItemID.CLUE_NEST_ELITE, ClueNestTier.ELITE)
|
||||
.put(ItemID.CLUE_NEST_HARD, ClueNestTier.HARD)
|
||||
.put(ItemID.CLUE_NEST_MEDIUM, ClueNestTier.MEDIUM)
|
||||
.put(ItemID.CLUE_NEST_EASY, ClueNestTier.EASY)
|
||||
.put(ItemID.CLUE_NEST_BEGINNER, ClueNestTier.BEGINNER)
|
||||
.build();
|
||||
|
||||
static public ClueNestTier getTierFromItem(int itemId)
|
||||
{
|
||||
return CLUE_NEST_ID_TO_TIER.get(itemId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user