Fixed incorrect Instance getAliveNpcs count.
This commit is contained in:
@@ -160,7 +160,7 @@ public final class ChamberOfProphecies extends AbstractInstance
|
|||||||
npc.setIsRunning(true);
|
npc.setIsRunning(true);
|
||||||
((L2Attackable) npc).setCanReturnToSpawnPoint(false);
|
((L2Attackable) npc).setCanReturnToSpawnPoint(false);
|
||||||
((L2Attackable) npc).setCanStopAttackByTime(false);
|
((L2Attackable) npc).setCanStopAttackByTime(false);
|
||||||
if (npc.isScriptValue(0) && ((world.getAliveNpcs(ATTACABLE_MONSTERS).size() < 2) || world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()))
|
if (npc.isScriptValue(0) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
|
||||||
{
|
{
|
||||||
npc.setTarget(player);
|
npc.setTarget(player);
|
||||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
|
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
|
||||||
|
@@ -438,7 +438,7 @@ public final class EvilIncubator extends AbstractInstance
|
|||||||
}
|
}
|
||||||
else if (waveId < 8)
|
else if (waveId < 8)
|
||||||
{
|
{
|
||||||
if (world.getAliveNpcs(MONSTERS).size() <= 1)
|
if (world.getAliveNpcs(MONSTERS).isEmpty())
|
||||||
{
|
{
|
||||||
getTimers().addTimer("SPAWN_WAVE", 5000, e -> manageWaveSpawn(world));
|
getTimers().addTimer("SPAWN_WAVE", 5000, e -> manageWaveSpawn(world));
|
||||||
}
|
}
|
||||||
|
@@ -365,7 +365,7 @@ public final class KartiasLabyrinth extends AbstractInstance
|
|||||||
instance.openCloseDoor(instance.getTemplateParameters().getInt("thirdDoorId"), true);
|
instance.openCloseDoor(instance.getTemplateParameters().getInt("thirdDoorId"), true);
|
||||||
instance.setStatus(3); // Used for notify helper's AI
|
instance.setStatus(3); // Used for notify helper's AI
|
||||||
}
|
}
|
||||||
else if (param.getBoolean("CONTINUE_AFTER_KILL", false) && (instance.getAliveNpcs(MONSTERS).size() <= 1))
|
else if (param.getBoolean("CONTINUE_AFTER_KILL", false) && instance.getAliveNpcs(MONSTERS).isEmpty())
|
||||||
{
|
{
|
||||||
param.set("CONTINUE_AFTER_KILL", false);
|
param.set("CONTINUE_AFTER_KILL", false);
|
||||||
getTimers().addTimer("CALL_PROGRESS", 5000, n -> manageProgressInInstance(instance));
|
getTimers().addTimer("CALL_PROGRESS", 5000, n -> manageProgressInInstance(instance));
|
||||||
|
@@ -235,7 +235,7 @@ public final class MuseumDungeon extends AbstractInstance
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = world.getFirstPlayer();
|
final L2PcInstance player = world.getFirstPlayer();
|
||||||
final QuestState qs = player.getQuestState(Q10327_IntruderWhoWantsTheBookOfGiants.class.getSimpleName());
|
final QuestState qs = player.getQuestState(Q10327_IntruderWhoWantsTheBookOfGiants.class.getSimpleName());
|
||||||
if ((qs != null) && qs.isCond(2) && (world.getAliveNpcs(THIEF).size() <= 1))
|
if ((qs != null) && qs.isCond(2) && world.getAliveNpcs(THIEF).isEmpty())
|
||||||
{
|
{
|
||||||
qs.setCond(3, true);
|
qs.setCond(3, true);
|
||||||
showOnScreenMsg(player, NpcStringId.TALK_TO_TOYRON_TO_RETURN_TO_THE_MUSEUM_LOBBY, ExShowScreenMessage.TOP_CENTER, 4500);
|
showOnScreenMsg(player, NpcStringId.TALK_TO_TOYRON_TO_RETURN_TO_THE_MUSEUM_LOBBY, ExShowScreenMessage.TOP_CENTER, 4500);
|
||||||
|
@@ -549,7 +549,7 @@ public final class Instance implements IIdentifiable, INamable
|
|||||||
*/
|
*/
|
||||||
public Set<L2Npc> getAliveNpcs()
|
public Set<L2Npc> getAliveNpcs()
|
||||||
{
|
{
|
||||||
return _npcs.stream().filter(n -> !n.isDead()).collect(Collectors.toSet());
|
return _npcs.stream().filter(n -> n.getCurrentHp() > 0).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -585,7 +585,7 @@ public final class Instance implements IIdentifiable, INamable
|
|||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public final <T extends L2Character> List<T> getAliveNpcs(Class<T> clazz, int... ids)
|
public final <T extends L2Character> List<T> getAliveNpcs(Class<T> clazz, int... ids)
|
||||||
{
|
{
|
||||||
return _npcs.stream().filter(n -> ((ids.length == 0) || CommonUtil.contains(ids, n.getId())) && !n.isDead()).filter(clazz::isInstance).map(clazz::cast).collect(Collectors.toList());
|
return _npcs.stream().filter(n -> ((ids.length == 0) || CommonUtil.contains(ids, n.getId())) && (n.getCurrentHp() > 0)).filter(clazz::isInstance).map(clazz::cast).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -595,7 +595,7 @@ public final class Instance implements IIdentifiable, INamable
|
|||||||
*/
|
*/
|
||||||
public List<L2Npc> getAliveNpcs(int... id)
|
public List<L2Npc> getAliveNpcs(int... id)
|
||||||
{
|
{
|
||||||
return _npcs.stream().filter(n -> !n.isDead() && CommonUtil.contains(id, n.getId())).collect(Collectors.toList());
|
return _npcs.stream().filter(n -> (n.getCurrentHp() > 0) && CommonUtil.contains(id, n.getId())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user