screenshot plugin: capture ToB rewards

This commit is contained in:
Magic fTail
2018-07-18 02:16:28 +02:00
committed by Adam
parent 394135e912
commit ddc14df306
3 changed files with 42 additions and 0 deletions

View File

@@ -92,6 +92,7 @@ public class WidgetID
public static final int WORLD_MAP_GROUP_ID = 595;
public static final int PYRAMID_PLUNDER_GROUP_ID = 428;
public static final int CHAMBERS_OF_XERIC_REWARD_GROUP_ID = 539;
public static final int THEATRE_OF_BLOOD_REWARD_GROUP_ID = 23;
public static final int EXPERIENCE_TRACKER_GROUP_ID = 122;
public static final int TITHE_FARM_GROUP_ID = 241;
public static final int KINGDOM_GROUP_ID = 392;

View File

@@ -69,6 +69,7 @@ import static net.runelite.api.widgets.WidgetID.DIALOG_SPRITE_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.KINGDOM_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.LEVEL_UP_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.QUEST_COMPLETED_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.THEATRE_OF_BLOOD_REWARD_GROUP_ID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier;
import static net.runelite.client.RuneLite.SCREENSHOT_DIR;
@@ -135,6 +136,8 @@ public class ScreenshotPlugin extends Plugin
private Integer chambersOfXericNumber;
private Integer theatreOfBloodNumber;
private boolean shouldTakeScreenshot;
@Inject
@@ -309,6 +312,16 @@ public class ScreenshotPlugin extends Plugin
}
}
if (chatMessage.startsWith("Your completed Theatre of Blood count is:"))
{
Matcher m = NUMBER_PATTERN.matcher(Text.removeTags(chatMessage));
if (m.find())
{
theatreOfBloodNumber = Integer.valueOf(m.group());
return;
}
}
if (config.screenshotPet() && PET_MESSAGES.stream().anyMatch(chatMessage::contains))
{
String fileName = "Pet " + format(new Date());
@@ -333,6 +346,7 @@ public class ScreenshotPlugin extends Plugin
case QUEST_COMPLETED_GROUP_ID:
case CLUE_SCROLL_REWARD_GROUP_ID:
case CHAMBERS_OF_XERIC_REWARD_GROUP_ID:
case THEATRE_OF_BLOOD_REWARD_GROUP_ID:
case BARROWS_REWARD_GROUP_ID:
if (!config.screenshotRewards())
{
@@ -373,6 +387,17 @@ public class ScreenshotPlugin extends Plugin
chambersOfXericNumber = null;
break;
}
case THEATRE_OF_BLOOD_REWARD_GROUP_ID:
{
if (theatreOfBloodNumber == null)
{
return;
}
fileName = "Theatre of Blood(" + theatreOfBloodNumber + ")";
theatreOfBloodNumber = null;
break;
}
case BARROWS_REWARD_GROUP_ID:
{
if (barrowsNumber == null)
@@ -608,4 +633,10 @@ public class ScreenshotPlugin extends Plugin
{
return chambersOfXericNumber;
}
@VisibleForTesting
int gettheatreOfBloodNumber()
{
return theatreOfBloodNumber;
}
}

View File

@@ -62,6 +62,7 @@ public class ScreenshotPluginTest
private static final String CLUE_SCROLL = "<col=3300ff>You have completed 28 medium Treasure Trails</col>";
private static final String BARROWS_CHEST = "Your Barrows chest count is <col=ff0000>310</col>";
private static final String CHAMBERS_OF_XERIC_CHEST = "Your completed Chambers of Xeric count is: <col=ff0000>489</col>.";
private static final String THEATRE_OF_BLOOD_CHEST = "Your completed Theatre of Blood count is: <col=ff0000>73</col>.";
@Mock
@Bind
@@ -130,6 +131,15 @@ public class ScreenshotPluginTest
assertEquals(489, screenshotPlugin.getChambersOfXericNumber());
}
@Test
public void testTheatreOfBloodChest()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Magic fTail", THEATRE_OF_BLOOD_CHEST, null);
screenshotPlugin.onChatMessage(chatMessageEvent);
assertEquals(73, screenshotPlugin.gettheatreOfBloodNumber());
}
@Test
public void testHitpointsLevel99()
{