loottracker: fix tracking first clue opens

This commit is contained in:
Adam
2020-02-13 10:47:47 -05:00
parent e737d73257
commit 99e885cb0a
2 changed files with 15 additions and 5 deletions

View File

@@ -112,7 +112,7 @@ import org.apache.commons.text.WordUtils;
public class LootTrackerPlugin extends Plugin
{
// Activity/Event loot handling
private static final Pattern CLUE_SCROLL_PATTERN = Pattern.compile("You have completed [0-9]+ ([a-z]+) Treasure Trails.");
private static final Pattern CLUE_SCROLL_PATTERN = Pattern.compile("You have completed [0-9]+ ([a-z]+) Treasure Trails?\\.");
private static final int THEATRE_OF_BLOOD_REGION = 12867;
// Herbiboar loot handling

View File

@@ -76,19 +76,29 @@ public class LootTrackerPluginTest
public void setUp()
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
Player player = mock(Player.class);
when(player.getWorldLocation()).thenReturn(new WorldPoint(0, 0, 0));
when(client.getLocalPlayer()).thenReturn(player);
}
@Test
public void testPickPocket()
{
Player player = mock(Player.class);
when(player.getWorldLocation()).thenReturn(new WorldPoint(0, 0, 0));
when(client.getLocalPlayer()).thenReturn(player);
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You pick the hero's pocket.", "", 0);
lootTrackerPlugin.onChatMessage(chatMessage);
assertEquals("Hero", lootTrackerPlugin.eventType);
assertEquals(LootRecordType.PICKPOCKET, lootTrackerPlugin.lootRecordType);
}
@Test
public void testFirstClue()
{
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", "You have completed 1 master Treasure Trail.", "", 0);
lootTrackerPlugin.onChatMessage(chatMessage);
assertEquals("Clue Scroll (Master)", lootTrackerPlugin.eventType);
assertEquals(LootRecordType.EVENT, lootTrackerPlugin.lootRecordType);
}
}