screenshot plugin: add screenshot on valuable/untradeable item drop

This commit is contained in:
tanlines
2018-12-06 01:17:28 +11:00
committed by Adam
parent 86faa466e0
commit 83eee1f074
3 changed files with 46 additions and 1 deletions

View File

@@ -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()
{

View File

@@ -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: <col=ff0000>(\\d+)</col>.");
private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*(Valuable|Untradeable) drop: ([^<>]+)(?:</col>)?");
private static final ImmutableList<String> 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