Merge pull request #13138 from williameschmidt/Issue_13137_Valuable_Drop_Screenshot_Minimum_Value_Threshold

Add independent valuable drop screenshot minimum value threshold
This commit is contained in:
Jordan
2021-02-06 23:15:35 +00:00
committed by GitHub
3 changed files with 48 additions and 9 deletions

View File

@@ -205,11 +205,23 @@ public interface ScreenshotConfig extends Config
return false;
}
@ConfigItem(
keyName = "valuableDropThreshold",
name = "Valuable Threshold",
description = "The minimum value to save screenshots of valuable drops.",
position = 14,
section = whatSection
)
default int valuableDropThreshold()
{
return 0;
}
@ConfigItem(
keyName = "untradeableDrop",
name = "Screenshot Untradeable drops",
description = "Configures whether or not screenshots are automatically taken when you receive an untradeable drop.",
position = 14,
position = 15,
section = whatSection
)
default boolean screenshotUntradeableDrop()
@@ -221,7 +233,7 @@ public interface ScreenshotConfig extends Config
keyName = "ccKick",
name = "Screenshot Kicks from FC",
description = "Take a screenshot when you kick a user from a friends chat.",
position = 15,
position = 16,
section = whatSection
)
default boolean screenshotKick()
@@ -233,7 +245,7 @@ public interface ScreenshotConfig extends Config
keyName = "baHighGamble",
name = "Screenshot BA high gambles",
description = "Take a screenshot of your reward from a high gamble at Barbarian Assault.",
position = 16,
position = 17,
section = whatSection
)
default boolean screenshotHighGamble()
@@ -245,7 +257,7 @@ public interface ScreenshotConfig extends Config
keyName = "hotkey",
name = "Screenshot hotkey",
description = "When you press this key a screenshot will be taken",
position = 17
position = 18
)
default Keybind hotkey()
{

View File

@@ -99,7 +99,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: <col=ff0000>(\\d+)</col>.");
private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*Valuable drop: ([^<>]+)(?:</col>)?");
private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*Valuable drop: ([^<>]+?\\(((?:\\d+,?)+) coins\\))(?:</col>)?");
private static final Pattern UNTRADEABLE_DROP_PATTERN = Pattern.compile(".*Untradeable drop: ([^<>]+)(?:</col>)?");
private static final Pattern DUEL_END_PATTERN = Pattern.compile("You have now (won|lost) ([0-9]+) duels?\\.");
private static final Pattern QUEST_PATTERN_1 = Pattern.compile(".+?ve\\.*? (?<verb>been|rebuilt|.+?ed)? ?(?:the )?'?(?<quest>.+?)'?(?: [Qq]uest)?[!.]?$");
@@ -417,9 +417,13 @@ public class ScreenshotPlugin extends Plugin
Matcher m = VALUABLE_DROP_PATTERN.matcher(chatMessage);
if (m.matches())
{
String valuableDropName = m.group(1);
String fileName = "Valuable drop " + valuableDropName;
takeScreenshot(fileName, "Valuable Drops");
int valuableDropValue = Integer.parseInt(m.group(2).replaceAll(",", ""));
if (valuableDropValue >= config.valuableDropThreshold())
{
String valuableDropName = m.group(1);
String fileName = "Valuable drop " + valuableDropName;
takeScreenshot(fileName, "Valuable Drops");
}
}
}