Add notification for low fishing trawler activity
This commit is contained in:
@@ -211,6 +211,12 @@ public enum Varbits
|
|||||||
*/
|
*/
|
||||||
IN_GAME_BA(3923),
|
IN_GAME_BA(3923),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fishing Trawler
|
||||||
|
* FISHING_TRAWLER_ACTIVITY Expected values: 0-255
|
||||||
|
*/
|
||||||
|
FISHING_TRAWLER_ACTIVITY(3377),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blast Furnace Bar Dispenser
|
* Blast Furnace Bar Dispenser
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
public interface FishingConfig extends Config
|
public interface FishingConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 1,
|
||||||
keyName = "showIcons",
|
keyName = "showIcons",
|
||||||
name = "Display Fish icons",
|
name = "Display Fish icons",
|
||||||
description = "Configures whether icons or text is displayed",
|
description = "Display icons instead of text on fishing spots."
|
||||||
position = 1
|
|
||||||
)
|
)
|
||||||
default boolean showIcons()
|
default boolean showIcons()
|
||||||
{
|
{
|
||||||
@@ -43,10 +43,10 @@ public interface FishingConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 2,
|
||||||
keyName = "statTimeout",
|
keyName = "statTimeout",
|
||||||
name = "Reset stats (minutes)",
|
name = "Reset stats (minutes)",
|
||||||
description = "Configures the time until statistic is reset",
|
description = "The time until fishing session data is reset in minutes."
|
||||||
position = 2
|
|
||||||
)
|
)
|
||||||
default int statTimeout()
|
default int statTimeout()
|
||||||
{
|
{
|
||||||
@@ -54,10 +54,10 @@ public interface FishingConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 3,
|
||||||
keyName = "showFishingStats",
|
keyName = "showFishingStats",
|
||||||
name = "Show Fishing session stats",
|
name = "Show Fishing session stats",
|
||||||
description = "Configures whether to display the fishing session stats",
|
description = "Display the fishing session stats."
|
||||||
position = 3
|
|
||||||
)
|
)
|
||||||
default boolean showFishingStats()
|
default boolean showFishingStats()
|
||||||
{
|
{
|
||||||
@@ -65,13 +65,24 @@ public interface FishingConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 4,
|
||||||
keyName = "showMinnowOverlay",
|
keyName = "showMinnowOverlay",
|
||||||
name = "Show Minnow Movement overlay",
|
name = "Show Minnow Movement overlay",
|
||||||
description = "Configures whether to display the minnow progress pie overlay",
|
description = "Display the minnow progress pie overlay."
|
||||||
position = 4
|
|
||||||
)
|
)
|
||||||
default boolean showMinnowOverlay()
|
default boolean showMinnowOverlay()
|
||||||
{
|
{
|
||||||
return true;
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.Item;
|
||||||
import net.runelite.api.ItemContainer;
|
import net.runelite.api.ItemContainer;
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.api.events.ItemContainerChanged;
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
import net.runelite.api.events.NpcDespawned;
|
import net.runelite.api.events.NpcDespawned;
|
||||||
|
import net.runelite.api.events.VarbitChanged;
|
||||||
import net.runelite.api.queries.NPCQuery;
|
import net.runelite.api.queries.NPCQuery;
|
||||||
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDependency;
|
import net.runelite.client.plugins.PluginDependency;
|
||||||
@@ -69,6 +73,11 @@ import net.runelite.client.util.QueryRunner;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class FishingPlugin extends Plugin
|
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)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private final FishingSession session = new FishingSession();
|
private final FishingSession session = new FishingSession();
|
||||||
|
|
||||||
@@ -84,6 +93,9 @@ public class FishingPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private QueryRunner queryRunner;
|
private QueryRunner queryRunner;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Notifier notifier;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@@ -99,6 +111,8 @@ public class FishingPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private FishingSpotMinimapOverlay fishingSpotMinimapOverlay;
|
private FishingSpotMinimapOverlay fishingSpotMinimapOverlay;
|
||||||
|
|
||||||
|
private boolean trawlerNotificationSent;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
FishingConfig provideConfig(ConfigManager configManager)
|
FishingConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
@@ -122,6 +136,7 @@ public class FishingPlugin extends Plugin
|
|||||||
overlayManager.remove(spotOverlay);
|
overlayManager.remove(spotOverlay);
|
||||||
overlayManager.remove(fishingSpotMinimapOverlay);
|
overlayManager.remove(fishingSpotMinimapOverlay);
|
||||||
minnowSpots.clear();
|
minnowSpots.clear();
|
||||||
|
trawlerNotificationSent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -244,4 +259,29 @@ public class FishingPlugin extends Plugin
|
|||||||
log.debug("Minnow spot {} despawned", npc);
|
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