fishing plugin: update for fishing trawler changes
Modify game timer to be 5 minutes. Add option to replace the fish caught text with contribution amount Remove activity timer notification as the mechanic has been removed Co-authored-by: Attrolantra <ebrie3@gmail.com>
This commit is contained in:
@@ -433,7 +433,8 @@ public enum WidgetInfo
|
||||
EXPERIENCE_TRACKER_WIDGET(WidgetID.EXPERIENCE_TRACKER_GROUP_ID, WidgetID.ExperienceTracker.WIDGET),
|
||||
EXPERIENCE_TRACKER_BOTTOM_BAR(WidgetID.EXPERIENCE_TRACKER_GROUP_ID, WidgetID.ExperienceTracker.BOTTOM_BAR),
|
||||
|
||||
FISHING_TRAWLER_TIMER(WidgetID.FISHING_TRAWLER_GROUP_ID, 14),
|
||||
FISHING_TRAWLER_CONTRIBUTION(WidgetID.FISHING_TRAWLER_GROUP_ID, 14),
|
||||
FISHING_TRAWLER_TIMER(WidgetID.FISHING_TRAWLER_GROUP_ID, 15),
|
||||
|
||||
TITHE_FARM(WidgetID.TITHE_FARM_GROUP_ID, 3),
|
||||
|
||||
|
||||
@@ -173,22 +173,22 @@ public interface FishingConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "trawlerNotification",
|
||||
name = "Trawler activity notification",
|
||||
description = "Send a notification when fishing trawler activity drops below 15%."
|
||||
keyName = "trawlerTimer",
|
||||
name = "Trawler timer in M:SS",
|
||||
description = "Trawler timer will display a more accurate timer in M:SS format."
|
||||
)
|
||||
default boolean trawlerNotification()
|
||||
default boolean trawlerTimer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
keyName = "trawlerTimer",
|
||||
name = "Trawler timer in MM:SS",
|
||||
description = "Trawler Timer will display a more accurate timer in MM:SS format."
|
||||
keyName = "trawlerContribution",
|
||||
name = "Trawler contribution",
|
||||
description = "Display the exact number of trawler contribution points gained."
|
||||
)
|
||||
default boolean trawlerTimer()
|
||||
default boolean trawlerContribution()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ import net.runelite.api.events.InteractingChanged;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
@@ -86,8 +85,7 @@ 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_TIME_LIMIT_IN_SECONDS = 614;
|
||||
private static final int TRAWLER_ACTIVITY_THRESHOLD = Math.round(0.15f * 255);
|
||||
private static final int TRAWLER_TIME_LIMIT_IN_SECONDS = 314;
|
||||
|
||||
private Instant trawlerStartTime;
|
||||
|
||||
@@ -124,8 +122,6 @@ public class FishingPlugin extends Plugin
|
||||
@Inject
|
||||
private FishingSpotMinimapOverlay fishingSpotMinimapOverlay;
|
||||
|
||||
private boolean trawlerNotificationSent;
|
||||
|
||||
@Provides
|
||||
FishingConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -150,7 +146,6 @@ public class FishingPlugin extends Plugin
|
||||
overlayManager.remove(fishingSpotMinimapOverlay);
|
||||
fishingSpots.clear();
|
||||
minnowSpots.clear();
|
||||
trawlerNotificationSent = false;
|
||||
currentSpot = null;
|
||||
trawlerStartTime = null;
|
||||
}
|
||||
@@ -328,10 +323,8 @@ public class FishingPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (config.trawlerTimer())
|
||||
{
|
||||
updateTrawlerTimer();
|
||||
}
|
||||
updateTrawlerTimer();
|
||||
updateTrawlerContribution();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -362,40 +355,42 @@ public class FishingPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@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("You have low Fishing Trawler activity!");
|
||||
trawlerNotificationSent = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trawlerNotificationSent = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.FISHING_TRAWLER_GROUP_ID)
|
||||
{
|
||||
trawlerStartTime = Instant.now();
|
||||
log.debug("Trawler session started");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the trawler contribution value
|
||||
*/
|
||||
private void updateTrawlerContribution()
|
||||
{
|
||||
int regionID = client.getLocalPlayer().getWorldLocation().getRegionID();
|
||||
if (regionID != TRAWLER_SHIP_REGION_NORMAL && regionID != TRAWLER_SHIP_REGION_SINKING)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!config.trawlerContribution())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Widget trawlerContributionWidget = client.getWidget(WidgetInfo.FISHING_TRAWLER_CONTRIBUTION);
|
||||
if (trawlerContributionWidget == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int trawlerContribution = client.getVar(Varbits.FISHING_TRAWLER_ACTIVITY);
|
||||
trawlerContributionWidget.setText("Contribution: " + trawlerContribution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the Fishing Trawler timer widget from minutes to minutes and seconds
|
||||
*/
|
||||
@@ -414,6 +409,11 @@ public class FishingPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (!config.trawlerTimer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Widget trawlerTimerWidget = client.getWidget(WidgetInfo.FISHING_TRAWLER_TIMER);
|
||||
if (trawlerTimerWidget == null)
|
||||
{
|
||||
@@ -438,7 +438,7 @@ public class FishingPlugin extends Plugin
|
||||
}
|
||||
else
|
||||
{
|
||||
trawlerText.append("00");
|
||||
trawlerText.append('0');
|
||||
}
|
||||
|
||||
trawlerText.append(':');
|
||||
|
||||
Reference in New Issue
Block a user