slayerplugin: Correct Jad and Zuk task tracking

This adds a field to Task which dictates the expected exp gain of the
task. When set to a non-zero value, it will prevent slayer exp gains
from registering as a kill unless they are of exactly that amount.

Closes runelite/runelite#1865
This commit is contained in:
Jordan Atwood
2019-07-12 23:27:18 -07:00
parent 5844c7c5de
commit 50dba92338
3 changed files with 85 additions and 3 deletions

View File

@@ -535,7 +535,15 @@ public class SlayerPlugin extends Plugin
return;
}
killedOne();
final int taskKillExp = Task.getTask(taskName).getExpectedKillExp();
// Only count exp gain as a kill if the task either has no expected exp for a kill, or if the exp gain is equal
// to the expected exp gain for the task.
if (taskKillExp == 0 || taskKillExp == slayerExp - cachedXp)
{
killedOne();
}
cachedXp = slayerExp;
}

View File

@@ -107,7 +107,7 @@ enum Task
ICEFIENDS("Icefiends", ItemID.ICE_DIAMOND),
INFERNAL_MAGES("Infernal mages", ItemID.INFERNAL_MAGE, "Malevolent mage"),
IRON_DRAGONS("Iron dragons", ItemID.IRON_DRAGON_MASK),
JAD("TzTok-Jad", ItemID.TZREKJAD),
JAD("TzTok-Jad", ItemID.TZREKJAD, 25250),
JELLIES("Jellies", ItemID.JELLY, "Jelly"),
JUNGLE_HORROR("Jungle horrors", ItemID.ENSOULED_HORROR_HEAD),
KALPHITE("Kalphite", ItemID.KALPHITE_SOLDIER),
@@ -171,7 +171,7 @@ enum Task
ZILYANA("Commander Zilyana", ItemID.PET_ZILYANA),
ZOMBIES("Zombies", ItemID.ZOMBIE_HEAD, "Undead"),
ZULRAH("Zulrah", ItemID.PET_SNAKELING),
ZUK("TzKal-Zuk", ItemID.TZREKZUK);
ZUK("TzKal-Zuk", ItemID.TZREKZUK, 101890);
//</editor-fold>
private static final Map<String, Task> tasks;
@@ -181,6 +181,7 @@ enum Task
private final String[] targetNames;
private final int weaknessThreshold;
private final int weaknessItem;
private final int expectedKillExp;
static
{
@@ -202,6 +203,7 @@ enum Task
this.weaknessThreshold = -1;
this.weaknessItem = -1;
this.targetNames = targetNames;
this.expectedKillExp = 0;
}
Task(String name, int itemSpriteId, int weaknessThreshold, int weaknessItem, String... targetNames)
@@ -212,6 +214,18 @@ enum Task
this.weaknessThreshold = weaknessThreshold;
this.weaknessItem = weaknessItem;
this.targetNames = targetNames;
this.expectedKillExp = 0;
}
Task(String name, int itemSpriteId, int expectedKillExp)
{
Preconditions.checkArgument(itemSpriteId >= 0);
this.name = name;
this.itemSpriteId = itemSpriteId;
this.weaknessThreshold = -1;
this.weaknessItem = -1;
this.targetNames = new String[0];
this.expectedKillExp = expectedKillExp;
}
static Task getTask(String taskName)