Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2022-06-22 22:29:55 +02:00
4 changed files with 23 additions and 3 deletions

View File

@@ -43,6 +43,7 @@ public class RuntimeConfig
private Map<String, String> outageLinks; private Map<String, String> outageLinks;
private Set<Integer> ignoreDeadNpcs; private Set<Integer> ignoreDeadNpcs;
private Set<Integer> forceDeadNpcs;
public boolean showOutageMessage() public boolean showOutageMessage()
{ {

View File

@@ -71,6 +71,7 @@ public class LootManager
private final EventBus eventBus; private final EventBus eventBus;
private final Client client; private final Client client;
private final NpcUtil npcUtil;
private final ListMultimap<Integer, ItemStack> itemSpawns = ArrayListMultimap.create(); private final ListMultimap<Integer, ItemStack> itemSpawns = ArrayListMultimap.create();
private final Set<LocalPoint> killPoints = new HashSet<>(); private final Set<LocalPoint> killPoints = new HashSet<>();
private WorldPoint playerLocationLastTick; private WorldPoint playerLocationLastTick;
@@ -80,10 +81,11 @@ public class LootManager
private int delayedLootTickLimit; private int delayedLootTickLimit;
@Inject @Inject
private LootManager(EventBus eventBus, Client client) private LootManager(EventBus eventBus, Client client, NpcUtil npcUtil)
{ {
this.eventBus = eventBus; this.eventBus = eventBus;
this.client = client; this.client = client;
this.npcUtil = npcUtil;
eventBus.register(this); eventBus.register(this);
} }
@@ -98,7 +100,7 @@ public class LootManager
delayedLootTickLimit = 0; delayedLootTickLimit = 0;
} }
if (!npc.isDead()) if (!npcUtil.isDying(npc))
{ {
int id = npc.getId(); int id = npc.getId();
switch (id) switch (id)

View File

@@ -85,6 +85,7 @@ public class NpcUtil
case NpcID.ANCIENT_ZYGOMITE: case NpcID.ANCIENT_ZYGOMITE:
case NpcID.ROCKSLUG: case NpcID.ROCKSLUG:
case NpcID.ROCKSLUG_422: case NpcID.ROCKSLUG_422:
case NpcID.GIANT_ROCKSLUG:
case NpcID.DESERT_LIZARD: case NpcID.DESERT_LIZARD:
case NpcID.DESERT_LIZARD_460: case NpcID.DESERT_LIZARD_460:
case NpcID.DESERT_LIZARD_461: case NpcID.DESERT_LIZARD_461:
@@ -94,6 +95,12 @@ public class NpcUtil
case NpcID.GROWTHLING: case NpcID.GROWTHLING:
case NpcID.KALPHITE_QUEEN_963: // KQ's first form sometimes regenerates 1hp after reaching 0hp, thus not dying case NpcID.KALPHITE_QUEEN_963: // KQ's first form sometimes regenerates 1hp after reaching 0hp, thus not dying
return false; return false;
// These NPCs transform and have their `isDead()` reset to `false` despite actually being dead in these forms
case NpcID.DRAKE_8613:
case NpcID.GUARDIAN_DRAKE_10401:
case NpcID.ALCHEMICAL_HYDRA_8634:
case NpcID.NEX_11282:
return true;
default: default:
if (runtimeConfig != null) if (runtimeConfig != null)
{ {
@@ -102,6 +109,12 @@ public class NpcUtil
{ {
return false; return false;
} }
Set<Integer> forceDeadNpcs = runtimeConfig.getForceDeadNpcs();
if (forceDeadNpcs != null && forceDeadNpcs.contains(id))
{
return true;
}
} }
final NPCComposition npcComposition = npc.getTransformedComposition(); final NPCComposition npcComposition = npc.getTransformedComposition();

View File

@@ -31,6 +31,7 @@ import net.runelite.api.NPC;
import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcDespawned;
import net.runelite.client.eventbus.Subscribe; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.NpcUtil;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -49,6 +50,9 @@ public class BossTimersPlugin extends Plugin
@Inject @Inject
private ItemManager itemManager; private ItemManager itemManager;
@Inject
private NpcUtil npcUtil;
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
@@ -60,7 +64,7 @@ public class BossTimersPlugin extends Plugin
{ {
NPC npc = npcDespawned.getNpc(); NPC npc = npcDespawned.getNpc();
if (!npc.isDead()) if (!npcUtil.isDying(npc))
{ {
return; return;
} }