Add notification for low fishing trawler activity
This commit is contained in:
@@ -211,6 +211,12 @@ public enum Varbits
|
||||
*/
|
||||
IN_GAME_BA(3923),
|
||||
|
||||
/**
|
||||
* Fishing Trawler
|
||||
* FISHING_TRAWLER_ACTIVITY Expected values: 0-255
|
||||
*/
|
||||
FISHING_TRAWLER_ACTIVITY(3377),
|
||||
|
||||
/**
|
||||
* Blast Furnace Bar Dispenser
|
||||
*
|
||||
|
||||
@@ -32,10 +32,10 @@ import net.runelite.client.config.ConfigItem;
|
||||
public interface FishingConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "showIcons",
|
||||
name = "Display Fish icons",
|
||||
description = "Configures whether icons or text is displayed",
|
||||
position = 1
|
||||
description = "Display icons instead of text on fishing spots."
|
||||
)
|
||||
default boolean showIcons()
|
||||
{
|
||||
@@ -43,10 +43,10 @@ public interface FishingConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "statTimeout",
|
||||
name = "Reset stats (minutes)",
|
||||
description = "Configures the time until statistic is reset",
|
||||
position = 2
|
||||
description = "The time until fishing session data is reset in minutes."
|
||||
)
|
||||
default int statTimeout()
|
||||
{
|
||||
@@ -54,10 +54,10 @@ public interface FishingConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "showFishingStats",
|
||||
name = "Show Fishing session stats",
|
||||
description = "Configures whether to display the fishing session stats",
|
||||
position = 3
|
||||
description = "Display the fishing session stats."
|
||||
)
|
||||
default boolean showFishingStats()
|
||||
{
|
||||
@@ -65,13 +65,24 @@ public interface FishingConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "showMinnowOverlay",
|
||||
name = "Show Minnow Movement overlay",
|
||||
description = "Configures whether to display the minnow progress pie overlay",
|
||||
position = 4
|
||||
description = "Display the minnow progress pie overlay."
|
||||
)
|
||||
default boolean showMinnowOverlay()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "trawlerNotification",
|
||||
name = "Trawler activity notification",
|
||||
description = "Send a notification when fishing trawler activity drops below 15%."
|
||||
)
|
||||
default boolean trawlerNotification()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,17 +40,21 @@ import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.queries.NPCQuery;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
@@ -69,6 +73,11 @@ import net.runelite.client.util.QueryRunner;
|
||||
@Slf4j
|
||||
public class FishingPlugin extends Plugin
|
||||
{
|
||||
private static final int TRAWLER_SHIP_REGION_NORMAL = 7499;
|
||||
private static final int TRAWLER_SHIP_REGION_SINKING = 8011;
|
||||
|
||||
private static final int TRAWLER_ACTIVITY_THRESHOLD = Math.round(0.15f * 255);
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final FishingSession session = new FishingSession();
|
||||
|
||||
@@ -84,6 +93,9 @@ public class FishingPlugin extends Plugin
|
||||
@Inject
|
||||
private QueryRunner queryRunner;
|
||||
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@@ -99,6 +111,8 @@ public class FishingPlugin extends Plugin
|
||||
@Inject
|
||||
private FishingSpotMinimapOverlay fishingSpotMinimapOverlay;
|
||||
|
||||
private boolean trawlerNotificationSent;
|
||||
|
||||
@Provides
|
||||
FishingConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -122,6 +136,7 @@ public class FishingPlugin extends Plugin
|
||||
overlayManager.remove(spotOverlay);
|
||||
overlayManager.remove(fishingSpotMinimapOverlay);
|
||||
minnowSpots.clear();
|
||||
trawlerNotificationSent = false;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -244,4 +259,29 @@ public class FishingPlugin extends Plugin
|
||||
log.debug("Minnow spot {} despawned", npc);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
if (!config.trawlerNotification() || client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int regionID = client.getLocalPlayer().getWorldLocation().getRegionID();
|
||||
|
||||
if ((regionID == TRAWLER_SHIP_REGION_NORMAL || regionID == TRAWLER_SHIP_REGION_SINKING)
|
||||
&& client.getVar(Varbits.FISHING_TRAWLER_ACTIVITY) <= TRAWLER_ACTIVITY_THRESHOLD)
|
||||
{
|
||||
if (!trawlerNotificationSent)
|
||||
{
|
||||
notifier.notify("[" + client.getLocalPlayer().getName() + "] has low Fishing Trawler activity!");
|
||||
trawlerNotificationSent = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trawlerNotificationSent = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user