Add support for partner assignment to slayer plugin (#5782)

This commit is contained in:
Nathen Sample
2018-10-04 14:12:32 +01:00
committed by Tomas Slusny
parent d155880d56
commit fd50e773be
2 changed files with 12 additions and 1 deletions

View File

@@ -78,7 +78,7 @@ import net.runelite.client.util.Text;
public class SlayerPlugin extends Plugin
{
//Chat messages
private static final Pattern CHAT_GEM_PROGRESS_MESSAGE = Pattern.compile("You're assigned to kill (.*?)(?: in the Wilderness)?; only (\\d*) more to go\\.");
private static final Pattern CHAT_GEM_PROGRESS_MESSAGE = Pattern.compile("^(?:You're assigned to kill|You have received a new Slayer assignment from .*:) (.*?)(?: in the Wilderness)?(?:; only | \\()(\\d*)(?: more to go\\.|\\))$");
private static final String CHAT_GEM_COMPLETE_MESSAGE = "You need something new to hunt.";
private static final Pattern CHAT_COMPLETE_MESSAGE = Pattern.compile("(?:\\d+,)*\\d+");
private static final String CHAT_CANCEL_MESSAGE = "Your task has been cancelled.";

View File

@@ -55,6 +55,7 @@ public class SlayerPluginTest
{
private static final String TASK_NEW = "Your new task is to kill 231 Suqahs.";
private static final String TASK_NEW_NPC_CONTACT = "Excellent, you're doing great. Your new task is to kill<br>211 Suqahs.";
private static final String TASK_NEW_FROM_PARTNER = "You have received a new Slayer assignment from breaklulz: Dust Devils (377)";
private static final String TASK_CHECKSLAYERGEM_WILDERNESS = "You're assigned to kill Suqahs in the Wilderness; only 211 more to go.";
private static final String TASK_CHECKSLAYERGEM = "You're assigned to kill Suqahs; only 211 more to go.";
@@ -166,6 +167,16 @@ public class SlayerPluginTest
assertEquals(914, slayerPlugin.getPoints());
}
@Test
public void testPartnerTask()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", TASK_NEW_FROM_PARTNER, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("Dust Devils", slayerPlugin.getTaskName());
assertEquals(377, slayerPlugin.getAmount());
}
@Test
public void testCheckSlayerGem()
{