screenshot: update duel arena messages
This commit is contained in:
@@ -109,7 +109,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
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: ([^<>]+?\\(((?:\\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 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)?[!.]?$");
|
||||
private static final Pattern QUEST_PATTERN_2 = Pattern.compile("'?(?<quest>.+?)'?(?: [Qq]uest)? (?<verb>[a-z]\\w+?ed)?(?: f.*?)?[!.]?$");
|
||||
private static final ImmutableList<String> RFD_TAGS = ImmutableList.of("Another Cook", "freed", "defeated", "saved");
|
||||
@@ -482,7 +482,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
if (m.find())
|
||||
{
|
||||
String result = m.group(1);
|
||||
String count = m.group(2);
|
||||
String count = m.group(2).replace(",", "");
|
||||
String fileName = "Duel " + result + " (" + count + ")";
|
||||
takeScreenshot(fileName, SD_DUELS);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.function.Consumer;
|
||||
import javax.inject.Inject;
|
||||
import static net.runelite.api.ChatMessageType.GAMEMESSAGE;
|
||||
import static net.runelite.api.ChatMessageType.TRADE;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.VarClientStr;
|
||||
@@ -60,6 +61,7 @@ import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
@@ -135,6 +137,7 @@ public class ScreenshotPluginTest
|
||||
when(screenshotConfig.valuableDropThreshold()).thenReturn(1000);
|
||||
when(screenshotConfig.screenshotUntradeableDrop()).thenReturn(true);
|
||||
when(screenshotConfig.screenshotCollectionLogEntries()).thenReturn(true);
|
||||
when(screenshotConfig.screenshotDuels()).thenReturn(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -424,4 +427,32 @@ public class ScreenshotPluginTest
|
||||
|
||||
verifyNoMoreInteractions(drawManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuelWin()
|
||||
{
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 1,909 duels.", null, 0);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(drawManager).requestNextFrameListener(any(Consumer.class));
|
||||
|
||||
chatMessageEvent = new ChatMessage(null, TRADE, "", "You have lost 145 duels.", null, 0);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verifyNoMoreInteractions(drawManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuelLoss()
|
||||
{
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 1,909 duels.", null, 0);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(drawManager, never()).requestNextFrameListener(any(Consumer.class));
|
||||
|
||||
chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 1,909 duels.", null, 0);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(drawManager).requestNextFrameListener(any(Consumer.class));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user