screenshot plugin: Add raids reward

This commit is contained in:
Seth
2018-02-18 16:22:55 -06:00
parent 930ac3f5c5
commit 51df02aa59
3 changed files with 45 additions and 3 deletions

View File

@@ -73,6 +73,7 @@ public class WidgetID
public static final int BLAST_FURNACE_GROUP_ID = 474;
public static final int WORLD_MAP = 595;
public static final int PYRAMID_PLUNDER_GROUP_ID = 428;
public static final int RAIDS_REWARD_GROUP_ID = 539;
static class WorldMap
{

View File

@@ -65,6 +65,7 @@ import static net.runelite.api.widgets.WidgetID.CLUE_SCROLL_REWARD_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.DIALOG_SPRITE_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.RAIDS_REWARD_GROUP_ID;
import net.runelite.api.widgets.WidgetInfo;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
import net.runelite.client.Notifier;
@@ -106,6 +107,8 @@ public class ScreenshotPlugin extends Plugin
private Integer barrowsNumber;
private Integer raidsNumber;
@Inject
private ScreenshotConfig config;
@@ -212,6 +215,16 @@ public class ScreenshotPlugin extends Plugin
return;
}
}
if (chatMessage.startsWith("Your completed Chambers of Xeric count is:"))
{
Matcher m = NUMBER_PATTERN.matcher(chatMessage.replaceAll("<[^>]*>", ""));
if (m.find())
{
raidsNumber = Integer.valueOf(m.group());
return;
}
}
}
@Subscribe
@@ -235,6 +248,7 @@ public class ScreenshotPlugin extends Plugin
case QUEST_COMPLETED_GROUP_ID:
case CLUE_SCROLL_REWARD_GROUP_ID:
case BARROWS_REWARD_GROUP_ID:
case RAIDS_REWARD_GROUP_ID:
if (!config.screenshotRewards())
{
return;
@@ -294,6 +308,17 @@ public class ScreenshotPlugin extends Plugin
barrowsNumber = null;
break;
}
case RAIDS_REWARD_GROUP_ID:
{
if (raidsNumber == null)
{
return;
}
fileName = "Raids(" + raidsNumber + ")";
raidsNumber = null;
break;
}
default:
return;
}
@@ -477,20 +502,26 @@ public class ScreenshotPlugin extends Plugin
}
@VisibleForTesting
public int getClueNumber()
int getClueNumber()
{
return clueNumber;
}
@VisibleForTesting
public String getClueType()
String getClueType()
{
return clueType;
}
@VisibleForTesting
public int getBarrowsNumber()
int getBarrowsNumber()
{
return barrowsNumber;
}
@VisibleForTesting
int getRaidsNumber()
{
return raidsNumber;
}
}

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 RAIDS_CHEST = "Your completed Chambers of Xeric count is: <col=ff0000>489.</col>";
@Mock
@Bind
@@ -121,6 +122,15 @@ public class ScreenshotPluginTest
assertEquals(310, screenshotPlugin.getBarrowsNumber());
}
@Test
public void testraidschest()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Seth", RAIDS_CHEST, null);
screenshotPlugin.onChatMessage(chatMessageEvent);
assertEquals(489, screenshotPlugin.getRaidsNumber());
}
@Test
public void testHitpoints()
{