screenshot plugin: screenshot receiving pet

This commit is contained in:
Magic fTail
2018-06-04 15:42:48 +02:00
committed by Adam
parent 1db73ddf8a
commit 0560ef239b
2 changed files with 24 additions and 2 deletions

View File

@@ -101,11 +101,22 @@ public interface ScreenshotConfig extends Config
return true;
}
@ConfigItem(
keyName = "pets",
name = "Screenshot Pet",
description = "Configures whether screenshots are taken of receiving pets",
position = 6
)
default boolean screenshotPet()
{
return true;
}
@ConfigItem(
keyName = "uploadScreenshot",
name = "Upload To Imgur",
description = "Configures whether or not screenshots are uploaded to Imgur and copied into your clipboard",
position = 6
position = 7
)
default boolean uploadScreenshot()
{
@@ -116,7 +127,7 @@ public interface ScreenshotConfig extends Config
keyName = "enableShortcut",
name = "Screenshot with [Insert]",
description = "Configures whether or not screenshots can be taken with the Insert key",
position = 7
position = 8
)
default boolean isScreenshotEnabled()
{

View File

@@ -25,6 +25,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.eventbus.Subscribe;
import com.google.inject.Provides;
@@ -106,6 +107,10 @@ 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 ImmutableList<String> petMessages = 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");
private String clueType;
private Integer clueNumber;
@@ -247,6 +252,12 @@ public class ScreenshotPlugin extends Plugin
return;
}
}
if (config.screenshotPet() && petMessages.stream().anyMatch(chatMessage::contains))
{
String fileName = "Pet " + TIME_FORMAT.format(new Date());
takeScreenshot(fileName);
}
}
@Subscribe