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 066fae5080..5d26420889 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
@@ -154,11 +154,22 @@ public interface ScreenshotConfig extends Config
return false;
}
+ @ConfigItem(
+ keyName = "valuableDrop",
+ name = "Screenshot Valuable drops",
+ description = "Configures whether or not screenshots are automatically taken when you receive a valuable/untradeable drop.",
+ position = 11
+ )
+ default boolean screenshotValuableDrop()
+ {
+ return false;
+ }
+
@ConfigItem(
keyName = "hotkey",
name = "Screenshot hotkey",
description = "When you press this key a screenshot will be taken",
- position = 11
+ position = 12
)
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 4b019e347b..c15db92117 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
@@ -119,6 +119,7 @@ public class ScreenshotPlugin extends Plugin
private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)");
private static final Pattern LEVEL_UP_PATTERN = Pattern.compile(".*Your ([a-zA-Z]+) (?:level is|are)? now (\\d+)\\.");
private static final Pattern BOSSKILL_MESSAGE_PATTERN = Pattern.compile("Your (.+) kill count is:
(\\d+).");
+ private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*(Valuable|Untradeable) drop: ([^<>]+)(?:)?");
private static final ImmutableList PET_MESSAGES = ImmutableList.of("You have a funny feeling like you're being followed",
"You feel something weird sneaking into your backpack",
"You have a funny feeling like you would have been followed");
@@ -366,6 +367,18 @@ public class ScreenshotPlugin extends Plugin
takeScreenshot(fileName);
}
}
+
+ if (config.screenshotValuableDrop())
+ {
+ Matcher m = VALUABLE_DROP_PATTERN.matcher(chatMessage);
+ if (m.matches())
+ {
+ String valuableDropType = m.group(1);
+ String valuableDropName = m.group(2);
+ String fileName = valuableDropType + " drop " + valuableDropName + " " + format(new Date());
+ takeScreenshot(fileName);
+ }
+ }
}
@Subscribe
diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java
index b250ef9b41..765ca672df 100644
--- a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java
+++ b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java
@@ -63,6 +63,8 @@ public class ScreenshotPluginTest
private static final String BARROWS_CHEST = "Your Barrows chest count is 310";
private static final String CHAMBERS_OF_XERIC_CHEST = "Your completed Chambers of Xeric count is: 489.";
private static final String THEATRE_OF_BLOOD_CHEST = "Your completed Theatre of Blood count is: 73.";
+ private static final String VALUABLE_DROP = "Valuable drop: 6 x Bronze arrow (42 coins)";
+ private static final String UNTRADEABLE_DROP = "Untradeable drop: Rusty sword";
@Mock
@Bind
@@ -101,6 +103,7 @@ public class ScreenshotPluginTest
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
when(screenshotConfig.screenshotRewards()).thenReturn(true);
when(screenshotConfig.screenshotLevels()).thenReturn(true);
+ when(screenshotConfig.screenshotValuableDrop()).thenReturn(true);
}
@Test
@@ -140,6 +143,24 @@ public class ScreenshotPluginTest
assertEquals(73, screenshotPlugin.gettheatreOfBloodNumber());
}
+ @Test
+ public void testValuableDrop()
+ {
+ ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", VALUABLE_DROP, null);
+ screenshotPlugin.onChatMessage(chatMessageEvent);
+
+ verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class));
+ }
+
+ @Test
+ public void testUntradeableDrop()
+ {
+ ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", UNTRADEABLE_DROP, null);
+ screenshotPlugin.onChatMessage(chatMessageEvent);
+
+ verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class));
+ }
+
@Test
public void testHitpointsLevel99()
{