Correctly parse slayer task with the and breaks in npc name

This fixes e.g chaos elemental task assignment.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-10-10 17:26:21 +02:00
parent 6c739998c1
commit f6588ae3ba
4 changed files with 39 additions and 13 deletions

View File

@@ -60,6 +60,7 @@ public class SlayerPluginTest
private static final String TASK_CHECKSLAYERGEM = "You're assigned to kill Suqahs; only 211 more to go.";
private static final String TASK_BOSS_NEW = "Excellent. You're now assigned to kill Vet'ion 3 times.<br>Your reward point tally is 914.";
private static final String TASK_BOSS_NEW_THE = "Excellent. You're now assigned to kill the Chaos <br>Elemental 3 times. Your reward point tally is 914.";
private static final String TASK_EXISTING = "You're still hunting suqahs; you have 222 to go. Come<br>back when you've finished your task.";
@@ -167,6 +168,19 @@ public class SlayerPluginTest
assertEquals(914, slayerPlugin.getPoints());
}
@Test
public void testBossTaskThe()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW_THE);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Chaos Elemental", slayerPlugin.getTaskName());
assertEquals(3, slayerPlugin.getAmount());
assertEquals(914, slayerPlugin.getPoints());
}
@Test
public void testPartnerTask()
{