From 1dd82db10c4e3ed3230fcc515413ba88eea86a8c Mon Sep 17 00:00:00 2001 From: ThePharros <18340303+ThePharros@users.noreply.github.com> Date: Sun, 6 Jun 2021 14:16:06 -0400 Subject: [PATCH] screenshot: Add option to screenshot collection log entries (#13625) --- .../plugins/screenshot/ScreenshotConfig.java | 14 +++++++++++++- .../plugins/screenshot/ScreenshotPlugin.java | 8 ++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotConfig.java index 44d9d58b51..1dd5c53174 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotConfig.java @@ -253,11 +253,23 @@ public interface ScreenshotConfig extends Config return false; } + @ConfigItem( + keyName = "collectionLogEntries", + name = "Screenshot collection log entries", + description = "Take a screenshot when completing an entry in the collection log", + position = 18, + section = whatSection + ) + default boolean screenshotCollectionLogEntries() + { + return true; + } + @ConfigItem( keyName = "hotkey", name = "Screenshot hotkey", description = "When you press this key a screenshot will be taken", - position = 18 + position = 19 ) default Keybind hotkey() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java index dbda81a49c..28449b69ca 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java @@ -95,6 +95,7 @@ import net.runelite.client.util.Text; @Slf4j public class ScreenshotPlugin extends Plugin { + private static final String COLLECTION_LOG_TEXT = "New item added to your collection log: "; private static final String CHEST_LOOTED_MESSAGE = "You find some treasure in the chest!"; private static final Map CHEST_LOOT_EVENTS = ImmutableMap.of(12127, "The Gauntlet"); private static final int GAUNTLET_REGION = 7512; @@ -456,6 +457,13 @@ public class ScreenshotPlugin extends Plugin takeScreenshot(fileName, "Duels"); } } + + if (config.screenshotCollectionLogEntries() && chatMessage.startsWith(COLLECTION_LOG_TEXT)) + { + String entry = Text.removeTags(chatMessage).substring(COLLECTION_LOG_TEXT.length()); + String fileName = "Collection log (" + entry + ")"; + takeScreenshot(fileName, "Collection Log"); + } } @Subscribe