Add boss skill screenshots (#5030)

Closes #5010
This commit is contained in:
ItsSebas
2018-08-22 11:30:15 +02:00
committed by Tomas Slusny
parent fa51eb338c
commit 6807be8899
2 changed files with 36 additions and 12 deletions

View File

@@ -120,6 +120,29 @@ public interface ScreenshotConfig extends Config
return false;
}
@ConfigItem(
keyName = "kills",
name = "Screenshot PvP Kills",
description = "Configures whether or not screenshots are automatically taken of PvP kills",
position = 8
)
default boolean screenshotKills()
{
return false;
}
@ConfigItem(
keyName = "boss",
name = "Screenshot Boss Kills",
description = "Configures whether or not screenshots are automatically taken of boss kills",
position = 9
)
default boolean screenshotBossKills()
{
return false;
}
@ConfigItem(
keyName = "hotkey",
name = "Screenshot hotkey",
@@ -130,15 +153,4 @@ public interface ScreenshotConfig extends Config
{
return Keybind.NOT_SET;
}
@ConfigItem(
keyName = "kills",
name = "Screenshot PvP Kills",
description = "Configures whether or not screenshots are automatically taken of PvP kills",
position = 9
)
default boolean screenshotKills()
{
return false;
}
}

View File

@@ -117,7 +117,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 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");
@@ -344,6 +344,18 @@ public class ScreenshotPlugin extends Plugin
String fileName = "Kill " + format(new Date());
takeScreenshot(fileName);
}
if (config.screenshotBossKills() )
{
Matcher m = BOSSKILL_MESSAGE_PATTERN.matcher(chatMessage);
if (m.matches())
{
String bossName = m.group(1);
String bossKillcount = m.group(2);
String fileName = bossName + " kill " + bossKillcount;
takeScreenshot(fileName);
}
}
}
@Subscribe