Stop slayer kills desync for Grotesque Guardians with Double Trouble reward active (#5983)

Correctly reduce task amount by 2 if killing Grotesque Guardians with the Double Trouble slayer reward enabled

Fixes #4336
This commit is contained in:
Dustin
2018-10-28 02:44:06 -05:00
committed by Tomas Slusny
parent cbab200ad5
commit db684d8d1b
5 changed files with 146 additions and 2 deletions

View File

@@ -49,6 +49,8 @@ import net.runelite.api.ItemID;
import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
import static net.runelite.api.Skill.SLAYER;
import net.runelite.api.SlayerUnlock;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.ExperienceChanged;
@@ -102,6 +104,8 @@ public class SlayerPlugin extends Plugin
//Reward UI
private static final Pattern REWARD_POINTS = Pattern.compile("Reward points: ((?:\\d+,)*\\d+)");
private static final int GROTESQUE_GUARDIANS_REGION = 6727;
private static final int EXPEDITIOUS_CHARGE = 30;
private static final int SLAUGHTER_CHARGE = 30;
@@ -490,6 +494,11 @@ public class SlayerPlugin extends Plugin
}
amount--;
if (doubleTroubleExtraKill())
{
amount--;
}
config.amount(amount); // save changed value
if (!config.showInfobox())
@@ -503,6 +512,12 @@ public class SlayerPlugin extends Plugin
infoTimer = Instant.now();
}
private boolean doubleTroubleExtraKill()
{
return WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()).getRegionID() == GROTESQUE_GUARDIANS_REGION &&
SlayerUnlock.GROTESQUE_GARDIAN_DOUBLE_COUNT.isEnabled(client);
}
private boolean isTarget(NPC npc)
{
if (targetNames.isEmpty())