screenshot: don't attempt to draw a date when there is no report button

previously this would just silently ignore the screenshot if you were
on the orb of oculus or fullscreen world map interfaces until you were
back onto one of the normal tlis where the overlay is rendered.
This commit is contained in:
Max Weber
2021-05-19 08:23:23 -06:00
committed by Adam
parent c69337d954
commit bd2cd07917

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.screenshot;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Provides;
import java.awt.Graphics;
import java.awt.Image;
@@ -34,6 +35,7 @@ import java.awt.image.BufferedImage;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDate;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Consumer;
import java.util.regex.Matcher;
@@ -56,6 +58,7 @@ import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import static net.runelite.api.widgets.WidgetID.BARROWS_REWARD_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.CHAMBERS_OF_XERIC_REWARD_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.CLUE_SCROLL_REWARD_GROUP_ID;
@@ -110,6 +113,10 @@ public class ScreenshotPlugin extends Plugin
"You feel something weird sneaking into your backpack",
"You have a funny feeling like you would have been followed");
private static final Pattern BA_HIGH_GAMBLE_REWARD_PATTERN = Pattern.compile("(?<reward>.+)!<br>High level gamble count: <col=7f0000>(?<gambleCount>.+)</col>");
private static final Set<Integer> REPORT_BUTTON_TLIS = ImmutableSet.of(
WidgetID.FIXED_VIEWPORT_GROUP_ID,
WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID,
WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID);
private String clueType;
private Integer clueNumber;
@@ -689,7 +696,7 @@ public class ScreenshotPlugin extends Plugin
executor.submit(() -> takeScreenshot(fileName, subDir, img));
};
if (config.displayDate())
if (config.displayDate() && REPORT_BUTTON_TLIS.contains(client.getTopLevelInterfaceId()))
{
screenshotOverlay.queueForTimestamp(imageCallback);
}