Merge branch 'iron' into 'master'

ironman drop fix: get drop if npcs delt damage.

See merge request 2009scape/2009scape!270
This commit is contained in:
Ceikry 2021-09-24 23:23:50 +00:00
commit b17908b275
2 changed files with 13 additions and 1 deletions

View file

@ -19,6 +19,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.stream.Collectors;
/**
* Class used for handling combat impacts.
@ -262,6 +263,15 @@ public final class ImpactHandler {
return impactLog;
}
/**
* Gets the impact log filtered for Player objects
* @return The impact log of each Player and their damage
*/
public Map<Player, Integer> getPlayerImpactLog() {
return impactLog.entrySet().stream().filter(entry -> entry.getKey() instanceof Player).collect(
Collectors.toMap(m -> m.getKey().asPlayer(), m -> m.getValue()));
}
/**
* Checks if the entity needs a hit update.
* @return {@code True} if so.

View file

@ -38,6 +38,8 @@ import rs09.game.system.config.ShopParser;
import rs09.game.world.GameWorld;
import rs09.game.world.repository.Repository;
import java.util.Map;
import static rs09.game.node.entity.player.info.stats.StatAttributeKeysKt.STATS_BASE;
import static rs09.game.node.entity.player.info.stats.StatAttributeKeysKt.STATS_ENEMIES_KILLED;
@ -543,7 +545,7 @@ public class NPC extends Entity {
if (getAttribute("disable:drop", false)) {
return;
}
if (killer instanceof Player && p != null && p.getIronmanManager().isIronman() && getImpactHandler().getImpactLog().size() > 1) {
if (killer instanceof Player && p != null && p.getIronmanManager().isIronman() && getImpactHandler().getPlayerImpactLog().size() > 1) {
return;
}
if (definition == null || definition.getDropTables() == null) {