Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: translate valuable chests from barrows into the valuable drops … #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public class BetterDiscordLootLoggerPlugin extends Plugin
{
private static final String COLLECTION_LOG_TEXT = "New item added to your collection log: ";
private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*Valuable drop: ([^<>]+?\\(((?:\\d+,?)+) coins\\))(?:</col>)?");
private static final Pattern VALUABLE_CHEST_DROP_PATTERN = Pattern.compile(".*Your chest is worth around ([^<>]+?\\(((?:\\d+,?)+) coins\\))(?:</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");
Expand Down Expand Up @@ -182,6 +183,12 @@ public void onChatMessage(ChatMessage event)
if (config.includeValuableDrops())
{
Matcher matcher = VALUABLE_DROP_PATTERN.matcher(chatMessage);

//If it does not match the valuable drop pattern then try the valuable chest drop pattern (Barrows chests)
if (!matcher.matches()) {
matcher = VALUABLE_CHEST_DROP_PATTERN.matcher(chatMessage);
}

if (matcher.matches())
{
int valuableDropValue = Integer.parseInt(matcher.group(2).replaceAll(",", ""));
Expand Down