Merge pull request #11972 from Nightfirecat/slayer-plugin-use-higher-of-task-lengths-for-start

slayer: Update initial amount if current amount is higher
This commit is contained in:
Jordan
2020-07-09 12:46:18 -07:00
committed by GitHub
2 changed files with 12 additions and 1 deletions

View File

@@ -730,7 +730,7 @@ public class SlayerPlugin extends Plugin
{
taskName = name;
amount = amt;
initialAmount = initAmt;
initialAmount = Math.max(amt, initAmt);
taskLocation = location;
save();
removeCounter();

View File

@@ -781,6 +781,17 @@ public class SlayerPluginTest
assertEquals(30, slayerPlugin.getAmount());
}
@Test
public void updateInitialAmount()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_EXISTING);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals(222, slayerPlugin.getInitialAmount());
}
@Test
public void testTaskLookup() throws IOException
{