Merge pull request #579 from sethtroll/addraidsreward
Add Raids reward to screenshot plugin
This commit is contained in:
@@ -73,6 +73,7 @@ public class WidgetID
|
|||||||
public static final int BLAST_FURNACE_GROUP_ID = 474;
|
public static final int BLAST_FURNACE_GROUP_ID = 474;
|
||||||
public static final int WORLD_MAP = 595;
|
public static final int WORLD_MAP = 595;
|
||||||
public static final int PYRAMID_PLUNDER_GROUP_ID = 428;
|
public static final int PYRAMID_PLUNDER_GROUP_ID = 428;
|
||||||
|
public static final int RAIDS_REWARD_GROUP_ID = 539;
|
||||||
|
|
||||||
static class WorldMap
|
static class WorldMap
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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.DIALOG_SPRITE_GROUP_ID;
|
||||||
import static net.runelite.api.widgets.WidgetID.LEVEL_UP_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.QUEST_COMPLETED_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.RAIDS_REWARD_GROUP_ID;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
@@ -106,6 +107,8 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
|
|
||||||
private Integer barrowsNumber;
|
private Integer barrowsNumber;
|
||||||
|
|
||||||
|
private Integer raidsNumber;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ScreenshotConfig config;
|
private ScreenshotConfig config;
|
||||||
|
|
||||||
@@ -190,32 +193,36 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getMessage().contains("Treasure"))
|
String chatMessage = event.getMessage();
|
||||||
{
|
|
||||||
String chatMessage = event.getMessage().replaceAll("<col=3300ff>", "");
|
|
||||||
|
|
||||||
if (chatMessage.startsWith("You have completed"))
|
if (chatMessage.contains("You have completed") && chatMessage.contains("Treasure"))
|
||||||
|
{
|
||||||
|
Matcher m = NUMBER_PATTERN.matcher(chatMessage.replaceAll("<[^>]*>", ""));
|
||||||
|
if (m.find())
|
||||||
{
|
{
|
||||||
Matcher m = NUMBER_PATTERN.matcher(chatMessage);
|
clueNumber = Integer.valueOf(m.group());
|
||||||
if (m.find())
|
clueType = chatMessage.substring(chatMessage.lastIndexOf(m.group()) + m.group().length() + 1, chatMessage.indexOf("Treasure") - 1);
|
||||||
{
|
return;
|
||||||
clueNumber = Integer.valueOf(m.group());
|
|
||||||
clueType = chatMessage.substring(chatMessage.lastIndexOf(m.group()) + m.group().length() + 1, chatMessage.indexOf("Treasure") - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getMessage().contains("Barrows"))
|
if (chatMessage.startsWith("Your Barrows chest count is"))
|
||||||
{
|
{
|
||||||
String chatMessage = event.getMessage().replaceAll("<col=ff0000>", "");
|
Matcher m = NUMBER_PATTERN.matcher(chatMessage.replaceAll("<[^>]*>", ""));
|
||||||
|
if (m.find())
|
||||||
if (chatMessage.startsWith("Your Barrows chest count is"))
|
|
||||||
{
|
{
|
||||||
Matcher m = NUMBER_PATTERN.matcher(chatMessage);
|
barrowsNumber = Integer.valueOf(m.group());
|
||||||
if (m.find())
|
return;
|
||||||
{
|
}
|
||||||
barrowsNumber = Integer.valueOf(m.group());
|
}
|
||||||
}
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,6 +248,7 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
case QUEST_COMPLETED_GROUP_ID:
|
case QUEST_COMPLETED_GROUP_ID:
|
||||||
case CLUE_SCROLL_REWARD_GROUP_ID:
|
case CLUE_SCROLL_REWARD_GROUP_ID:
|
||||||
case BARROWS_REWARD_GROUP_ID:
|
case BARROWS_REWARD_GROUP_ID:
|
||||||
|
case RAIDS_REWARD_GROUP_ID:
|
||||||
if (!config.screenshotRewards())
|
if (!config.screenshotRewards())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -300,6 +308,17 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
barrowsNumber = null;
|
barrowsNumber = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case RAIDS_REWARD_GROUP_ID:
|
||||||
|
{
|
||||||
|
if (raidsNumber == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName = "Raids(" + raidsNumber + ")";
|
||||||
|
raidsNumber = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -483,20 +502,26 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public int getClueNumber()
|
int getClueNumber()
|
||||||
{
|
{
|
||||||
return clueNumber;
|
return clueNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public String getClueType()
|
String getClueType()
|
||||||
{
|
{
|
||||||
return clueType;
|
return clueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public int getBarrowsNumber()
|
int getBarrowsNumber()
|
||||||
{
|
{
|
||||||
return barrowsNumber;
|
return barrowsNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
int getRaidsNumber()
|
||||||
|
{
|
||||||
|
return raidsNumber;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 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 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
|
@Mock
|
||||||
@Bind
|
@Bind
|
||||||
@@ -121,6 +122,15 @@ public class ScreenshotPluginTest
|
|||||||
assertEquals(310, screenshotPlugin.getBarrowsNumber());
|
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
|
@Test
|
||||||
public void testHitpoints()
|
public void testHitpoints()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user