Remove duplicate tracking info in fishing/woodcutting overlays
Removes items/hr and items got from skilling overlays as it is duplicate information already contained in the XP tracker. Fixes: #569
This commit is contained in:
@@ -85,19 +85,6 @@ class FishingOverlay extends Overlay
|
||||
panelComponent.setTitleColor(Color.RED);
|
||||
}
|
||||
|
||||
panelComponent.getLines().add(new PanelComponent.Line(
|
||||
"Caught fish:",
|
||||
Integer.toString(session.getTotalFished())
|
||||
));
|
||||
|
||||
|
||||
panelComponent.getLines().add(new PanelComponent.Line(
|
||||
"Fish/hr:",
|
||||
session.getRecentFished() > 2
|
||||
? Integer.toString(session.getPerHour())
|
||||
: ""
|
||||
));
|
||||
|
||||
return panelComponent.render(graphics, parent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,6 @@ import com.google.common.eventbus.Subscribe;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -48,7 +45,6 @@ import net.runelite.api.queries.NPCQuery;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.util.QueryRunner;
|
||||
|
||||
@@ -120,7 +116,7 @@ public class FishingPlugin extends Plugin
|
||||
|
||||
if (event.getMessage().contains("You catch a") || event.getMessage().contains("You catch some"))
|
||||
{
|
||||
session.incrementFishCaught();
|
||||
session.setLastFishCaught();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,26 +174,4 @@ public class FishingPlugin extends Plugin
|
||||
.idEquals(Ints.toArray(spotIds));
|
||||
fishingSpots = queryRunner.runQuery(query);
|
||||
}
|
||||
|
||||
@Schedule(
|
||||
period = 1,
|
||||
unit = ChronoUnit.SECONDS
|
||||
)
|
||||
public void checkFishing()
|
||||
{
|
||||
Instant lastFishCaught = session.getLastFishCaught();
|
||||
if (lastFishCaught == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// reset recentcaught if you haven't caught anything recently
|
||||
Duration statTimeout = Duration.ofMinutes(config.statTimeout());
|
||||
Duration sinceCaught = Duration.between(lastFishCaught, Instant.now());
|
||||
|
||||
if (sinceCaught.compareTo(statTimeout) >= 0)
|
||||
{
|
||||
session.resetRecent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,70 +24,19 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.fishing;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
public class FishingSession
|
||||
{
|
||||
private static final Duration HOUR = Duration.ofHours(1);
|
||||
|
||||
private int perHour;
|
||||
|
||||
private Instant lastFishCaught;
|
||||
private int totalFished;
|
||||
|
||||
private Instant recentFishCaught;
|
||||
private int recentFished;
|
||||
|
||||
public void incrementFishCaught()
|
||||
public void setLastFishCaught()
|
||||
{
|
||||
Instant now = Instant.now();
|
||||
|
||||
lastFishCaught = now;
|
||||
++totalFished;
|
||||
|
||||
if (recentFished == 0)
|
||||
{
|
||||
recentFishCaught = now;
|
||||
}
|
||||
++recentFished;
|
||||
|
||||
Duration timeSinceStart = Duration.between(recentFishCaught, now);
|
||||
if (!timeSinceStart.isZero())
|
||||
{
|
||||
perHour = (int) ((double) recentFished * (double) HOUR.toMillis() / (double) timeSinceStart.toMillis());
|
||||
}
|
||||
}
|
||||
|
||||
public void resetRecent()
|
||||
{
|
||||
recentFishCaught = null;
|
||||
recentFished = 0;
|
||||
}
|
||||
|
||||
public int getPerHour()
|
||||
{
|
||||
return perHour;
|
||||
lastFishCaught = Instant.now();
|
||||
}
|
||||
|
||||
public Instant getLastFishCaught()
|
||||
{
|
||||
return lastFishCaught;
|
||||
}
|
||||
|
||||
public int getTotalFished()
|
||||
{
|
||||
return totalFished;
|
||||
}
|
||||
|
||||
public Instant getRecentFishCaught()
|
||||
{
|
||||
return recentFishCaught;
|
||||
}
|
||||
|
||||
public int getRecentFished()
|
||||
{
|
||||
return recentFished;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -101,19 +101,6 @@ class WoodcuttingOverlay extends Overlay
|
||||
panelComponent.setTitleColor(Color.RED);
|
||||
}
|
||||
|
||||
panelComponent.getLines().add(new PanelComponent.Line(
|
||||
"Logs cut:",
|
||||
Integer.toString(session.getTotalCut())
|
||||
));
|
||||
|
||||
|
||||
panelComponent.getLines().add(new PanelComponent.Line(
|
||||
"Logs/hr:",
|
||||
session.getRecentCut() > 2
|
||||
? Integer.toString(session.getPerHour())
|
||||
: ""
|
||||
));
|
||||
|
||||
return panelComponent.render(graphics, parent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,7 @@ package net.runelite.client.plugins.woodcutting;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.client.Notifier;
|
||||
@@ -37,7 +35,6 @@ import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -86,7 +83,7 @@ public class WoodcuttingPlugin extends Plugin
|
||||
{
|
||||
if (event.getMessage().startsWith("You get some") && event.getMessage().endsWith("logs."))
|
||||
{
|
||||
session.incrementLogCut();
|
||||
session.setLastLogCut();
|
||||
}
|
||||
|
||||
if (event.getMessage().contains("A bird's nest falls out of the tree") && config.showNestNotification())
|
||||
@@ -95,26 +92,4 @@ public class WoodcuttingPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Schedule(
|
||||
period = 1,
|
||||
unit = ChronoUnit.SECONDS
|
||||
)
|
||||
public void checkCutting()
|
||||
{
|
||||
Instant lastLogCut = session.getLastLogCut();
|
||||
if (lastLogCut == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// reset recentCut if you haven't cut anything recently
|
||||
Duration statTimeout = Duration.ofMinutes(config.statTimeout());
|
||||
Duration sinceCut = Duration.between(lastLogCut, Instant.now());
|
||||
|
||||
if (sinceCut.compareTo(statTimeout) >= 0)
|
||||
{
|
||||
session.resetRecent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,69 +24,19 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.woodcutting;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
public class WoodcuttingSession
|
||||
{
|
||||
private static final Duration HOUR = Duration.ofHours(1);
|
||||
|
||||
private int perHour;
|
||||
|
||||
private Instant lastLogCut;
|
||||
private int totalCut;
|
||||
|
||||
private Instant recentLogCut;
|
||||
private int recentCut;
|
||||
|
||||
public void incrementLogCut()
|
||||
public void setLastLogCut()
|
||||
{
|
||||
Instant now = Instant.now();
|
||||
|
||||
lastLogCut = now;
|
||||
++totalCut;
|
||||
|
||||
if (recentCut == 0)
|
||||
{
|
||||
recentLogCut = now;
|
||||
}
|
||||
++recentCut;
|
||||
|
||||
Duration timeSinceStart = Duration.between(recentLogCut, now);
|
||||
if (!timeSinceStart.isZero())
|
||||
{
|
||||
perHour = (int) ((double) recentCut * (double) HOUR.toMillis() / (double) timeSinceStart.toMillis());
|
||||
}
|
||||
}
|
||||
|
||||
public void resetRecent()
|
||||
{
|
||||
recentLogCut = null;
|
||||
recentCut = 0;
|
||||
}
|
||||
|
||||
public int getPerHour()
|
||||
{
|
||||
return perHour;
|
||||
lastLogCut = Instant.now();
|
||||
}
|
||||
|
||||
public Instant getLastLogCut()
|
||||
{
|
||||
return lastLogCut;
|
||||
}
|
||||
|
||||
public int getTotalCut()
|
||||
{
|
||||
return totalCut;
|
||||
}
|
||||
|
||||
public Instant getRecentLogCut()
|
||||
{
|
||||
return recentLogCut;
|
||||
}
|
||||
|
||||
public int getRecentCut()
|
||||
{
|
||||
return recentCut;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user