Distinguish getVisibleObjectsInRange from getVisibleObjects.
This commit is contained in:
parent
49e03289d7
commit
1615c77aee
@ -80,7 +80,7 @@ public final class LindviorScene extends AbstractNpcAI
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
playMovie(L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 4000), Movie.SC_LINDVIOR);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 4000), Movie.SC_LINDVIOR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public final class TrainningSoldier extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150))
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 150))
|
||||
{
|
||||
if ((nearby != null) && (nearby.getId() == DUMMY))
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 1000);
|
||||
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 1000);
|
||||
if (!nearbyMonsters.isEmpty())
|
||||
{
|
||||
final L2MonsterInstance monster = nearbyMonsters.get(getRandom(nearbyMonsters.size()));
|
||||
|
@ -92,7 +92,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
npc.broadcastSocialAction(4);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, GUARD_SHOUT[getRandom(2)], 1000);
|
||||
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 500).stream().filter(n -> n.getId() == GUARD).forEach(guard ->
|
||||
L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 500).stream().filter(n -> n.getId() == GUARD).forEach(guard ->
|
||||
{
|
||||
startQuestTimer("SOCIAL_ACTION", getRandom(2500, 3500), guard, null);
|
||||
});
|
||||
@ -136,7 +136,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
if (attackId > 0)
|
||||
{
|
||||
//@formatter:off
|
||||
final L2MonsterInstance monster = L2World.getInstance().getVisibleObjects(guard, L2MonsterInstance.class, 1000)
|
||||
final L2MonsterInstance monster = L2World.getInstance().getVisibleObjectsInRange(guard, L2MonsterInstance.class, 1000)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == attackId))
|
||||
.findFirst()
|
||||
@ -162,7 +162,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
if (guard.getId() == SCHUAZEN)
|
||||
{
|
||||
//@formatter:off
|
||||
final FriendlyNpcInstance decoGuard = L2World.getInstance().getVisibleObjects(guard, FriendlyNpcInstance.class, 500)
|
||||
final FriendlyNpcInstance decoGuard = L2World.getInstance().getVisibleObjectsInRange(guard, FriendlyNpcInstance.class, 500)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == DECO_GUARD2))
|
||||
.findFirst()
|
||||
@ -212,7 +212,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
{
|
||||
final int guardId = npc.getId() == REGENERATED_KANILOV ? JOEL : SCHUAZEN;
|
||||
//@formatter:off
|
||||
final FriendlyNpcInstance guard = L2World.getInstance().getVisibleObjects(npc, FriendlyNpcInstance.class, 500)
|
||||
final FriendlyNpcInstance guard = L2World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 500)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == guardId))
|
||||
.findFirst()
|
||||
@ -280,7 +280,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
final L2Attackable guard = (L2Attackable) event.getTarget();
|
||||
|
||||
//@formatter:off
|
||||
final L2Attackable sakum = L2World.getInstance().getVisibleObjects(guard, L2Attackable.class, 1000)
|
||||
final L2Attackable sakum = L2World.getInstance().getVisibleObjectsInRange(guard, L2Attackable.class, 1000)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == SAKUM))
|
||||
.findFirst()
|
||||
|
@ -314,7 +314,7 @@ public final class Antharas extends AbstractNpcAI
|
||||
}
|
||||
case "START_MOVE":
|
||||
{
|
||||
for (L2PcInstance players : L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 4000))
|
||||
for (L2PcInstance players : L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 4000))
|
||||
{
|
||||
if (players.isHero())
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ public final class Baium extends AbstractNpcAI
|
||||
}
|
||||
else
|
||||
{
|
||||
for (L2Character creature : L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 2000))
|
||||
for (L2Character creature : L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 2000))
|
||||
{
|
||||
if (zone.isInsideZone(creature) && !creature.isDead())
|
||||
{
|
||||
@ -336,7 +336,7 @@ public final class Baium extends AbstractNpcAI
|
||||
else
|
||||
{
|
||||
boolean found = false;
|
||||
for (L2Playable creature : L2World.getInstance().getVisibleObjects(mob, L2Playable.class, 1000))
|
||||
for (L2Playable creature : L2World.getInstance().getVisibleObjectsInRange(mob, L2Playable.class, 1000))
|
||||
{
|
||||
if (zone.isInsideZone(creature) && !creature.isDead())
|
||||
{
|
||||
|
@ -609,7 +609,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isDead() && !npc.isCastingNow())
|
||||
{
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(FIREBALL.getSkill());
|
||||
@ -640,13 +640,13 @@ public final class Beleth extends AbstractNpcAI
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.doCast(LIGHTENING.getSkill());
|
||||
return null;
|
||||
}
|
||||
//@formatter:off
|
||||
final L2PcInstance plr = L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 950)
|
||||
final L2PcInstance plr = L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 950)
|
||||
.stream()
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@ -666,7 +666,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
npc.setRunning();
|
||||
if ((getRandom(100) < 60) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 300).isEmpty())
|
||||
if ((getRandom(100) < 60) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 300).isEmpty())
|
||||
{
|
||||
npc.doCast(BLEED.getSkill());
|
||||
}
|
||||
@ -731,7 +731,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
}
|
||||
else if (!npc.isDead() && !npc.isCastingNow())
|
||||
{
|
||||
if (!L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if (!L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.doCast(LIGHTENING.getSkill());
|
||||
return null;
|
||||
|
@ -1227,7 +1227,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
|
||||
private void manageMovie(Instance world, Movie movie)
|
||||
{
|
||||
final L2Npc controller = world.getParameters().getObject("controller", L2Npc.class);
|
||||
playMovie(L2World.getInstance().getVisibleObjects(controller, L2PcInstance.class, 8000), movie);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(controller, L2PcInstance.class, 8000), movie);
|
||||
}
|
||||
|
||||
private List<L2Npc> getKnightStatues(Instance world)
|
||||
|
@ -312,7 +312,7 @@ public final class OctavisWarzone extends AbstractInstance
|
||||
final L2PcInstance mostHated = ((L2Attackable) npc).getMostHated().getActingPlayer();
|
||||
if ((mostHated != null) && (mostHated.calculateDistance3D(npc) < 5000))
|
||||
{
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion ->
|
||||
L2World.getInstance().getVisibleObjectsInRange(npc, L2Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion ->
|
||||
{
|
||||
addAttackPlayerDesire(minion, mostHated, 23);
|
||||
});
|
||||
|
@ -495,7 +495,7 @@ public final class Stage1 extends AbstractInstance implements IGameXmlReader
|
||||
final L2Npc videoNpc = world.getNpc(TIAT_VIDEO_NPC);
|
||||
if (videoNpc != null)
|
||||
{
|
||||
playMovie(L2World.getInstance().getVisibleObjects(videoNpc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_OPENING);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(videoNpc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_OPENING);
|
||||
videoNpc.deleteMe();
|
||||
}
|
||||
}
|
||||
@ -639,7 +639,7 @@ public final class Stage1 extends AbstractInstance implements IGameXmlReader
|
||||
if (npc.getId() == TIAT)
|
||||
{
|
||||
world.incStatus();
|
||||
playMovie(L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_ENDING_SUCCES);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_ENDING_SUCCES);
|
||||
world.removeNpcs();
|
||||
world.finishInstance();
|
||||
GraciaSeedsManager.getInstance().increaseSoDTiatKilled();
|
||||
|
@ -516,7 +516,7 @@ public final class Valakas extends AbstractNpcAI
|
||||
}
|
||||
|
||||
// Valakas will use mass spells if he feels surrounded.
|
||||
if (L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 1200).size() >= 20)
|
||||
if (L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 1200).size() >= 20)
|
||||
{
|
||||
return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)];
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class SiegeGuards extends AbstractNpcAI
|
||||
final L2Object target = npc.getTarget();
|
||||
if (!npc.isInCombat() || (target == null) || (npc.calculateDistance2D(target) > npc.getAggroRange()) || target.isInvul())
|
||||
{
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange()))
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange()))
|
||||
{
|
||||
if (nearby.isPlayable() && GeoEngine.getInstance().canSeeTarget(npc, nearby))
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ public class RecieveAdventurerBuffs extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isMoving())
|
||||
{
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 100))
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 100))
|
||||
{
|
||||
if (CommonUtil.contains(ADVENTURERS_GUIDE, nearby.getId()))
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ public final class AdminPcCafePoints implements IAdminCommandHandler
|
||||
}
|
||||
else if (range > 0)
|
||||
{
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjects(activeChar, L2PcInstance.class, range), value);
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2PcInstance.class, range), value);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
|
||||
}
|
||||
break;
|
||||
|
@ -129,7 +129,7 @@ public final class AdminPrimePoints implements IAdminCommandHandler
|
||||
}
|
||||
else if (range > 0)
|
||||
{
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjects(activeChar, L2PcInstance.class, range), value);
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2PcInstance.class, range), value);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased Prime Point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
|
||||
}
|
||||
break;
|
||||
|
@ -175,7 +175,7 @@ public class AdminScan implements IAdminCommandHandler
|
||||
html.setFile(activeChar, "data/html/admin/scan.htm");
|
||||
|
||||
//@formatter:off
|
||||
final PageResult result = PageBuilder.newBuilder(L2World.getInstance().getVisibleObjects(activeChar, L2Npc.class, radius, condition), 15, bypassParser.toString())
|
||||
final PageResult result = PageBuilder.newBuilder(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2Npc.class, radius, condition), 15, bypassParser.toString())
|
||||
.currentPage(page)
|
||||
.pageHandler(NextPrevPageHandler.INSTANCE)
|
||||
.formatter(BypassParserFormatter.INSTANCE)
|
||||
|
@ -96,7 +96,7 @@ public final class AirBind extends AbstractEffect
|
||||
@Override
|
||||
public void continuousInstant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
|
||||
{
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjects(effected, L2PcInstance.class, 1200))
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjectsInRange(effected, L2PcInstance.class, 1200))
|
||||
{
|
||||
if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) //
|
||||
&& nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive())
|
||||
|
@ -166,7 +166,7 @@ public final class KnockBack extends AbstractEffect
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjects(effected, L2PcInstance.class, 1200))
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjectsInRange(effected, L2PcInstance.class, 1200))
|
||||
{
|
||||
if (nearbyPlayer.getRace() == Race.ERTHEIA)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ public class OpExistNpcSkillCondition implements ISkillCondition
|
||||
@Override
|
||||
public boolean canUse(L2Character caster, Skill skill, L2Object target)
|
||||
{
|
||||
final List<L2Npc> npcs = L2World.getInstance().getVisibleObjects(caster, L2Npc.class, _range);
|
||||
final List<L2Npc> npcs = L2World.getInstance().getVisibleObjectsInRange(caster, L2Npc.class, _range);
|
||||
return _isAround == npcs.stream().anyMatch(npc -> _npcIds.contains(npc.getId()));
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class RangeSortByHp implements IAffectScopeHandler
|
||||
return true;
|
||||
};
|
||||
|
||||
final List<L2Character> result = L2World.getInstance().getVisibleObjects(target, L2Character.class, affectRange, filter);
|
||||
final List<L2Character> result = L2World.getInstance().getVisibleObjectsInRange(target, L2Character.class, affectRange, filter);
|
||||
|
||||
// Add object of origin since its skipped in the getVisibleObjects method.
|
||||
if (target.isCharacter() && filter.test((L2Character) target))
|
||||
|
@ -239,7 +239,7 @@ public final class EvilIncubator extends AbstractInstance
|
||||
if (helperCount == 2)
|
||||
{
|
||||
st.setCond(7, true);
|
||||
L2World.getInstance().getVisibleObjects(world.getNpc(ADOLPH), FriendlyNpcInstance.class, 1000).forEach(c -> c.deleteMe());
|
||||
L2World.getInstance().getVisibleObjectsInRange(world.getNpc(ADOLPH), FriendlyNpcInstance.class, 1000).forEach(c -> c.deleteMe());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -122,7 +122,7 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
|
||||
}
|
||||
else if (!npc.isInCombat() || (npc.getTarget() == null))
|
||||
{
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 500);
|
||||
if (!monsterList.isEmpty())
|
||||
{
|
||||
final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
|
||||
@ -183,7 +183,7 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
|
||||
npc.doCast(skill_01.getSkill(), null, true, false);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 300);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 300);
|
||||
if (!monsterList.isEmpty())
|
||||
{
|
||||
for (L2MonsterInstance monster : monsterList)
|
||||
|
@ -101,7 +101,7 @@ public final class Q10742_AFurryFriend extends Quest
|
||||
showOnScreenMsg(player, NpcStringId.RICKY_IS_NOT_HERE_NTRY_SEARCHING_ANOTHER_KIKU_S_CAVE, ExShowScreenMessage.TOP_CENTER, 8000);
|
||||
htmltext = "33995-02.html";
|
||||
}
|
||||
else if (!L2World.getInstance().getVisibleObjects(player, L2Npc.class, 500).stream().anyMatch(n -> (n.getId() == RICKY) && (n.getSummoner() == player)))
|
||||
else if (!L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 500).stream().anyMatch(n -> (n.getId() == RICKY) && (n.getSummoner() == player)))
|
||||
{
|
||||
showOnScreenMsg(player, NpcStringId.TAKE_RICKY_TO_LEIRA_IN_UNDER_2_MINUTES, ExShowScreenMessage.MIDDLE_CENTER, 5000);
|
||||
player.sendPacket(new ExSendUIEvent(player, false, false, 120, 0, NpcStringId.REMAINING_TIME));
|
||||
@ -149,7 +149,7 @@ public final class Q10742_AFurryFriend extends Quest
|
||||
}
|
||||
else
|
||||
{
|
||||
final L2Npc leira = L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 300).stream().filter(n -> (n.getId() == LEIRA)).findAny().orElse(null);
|
||||
final L2Npc leira = L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 300).stream().filter(n -> (n.getId() == LEIRA)).findAny().orElse(null);
|
||||
if (leira != null)
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
|
@ -418,7 +418,7 @@ public final class Q10751_WindsOfFateEncounters extends Quest
|
||||
qs.set(KILL_COUNT_VAR, ++killCount);
|
||||
}
|
||||
|
||||
if ((killCount >= 5) && !L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 1000).stream().anyMatch(n -> ((n.getId() == TELESHA) && (n.getSummoner() == killer))))
|
||||
if ((killCount >= 5) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 1000).stream().anyMatch(n -> ((n.getId() == TELESHA) && (n.getSummoner() == killer))))
|
||||
{
|
||||
final L2Npc telsha = addSpawn(TELESHA, npc, false, 30000);
|
||||
telsha.setSummoner(killer);
|
||||
|
@ -87,7 +87,7 @@ public final class Q10772_ReportsFromCrumaTowerPart1 extends Quest
|
||||
}
|
||||
case "spawn_owl":
|
||||
{
|
||||
if (qs.isCond(1) && !L2World.getInstance().getVisibleObjects(player, L2Npc.class, 700).stream().anyMatch(n -> n.getId() == MAGIC_OWL))
|
||||
if (qs.isCond(1) && !L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 700).stream().anyMatch(n -> n.getId() == MAGIC_OWL))
|
||||
{
|
||||
addSpawn(MAGIC_OWL, OWL_LOC, true, 20000);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public final class Q10777_ReportsFromCrumaTowerPart2 extends Quest
|
||||
}
|
||||
case "summon":
|
||||
{
|
||||
if (qs.isCond(1) && !L2World.getInstance().getVisibleObjects(player, L2Npc.class, 700).stream().anyMatch(n -> n.getId() == MAGIC_OWL))
|
||||
if (qs.isCond(1) && !L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 700).stream().anyMatch(n -> n.getId() == MAGIC_OWL))
|
||||
{
|
||||
final L2Npc owl = addSpawn(MAGIC_OWL, OWL_LOC);
|
||||
getTimers().addTimer("DESPAWN_OWL", 20000, owl, null);
|
||||
|
@ -91,7 +91,7 @@ public final class Q10787_ASpyMission extends Quest
|
||||
htmltext = "33994-03.html";
|
||||
}
|
||||
// @formatter:off
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150).stream()
|
||||
L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 150).stream()
|
||||
.filter(n -> (n.getId() == EMBRYO_PURIFIER))
|
||||
.forEach(mob -> addAttackPlayerDesire(mob, player));
|
||||
// @formatter:on
|
||||
|
@ -148,7 +148,7 @@ public final class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
private final L2Npc findController()
|
||||
{
|
||||
// check objects around the ship
|
||||
for (L2Npc obj : L2World.getInstance().getVisibleObjects(_ship, L2Npc.class, 600))
|
||||
for (L2Npc obj : L2World.getInstance().getVisibleObjectsInRange(_ship, L2Npc.class, 600))
|
||||
{
|
||||
for (int id : CONTROLLERS)
|
||||
{
|
||||
|
@ -358,7 +358,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
{
|
||||
L2Character nearestTarget = null;
|
||||
double closestDistance = Double.MAX_VALUE;
|
||||
for (L2Character t : L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange()))
|
||||
for (L2Character t : L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange()))
|
||||
{
|
||||
if ((t == _actor) || (t == null) || t.isDead())
|
||||
{
|
||||
@ -1118,7 +1118,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
}
|
||||
else
|
||||
{
|
||||
stream = L2World.getInstance().getVisibleObjects(npc, L2Character.class, range, c -> checkSkillTarget(skill, c)).stream();
|
||||
stream = L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, range, c -> checkSkillTarget(skill, c)).stream();
|
||||
|
||||
// Maybe add self to the list of targets since getVisibleObjects doesn't return yourself.
|
||||
if (checkSkillTarget(skill, npc))
|
||||
@ -1149,7 +1149,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
// If npc is aggressive, add characters within aggro range too
|
||||
if (npc.isAggressive())
|
||||
{
|
||||
stream = Stream.concat(stream, L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange(), this::checkTarget).stream());
|
||||
stream = Stream.concat(stream, L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange(), this::checkTarget).stream());
|
||||
}
|
||||
|
||||
return stream.findAny().orElse(null);
|
||||
@ -1161,7 +1161,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
.sorted(Comparator.comparingInt(AggroInfo::getHate))
|
||||
.map(AggroInfo::getAttacker)
|
||||
.findFirst()
|
||||
.orElse(npc.isAggressive() ? L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange(), this::checkTarget).stream().findAny().orElse(null) : null);
|
||||
.orElse(npc.isAggressive() ? L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange(), this::checkTarget).stream().findAny().orElse(null) : null);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
|
@ -648,14 +648,14 @@ public final class L2World
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends L2Object> List<T> getVisibleObjects(L2Object object, Class<T> clazz, int range)
|
||||
public <T extends L2Object> List<T> getVisibleObjectsInRange(L2Object object, Class<T> clazz, int range)
|
||||
{
|
||||
final List<T> result = new ArrayList<>();
|
||||
forEachVisibleObjectInRange(object, clazz, range, result::add);
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T extends L2Object> List<T> getVisibleObjects(L2Object object, Class<T> clazz, int range, Predicate<T> predicate)
|
||||
public <T extends L2Object> List<T> getVisibleObjectsInRange(L2Object object, Class<T> clazz, int range, Predicate<T> predicate)
|
||||
{
|
||||
final List<T> result = new ArrayList<>();
|
||||
forEachVisibleObjectInRange(object, clazz, range, o ->
|
||||
|
@ -1173,7 +1173,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
final double headingAngle = Util.convertHeadingToDegree(getHeading());
|
||||
final int maxRadius = _stat.getPhysicalAttackRadius();
|
||||
final int physicalAttackAngle = _stat.getPhysicalAttackAngle();
|
||||
for (L2Character obj : L2World.getInstance().getVisibleObjects(this, L2Character.class, maxRadius))
|
||||
for (L2Character obj : L2World.getInstance().getVisibleObjectsInRange(this, L2Character.class, maxRadius))
|
||||
{
|
||||
// Skip main target.
|
||||
if (obj == target)
|
||||
|
@ -173,7 +173,7 @@ public class L2DefenderInstance extends L2Attackable
|
||||
{
|
||||
L2Character target = this;
|
||||
double lowestHpValue = Double.MAX_VALUE;
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjects(this, L2Character.class, skill.getCastRange()))
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjectsInRange(this, L2Character.class, skill.getCastRange()))
|
||||
{
|
||||
if ((nearby == null) || nearby.isDead() || !GeoEngine.getInstance().canSeeTarget(this, nearby))
|
||||
{
|
||||
|
@ -4573,7 +4573,7 @@ public final class L2PcInstance extends L2Playable
|
||||
{
|
||||
if ((Config.SHOP_MIN_RANGE_FROM_NPC > 0) || (Config.SHOP_MIN_RANGE_FROM_PLAYER > 0))
|
||||
{
|
||||
for (L2Character cha : L2World.getInstance().getVisibleObjects(this, L2Character.class, 1000))
|
||||
for (L2Character cha : L2World.getInstance().getVisibleObjectsInRange(this, L2Character.class, 1000))
|
||||
{
|
||||
if (Util.checkIfInRange(cha.getMinShopDistance(), this, cha, true))
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public class ConditionPlayerRangeFromNpc extends Condition
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
{
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjects(effector, L2Npc.class, _radius))
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjectsInRange(effector, L2Npc.class, _radius))
|
||||
{
|
||||
if (CommonUtil.contains(_npcIds, target.getId()))
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
{
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjects(effector, L2Npc.class, _radius))
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjectsInRange(effector, L2Npc.class, _radius))
|
||||
{
|
||||
if (CommonUtil.contains(_npcIds, target.getId()) && (effector == target.getSummoner()))
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ public class CubicInstance
|
||||
Stream<L2Character> stream;
|
||||
if (party != null)
|
||||
{
|
||||
stream = L2World.getInstance().getVisibleObjects(_owner, L2Character.class, Config.ALT_PARTY_RANGE, c -> (c.getParty() == party) && _template.validateConditions(this, _owner, c) && cubicSkill.validateConditions(this, _owner, c)).stream();
|
||||
stream = L2World.getInstance().getVisibleObjectsInRange(_owner, L2Character.class, Config.ALT_PARTY_RANGE, c -> (c.getParty() == party) && _template.validateConditions(this, _owner, c) && cubicSkill.validateConditions(this, _owner, c)).stream();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ public final class RequestDuelStart implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
boolean npcInRange = false;
|
||||
for (L2Npc npc : L2World.getInstance().getVisibleObjects(activeChar, L2Npc.class, 250))
|
||||
for (L2Npc npc : L2World.getInstance().getVisibleObjectsInRange(activeChar, L2Npc.class, 250))
|
||||
{
|
||||
if (npc.getName().equals(name))
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ public final class TradeRequest implements IClientIncomingPacket
|
||||
{
|
||||
final String name = FakePlayerData.getInstance().getProperName(target.getName());
|
||||
boolean npcInRange = false;
|
||||
for (L2Npc npc : L2World.getInstance().getVisibleObjects(player, L2Npc.class, 150))
|
||||
for (L2Npc npc : L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 150))
|
||||
{
|
||||
if (npc.getName().equals(name))
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ public final class LindviorScene extends AbstractNpcAI
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
playMovie(L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 4000), Movie.SC_LINDVIOR);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 4000), Movie.SC_LINDVIOR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public final class TrainningSoldier extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150))
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 150))
|
||||
{
|
||||
if ((nearby != null) && (nearby.getId() == DUMMY))
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 1000);
|
||||
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 1000);
|
||||
if (!nearbyMonsters.isEmpty())
|
||||
{
|
||||
final L2MonsterInstance monster = nearbyMonsters.get(getRandom(nearbyMonsters.size()));
|
||||
|
@ -92,7 +92,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
npc.broadcastSocialAction(4);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, GUARD_SHOUT[getRandom(2)], 1000);
|
||||
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 500).stream().filter(n -> n.getId() == GUARD).forEach(guard ->
|
||||
L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 500).stream().filter(n -> n.getId() == GUARD).forEach(guard ->
|
||||
{
|
||||
startQuestTimer("SOCIAL_ACTION", getRandom(2500, 3500), guard, null);
|
||||
});
|
||||
@ -136,7 +136,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
if (attackId > 0)
|
||||
{
|
||||
//@formatter:off
|
||||
final L2MonsterInstance monster = L2World.getInstance().getVisibleObjects(guard, L2MonsterInstance.class, 1000)
|
||||
final L2MonsterInstance monster = L2World.getInstance().getVisibleObjectsInRange(guard, L2MonsterInstance.class, 1000)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == attackId))
|
||||
.findFirst()
|
||||
@ -162,7 +162,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
if (guard.getId() == SCHUAZEN)
|
||||
{
|
||||
//@formatter:off
|
||||
final FriendlyNpcInstance decoGuard = L2World.getInstance().getVisibleObjects(guard, FriendlyNpcInstance.class, 500)
|
||||
final FriendlyNpcInstance decoGuard = L2World.getInstance().getVisibleObjectsInRange(guard, FriendlyNpcInstance.class, 500)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == DECO_GUARD2))
|
||||
.findFirst()
|
||||
@ -212,7 +212,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
{
|
||||
final int guardId = npc.getId() == REGENERATED_KANILOV ? JOEL : SCHUAZEN;
|
||||
//@formatter:off
|
||||
final FriendlyNpcInstance guard = L2World.getInstance().getVisibleObjects(npc, FriendlyNpcInstance.class, 500)
|
||||
final FriendlyNpcInstance guard = L2World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 500)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == guardId))
|
||||
.findFirst()
|
||||
@ -280,7 +280,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
final L2Attackable guard = (L2Attackable) event.getTarget();
|
||||
|
||||
//@formatter:off
|
||||
final L2Attackable sakum = L2World.getInstance().getVisibleObjects(guard, L2Attackable.class, 1000)
|
||||
final L2Attackable sakum = L2World.getInstance().getVisibleObjectsInRange(guard, L2Attackable.class, 1000)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == SAKUM))
|
||||
.findFirst()
|
||||
|
@ -314,7 +314,7 @@ public final class Antharas extends AbstractNpcAI
|
||||
}
|
||||
case "START_MOVE":
|
||||
{
|
||||
for (L2PcInstance players : L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 4000))
|
||||
for (L2PcInstance players : L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 4000))
|
||||
{
|
||||
if (players.isHero())
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ public final class Baium extends AbstractNpcAI
|
||||
}
|
||||
else
|
||||
{
|
||||
for (L2Character creature : L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 2000))
|
||||
for (L2Character creature : L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 2000))
|
||||
{
|
||||
if (zone.isInsideZone(creature) && !creature.isDead())
|
||||
{
|
||||
@ -336,7 +336,7 @@ public final class Baium extends AbstractNpcAI
|
||||
else
|
||||
{
|
||||
boolean found = false;
|
||||
for (L2Playable creature : L2World.getInstance().getVisibleObjects(mob, L2Playable.class, 1000))
|
||||
for (L2Playable creature : L2World.getInstance().getVisibleObjectsInRange(mob, L2Playable.class, 1000))
|
||||
{
|
||||
if (zone.isInsideZone(creature) && !creature.isDead())
|
||||
{
|
||||
|
@ -609,7 +609,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isDead() && !npc.isCastingNow())
|
||||
{
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(FIREBALL.getSkill());
|
||||
@ -640,13 +640,13 @@ public final class Beleth extends AbstractNpcAI
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.doCast(LIGHTENING.getSkill());
|
||||
return null;
|
||||
}
|
||||
//@formatter:off
|
||||
final L2PcInstance plr = L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 950)
|
||||
final L2PcInstance plr = L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 950)
|
||||
.stream()
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@ -666,7 +666,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
npc.setRunning();
|
||||
if ((getRandom(100) < 60) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 300).isEmpty())
|
||||
if ((getRandom(100) < 60) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 300).isEmpty())
|
||||
{
|
||||
npc.doCast(BLEED.getSkill());
|
||||
}
|
||||
@ -731,7 +731,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
}
|
||||
else if (!npc.isDead() && !npc.isCastingNow())
|
||||
{
|
||||
if (!L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if (!L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.doCast(LIGHTENING.getSkill());
|
||||
return null;
|
||||
|
@ -1227,7 +1227,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
|
||||
private void manageMovie(Instance world, Movie movie)
|
||||
{
|
||||
final L2Npc controller = world.getParameters().getObject("controller", L2Npc.class);
|
||||
playMovie(L2World.getInstance().getVisibleObjects(controller, L2PcInstance.class, 8000), movie);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(controller, L2PcInstance.class, 8000), movie);
|
||||
}
|
||||
|
||||
private List<L2Npc> getKnightStatues(Instance world)
|
||||
|
@ -312,7 +312,7 @@ public final class OctavisWarzone extends AbstractInstance
|
||||
final L2PcInstance mostHated = ((L2Attackable) npc).getMostHated().getActingPlayer();
|
||||
if ((mostHated != null) && (mostHated.calculateDistance3D(npc) < 5000))
|
||||
{
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion ->
|
||||
L2World.getInstance().getVisibleObjectsInRange(npc, L2Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion ->
|
||||
{
|
||||
addAttackPlayerDesire(minion, mostHated, 23);
|
||||
});
|
||||
|
@ -495,7 +495,7 @@ public final class Stage1 extends AbstractInstance implements IGameXmlReader
|
||||
final L2Npc videoNpc = world.getNpc(TIAT_VIDEO_NPC);
|
||||
if (videoNpc != null)
|
||||
{
|
||||
playMovie(L2World.getInstance().getVisibleObjects(videoNpc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_OPENING);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(videoNpc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_OPENING);
|
||||
videoNpc.deleteMe();
|
||||
}
|
||||
}
|
||||
@ -639,7 +639,7 @@ public final class Stage1 extends AbstractInstance implements IGameXmlReader
|
||||
if (npc.getId() == TIAT)
|
||||
{
|
||||
world.incStatus();
|
||||
playMovie(L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_ENDING_SUCCES);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_ENDING_SUCCES);
|
||||
world.removeNpcs();
|
||||
world.finishInstance();
|
||||
GraciaSeedsManager.getInstance().increaseSoDTiatKilled();
|
||||
|
@ -516,7 +516,7 @@ public final class Valakas extends AbstractNpcAI
|
||||
}
|
||||
|
||||
// Valakas will use mass spells if he feels surrounded.
|
||||
if (L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 1200).size() >= 20)
|
||||
if (L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 1200).size() >= 20)
|
||||
{
|
||||
return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)];
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class SiegeGuards extends AbstractNpcAI
|
||||
final L2Object target = npc.getTarget();
|
||||
if (!npc.isInCombat() || (target == null) || (npc.calculateDistance2D(target) > npc.getAggroRange()) || target.isInvul())
|
||||
{
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange()))
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange()))
|
||||
{
|
||||
if (nearby.isPlayable() && GeoEngine.getInstance().canSeeTarget(npc, nearby))
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ public class RecieveAdventurerBuffs extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isMoving())
|
||||
{
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 100))
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 100))
|
||||
{
|
||||
if (CommonUtil.contains(ADVENTURERS_GUIDE, nearby.getId()))
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ public final class AdminPcCafePoints implements IAdminCommandHandler
|
||||
}
|
||||
else if (range > 0)
|
||||
{
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjects(activeChar, L2PcInstance.class, range), value);
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2PcInstance.class, range), value);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
|
||||
}
|
||||
break;
|
||||
|
@ -129,7 +129,7 @@ public final class AdminPrimePoints implements IAdminCommandHandler
|
||||
}
|
||||
else if (range > 0)
|
||||
{
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjects(activeChar, L2PcInstance.class, range), value);
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2PcInstance.class, range), value);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased Prime Point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
|
||||
}
|
||||
break;
|
||||
|
@ -175,7 +175,7 @@ public class AdminScan implements IAdminCommandHandler
|
||||
html.setFile(activeChar, "data/html/admin/scan.htm");
|
||||
|
||||
//@formatter:off
|
||||
final PageResult result = PageBuilder.newBuilder(L2World.getInstance().getVisibleObjects(activeChar, L2Npc.class, radius, condition), 15, bypassParser.toString())
|
||||
final PageResult result = PageBuilder.newBuilder(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2Npc.class, radius, condition), 15, bypassParser.toString())
|
||||
.currentPage(page)
|
||||
.pageHandler(NextPrevPageHandler.INSTANCE)
|
||||
.formatter(BypassParserFormatter.INSTANCE)
|
||||
|
@ -96,7 +96,7 @@ public final class AirBind extends AbstractEffect
|
||||
@Override
|
||||
public void continuousInstant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
|
||||
{
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjects(effected, L2PcInstance.class, 1200))
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjectsInRange(effected, L2PcInstance.class, 1200))
|
||||
{
|
||||
if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) //
|
||||
&& nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive())
|
||||
|
@ -166,7 +166,7 @@ public final class KnockBack extends AbstractEffect
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjects(effected, L2PcInstance.class, 1200))
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjectsInRange(effected, L2PcInstance.class, 1200))
|
||||
{
|
||||
if (nearbyPlayer.getRace() == Race.ERTHEIA)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ public class OpExistNpcSkillCondition implements ISkillCondition
|
||||
@Override
|
||||
public boolean canUse(L2Character caster, Skill skill, L2Object target)
|
||||
{
|
||||
final List<L2Npc> npcs = L2World.getInstance().getVisibleObjects(caster, L2Npc.class, _range);
|
||||
final List<L2Npc> npcs = L2World.getInstance().getVisibleObjectsInRange(caster, L2Npc.class, _range);
|
||||
return _isAround == npcs.stream().anyMatch(npc -> _npcIds.contains(npc.getId()));
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class RangeSortByHp implements IAffectScopeHandler
|
||||
return true;
|
||||
};
|
||||
|
||||
final List<L2Character> result = L2World.getInstance().getVisibleObjects(target, L2Character.class, affectRange, filter);
|
||||
final List<L2Character> result = L2World.getInstance().getVisibleObjectsInRange(target, L2Character.class, affectRange, filter);
|
||||
|
||||
// Add object of origin since its skipped in the getVisibleObjects method.
|
||||
if (target.isCharacter() && filter.test((L2Character) target))
|
||||
|
@ -239,7 +239,7 @@ public final class EvilIncubator extends AbstractInstance
|
||||
if (helperCount == 2)
|
||||
{
|
||||
st.setCond(7, true);
|
||||
L2World.getInstance().getVisibleObjects(world.getNpc(ADOLPH), FriendlyNpcInstance.class, 1000).forEach(c -> c.deleteMe());
|
||||
L2World.getInstance().getVisibleObjectsInRange(world.getNpc(ADOLPH), FriendlyNpcInstance.class, 1000).forEach(c -> c.deleteMe());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -122,7 +122,7 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
|
||||
}
|
||||
else if (!npc.isInCombat() || (npc.getTarget() == null))
|
||||
{
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 500);
|
||||
if (!monsterList.isEmpty())
|
||||
{
|
||||
final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
|
||||
@ -183,7 +183,7 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
|
||||
npc.doCast(skill_01.getSkill(), null, true, false);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 300);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 300);
|
||||
if (!monsterList.isEmpty())
|
||||
{
|
||||
for (L2MonsterInstance monster : monsterList)
|
||||
|
@ -101,7 +101,7 @@ public final class Q10742_AFurryFriend extends Quest
|
||||
showOnScreenMsg(player, NpcStringId.RICKY_IS_NOT_HERE_NTRY_SEARCHING_ANOTHER_KIKU_S_CAVE, ExShowScreenMessage.TOP_CENTER, 8000);
|
||||
htmltext = "33995-02.html";
|
||||
}
|
||||
else if (!L2World.getInstance().getVisibleObjects(player, L2Npc.class, 500).stream().anyMatch(n -> (n.getId() == RICKY) && (n.getSummoner() == player)))
|
||||
else if (!L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 500).stream().anyMatch(n -> (n.getId() == RICKY) && (n.getSummoner() == player)))
|
||||
{
|
||||
showOnScreenMsg(player, NpcStringId.TAKE_RICKY_TO_LEIRA_IN_UNDER_2_MINUTES, ExShowScreenMessage.MIDDLE_CENTER, 5000);
|
||||
player.sendPacket(new ExSendUIEvent(player, false, false, 120, 0, NpcStringId.REMAINING_TIME));
|
||||
@ -149,7 +149,7 @@ public final class Q10742_AFurryFriend extends Quest
|
||||
}
|
||||
else
|
||||
{
|
||||
final L2Npc leira = L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 300).stream().filter(n -> (n.getId() == LEIRA)).findAny().orElse(null);
|
||||
final L2Npc leira = L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 300).stream().filter(n -> (n.getId() == LEIRA)).findAny().orElse(null);
|
||||
if (leira != null)
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
|
@ -418,7 +418,7 @@ public final class Q10751_WindsOfFateEncounters extends Quest
|
||||
qs.set(KILL_COUNT_VAR, ++killCount);
|
||||
}
|
||||
|
||||
if ((killCount >= 5) && !L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 1000).stream().anyMatch(n -> ((n.getId() == TELESHA) && (n.getSummoner() == killer))))
|
||||
if ((killCount >= 5) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 1000).stream().anyMatch(n -> ((n.getId() == TELESHA) && (n.getSummoner() == killer))))
|
||||
{
|
||||
final L2Npc telsha = addSpawn(TELESHA, npc, false, 30000);
|
||||
telsha.setSummoner(killer);
|
||||
|
@ -87,7 +87,7 @@ public final class Q10772_ReportsFromCrumaTowerPart1 extends Quest
|
||||
}
|
||||
case "spawn_owl":
|
||||
{
|
||||
if (qs.isCond(1) && !L2World.getInstance().getVisibleObjects(player, L2Npc.class, 700).stream().anyMatch(n -> n.getId() == MAGIC_OWL))
|
||||
if (qs.isCond(1) && !L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 700).stream().anyMatch(n -> n.getId() == MAGIC_OWL))
|
||||
{
|
||||
addSpawn(MAGIC_OWL, OWL_LOC, true, 20000);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public final class Q10777_ReportsFromCrumaTowerPart2 extends Quest
|
||||
}
|
||||
case "summon":
|
||||
{
|
||||
if (qs.isCond(1) && !L2World.getInstance().getVisibleObjects(player, L2Npc.class, 700).stream().anyMatch(n -> n.getId() == MAGIC_OWL))
|
||||
if (qs.isCond(1) && !L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 700).stream().anyMatch(n -> n.getId() == MAGIC_OWL))
|
||||
{
|
||||
final L2Npc owl = addSpawn(MAGIC_OWL, OWL_LOC);
|
||||
getTimers().addTimer("DESPAWN_OWL", 20000, owl, null);
|
||||
|
@ -91,7 +91,7 @@ public final class Q10787_ASpyMission extends Quest
|
||||
htmltext = "33994-03.html";
|
||||
}
|
||||
// @formatter:off
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150).stream()
|
||||
L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 150).stream()
|
||||
.filter(n -> (n.getId() == EMBRYO_PURIFIER))
|
||||
.forEach(mob -> addAttackPlayerDesire(mob, player));
|
||||
// @formatter:on
|
||||
|
@ -148,7 +148,7 @@ public final class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
private final L2Npc findController()
|
||||
{
|
||||
// check objects around the ship
|
||||
for (L2Npc obj : L2World.getInstance().getVisibleObjects(_ship, L2Npc.class, 600))
|
||||
for (L2Npc obj : L2World.getInstance().getVisibleObjectsInRange(_ship, L2Npc.class, 600))
|
||||
{
|
||||
for (int id : CONTROLLERS)
|
||||
{
|
||||
|
@ -358,7 +358,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
{
|
||||
L2Character nearestTarget = null;
|
||||
double closestDistance = Double.MAX_VALUE;
|
||||
for (L2Character t : L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange()))
|
||||
for (L2Character t : L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange()))
|
||||
{
|
||||
if ((t == _actor) || (t == null) || t.isDead())
|
||||
{
|
||||
@ -1118,7 +1118,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
}
|
||||
else
|
||||
{
|
||||
stream = L2World.getInstance().getVisibleObjects(npc, L2Character.class, range, c -> checkSkillTarget(skill, c)).stream();
|
||||
stream = L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, range, c -> checkSkillTarget(skill, c)).stream();
|
||||
|
||||
// Maybe add self to the list of targets since getVisibleObjects doesn't return yourself.
|
||||
if (checkSkillTarget(skill, npc))
|
||||
@ -1149,7 +1149,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
// If npc is aggressive, add characters within aggro range too
|
||||
if (npc.isAggressive())
|
||||
{
|
||||
stream = Stream.concat(stream, L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange(), this::checkTarget).stream());
|
||||
stream = Stream.concat(stream, L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange(), this::checkTarget).stream());
|
||||
}
|
||||
|
||||
return stream.findAny().orElse(null);
|
||||
@ -1161,7 +1161,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
.sorted(Comparator.comparingInt(AggroInfo::getHate))
|
||||
.map(AggroInfo::getAttacker)
|
||||
.findFirst()
|
||||
.orElse(npc.isAggressive() ? L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange(), this::checkTarget).stream().findAny().orElse(null) : null);
|
||||
.orElse(npc.isAggressive() ? L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange(), this::checkTarget).stream().findAny().orElse(null) : null);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
|
@ -648,14 +648,14 @@ public final class L2World
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends L2Object> List<T> getVisibleObjects(L2Object object, Class<T> clazz, int range)
|
||||
public <T extends L2Object> List<T> getVisibleObjectsInRange(L2Object object, Class<T> clazz, int range)
|
||||
{
|
||||
final List<T> result = new ArrayList<>();
|
||||
forEachVisibleObjectInRange(object, clazz, range, result::add);
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T extends L2Object> List<T> getVisibleObjects(L2Object object, Class<T> clazz, int range, Predicate<T> predicate)
|
||||
public <T extends L2Object> List<T> getVisibleObjectsInRange(L2Object object, Class<T> clazz, int range, Predicate<T> predicate)
|
||||
{
|
||||
final List<T> result = new ArrayList<>();
|
||||
forEachVisibleObjectInRange(object, clazz, range, o ->
|
||||
|
@ -1173,7 +1173,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
final double headingAngle = Util.convertHeadingToDegree(getHeading());
|
||||
final int maxRadius = _stat.getPhysicalAttackRadius();
|
||||
final int physicalAttackAngle = _stat.getPhysicalAttackAngle();
|
||||
for (L2Character obj : L2World.getInstance().getVisibleObjects(this, L2Character.class, maxRadius))
|
||||
for (L2Character obj : L2World.getInstance().getVisibleObjectsInRange(this, L2Character.class, maxRadius))
|
||||
{
|
||||
// Skip main target.
|
||||
if (obj == target)
|
||||
|
@ -173,7 +173,7 @@ public class L2DefenderInstance extends L2Attackable
|
||||
{
|
||||
L2Character target = this;
|
||||
double lowestHpValue = Double.MAX_VALUE;
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjects(this, L2Character.class, skill.getCastRange()))
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjectsInRange(this, L2Character.class, skill.getCastRange()))
|
||||
{
|
||||
if ((nearby == null) || nearby.isDead() || !GeoEngine.getInstance().canSeeTarget(this, nearby))
|
||||
{
|
||||
|
@ -4579,7 +4579,7 @@ public final class L2PcInstance extends L2Playable
|
||||
{
|
||||
if ((Config.SHOP_MIN_RANGE_FROM_NPC > 0) || (Config.SHOP_MIN_RANGE_FROM_PLAYER > 0))
|
||||
{
|
||||
for (L2Character cha : L2World.getInstance().getVisibleObjects(this, L2Character.class, 1000))
|
||||
for (L2Character cha : L2World.getInstance().getVisibleObjectsInRange(this, L2Character.class, 1000))
|
||||
{
|
||||
if (Util.checkIfInRange(cha.getMinShopDistance(), this, cha, true))
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public class ConditionPlayerRangeFromNpc extends Condition
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
{
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjects(effector, L2Npc.class, _radius))
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjectsInRange(effector, L2Npc.class, _radius))
|
||||
{
|
||||
if (CommonUtil.contains(_npcIds, target.getId()))
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
{
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjects(effector, L2Npc.class, _radius))
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjectsInRange(effector, L2Npc.class, _radius))
|
||||
{
|
||||
if (CommonUtil.contains(_npcIds, target.getId()) && (effector == target.getSummoner()))
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ public class CubicInstance
|
||||
Stream<L2Character> stream;
|
||||
if (party != null)
|
||||
{
|
||||
stream = L2World.getInstance().getVisibleObjects(_owner, L2Character.class, Config.ALT_PARTY_RANGE, c -> (c.getParty() == party) && _template.validateConditions(this, _owner, c) && cubicSkill.validateConditions(this, _owner, c)).stream();
|
||||
stream = L2World.getInstance().getVisibleObjectsInRange(_owner, L2Character.class, Config.ALT_PARTY_RANGE, c -> (c.getParty() == party) && _template.validateConditions(this, _owner, c) && cubicSkill.validateConditions(this, _owner, c)).stream();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ public final class RequestDuelStart implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
boolean npcInRange = false;
|
||||
for (L2Npc npc : L2World.getInstance().getVisibleObjects(activeChar, L2Npc.class, 250))
|
||||
for (L2Npc npc : L2World.getInstance().getVisibleObjectsInRange(activeChar, L2Npc.class, 250))
|
||||
{
|
||||
if (npc.getName().equals(name))
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ public final class TradeRequest implements IClientIncomingPacket
|
||||
{
|
||||
final String name = FakePlayerData.getInstance().getProperName(target.getName());
|
||||
boolean npcInRange = false;
|
||||
for (L2Npc npc : L2World.getInstance().getVisibleObjects(player, L2Npc.class, 150))
|
||||
for (L2Npc npc : L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 150))
|
||||
{
|
||||
if (npc.getName().equals(name))
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ public final class LindviorScene extends AbstractNpcAI
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
playMovie(L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 4000), Movie.SC_LINDVIOR);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 4000), Movie.SC_LINDVIOR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public final class TrainningSoldier extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150))
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 150))
|
||||
{
|
||||
if ((nearby != null) && (nearby.getId() == DUMMY))
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 1000);
|
||||
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 1000);
|
||||
if (!nearbyMonsters.isEmpty())
|
||||
{
|
||||
final L2MonsterInstance monster = nearbyMonsters.get(getRandom(nearbyMonsters.size()));
|
||||
|
@ -92,7 +92,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
npc.broadcastSocialAction(4);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, GUARD_SHOUT[getRandom(2)], 1000);
|
||||
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 500).stream().filter(n -> n.getId() == GUARD).forEach(guard ->
|
||||
L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 500).stream().filter(n -> n.getId() == GUARD).forEach(guard ->
|
||||
{
|
||||
startQuestTimer("SOCIAL_ACTION", getRandom(2500, 3500), guard, null);
|
||||
});
|
||||
@ -136,7 +136,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
if (attackId > 0)
|
||||
{
|
||||
//@formatter:off
|
||||
final L2MonsterInstance monster = L2World.getInstance().getVisibleObjects(guard, L2MonsterInstance.class, 1000)
|
||||
final L2MonsterInstance monster = L2World.getInstance().getVisibleObjectsInRange(guard, L2MonsterInstance.class, 1000)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == attackId))
|
||||
.findFirst()
|
||||
@ -162,7 +162,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
if (guard.getId() == SCHUAZEN)
|
||||
{
|
||||
//@formatter:off
|
||||
final FriendlyNpcInstance decoGuard = L2World.getInstance().getVisibleObjects(guard, FriendlyNpcInstance.class, 500)
|
||||
final FriendlyNpcInstance decoGuard = L2World.getInstance().getVisibleObjectsInRange(guard, FriendlyNpcInstance.class, 500)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == DECO_GUARD2))
|
||||
.findFirst()
|
||||
@ -212,7 +212,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
{
|
||||
final int guardId = npc.getId() == REGENERATED_KANILOV ? JOEL : SCHUAZEN;
|
||||
//@formatter:off
|
||||
final FriendlyNpcInstance guard = L2World.getInstance().getVisibleObjects(npc, FriendlyNpcInstance.class, 500)
|
||||
final FriendlyNpcInstance guard = L2World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 500)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == guardId))
|
||||
.findFirst()
|
||||
@ -280,7 +280,7 @@ public final class Wastelands extends AbstractNpcAI
|
||||
final L2Attackable guard = (L2Attackable) event.getTarget();
|
||||
|
||||
//@formatter:off
|
||||
final L2Attackable sakum = L2World.getInstance().getVisibleObjects(guard, L2Attackable.class, 1000)
|
||||
final L2Attackable sakum = L2World.getInstance().getVisibleObjectsInRange(guard, L2Attackable.class, 1000)
|
||||
.stream()
|
||||
.filter(obj -> (obj.getId() == SAKUM))
|
||||
.findFirst()
|
||||
|
@ -314,7 +314,7 @@ public final class Antharas extends AbstractNpcAI
|
||||
}
|
||||
case "START_MOVE":
|
||||
{
|
||||
for (L2PcInstance players : L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 4000))
|
||||
for (L2PcInstance players : L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 4000))
|
||||
{
|
||||
if (players.isHero())
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ public final class Baium extends AbstractNpcAI
|
||||
}
|
||||
else
|
||||
{
|
||||
for (L2Character creature : L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 2000))
|
||||
for (L2Character creature : L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 2000))
|
||||
{
|
||||
if (zone.isInsideZone(creature) && !creature.isDead())
|
||||
{
|
||||
@ -336,7 +336,7 @@ public final class Baium extends AbstractNpcAI
|
||||
else
|
||||
{
|
||||
boolean found = false;
|
||||
for (L2Playable creature : L2World.getInstance().getVisibleObjects(mob, L2Playable.class, 1000))
|
||||
for (L2Playable creature : L2World.getInstance().getVisibleObjectsInRange(mob, L2Playable.class, 1000))
|
||||
{
|
||||
if (zone.isInsideZone(creature) && !creature.isDead())
|
||||
{
|
||||
|
@ -609,7 +609,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isDead() && !npc.isCastingNow())
|
||||
{
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(FIREBALL.getSkill());
|
||||
@ -640,13 +640,13 @@ public final class Beleth extends AbstractNpcAI
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if ((getRandom(100) < 40) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.doCast(LIGHTENING.getSkill());
|
||||
return null;
|
||||
}
|
||||
//@formatter:off
|
||||
final L2PcInstance plr = L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 950)
|
||||
final L2PcInstance plr = L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 950)
|
||||
.stream()
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@ -666,7 +666,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
npc.setRunning();
|
||||
if ((getRandom(100) < 60) && !L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 300).isEmpty())
|
||||
if ((getRandom(100) < 60) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 300).isEmpty())
|
||||
{
|
||||
npc.doCast(BLEED.getSkill());
|
||||
}
|
||||
@ -731,7 +731,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
}
|
||||
else if (!npc.isDead() && !npc.isCastingNow())
|
||||
{
|
||||
if (!L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 200).isEmpty())
|
||||
if (!L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 200).isEmpty())
|
||||
{
|
||||
npc.doCast(LIGHTENING.getSkill());
|
||||
return null;
|
||||
|
@ -1227,7 +1227,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
|
||||
private void manageMovie(Instance world, Movie movie)
|
||||
{
|
||||
final L2Npc controller = world.getParameters().getObject("controller", L2Npc.class);
|
||||
playMovie(L2World.getInstance().getVisibleObjects(controller, L2PcInstance.class, 8000), movie);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(controller, L2PcInstance.class, 8000), movie);
|
||||
}
|
||||
|
||||
private List<L2Npc> getKnightStatues(Instance world)
|
||||
|
@ -312,7 +312,7 @@ public final class OctavisWarzone extends AbstractInstance
|
||||
final L2PcInstance mostHated = ((L2Attackable) npc).getMostHated().getActingPlayer();
|
||||
if ((mostHated != null) && (mostHated.calculateDistance3D(npc) < 5000))
|
||||
{
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion ->
|
||||
L2World.getInstance().getVisibleObjectsInRange(npc, L2Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion ->
|
||||
{
|
||||
addAttackPlayerDesire(minion, mostHated, 23);
|
||||
});
|
||||
|
@ -495,7 +495,7 @@ public final class Stage1 extends AbstractInstance implements IGameXmlReader
|
||||
final L2Npc videoNpc = world.getNpc(TIAT_VIDEO_NPC);
|
||||
if (videoNpc != null)
|
||||
{
|
||||
playMovie(L2World.getInstance().getVisibleObjects(videoNpc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_OPENING);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(videoNpc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_OPENING);
|
||||
videoNpc.deleteMe();
|
||||
}
|
||||
}
|
||||
@ -639,7 +639,7 @@ public final class Stage1 extends AbstractInstance implements IGameXmlReader
|
||||
if (npc.getId() == TIAT)
|
||||
{
|
||||
world.incStatus();
|
||||
playMovie(L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_ENDING_SUCCES);
|
||||
playMovie(L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 8000), Movie.SC_BOSS_TIAT_ENDING_SUCCES);
|
||||
world.removeNpcs();
|
||||
world.finishInstance();
|
||||
GraciaSeedsManager.getInstance().increaseSoDTiatKilled();
|
||||
|
@ -516,7 +516,7 @@ public final class Valakas extends AbstractNpcAI
|
||||
}
|
||||
|
||||
// Valakas will use mass spells if he feels surrounded.
|
||||
if (L2World.getInstance().getVisibleObjects(npc, L2PcInstance.class, 1200).size() >= 20)
|
||||
if (L2World.getInstance().getVisibleObjectsInRange(npc, L2PcInstance.class, 1200).size() >= 20)
|
||||
{
|
||||
return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)];
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class SiegeGuards extends AbstractNpcAI
|
||||
final L2Object target = npc.getTarget();
|
||||
if (!npc.isInCombat() || (target == null) || (npc.calculateDistance2D(target) > npc.getAggroRange()) || target.isInvul())
|
||||
{
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange()))
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Character.class, npc.getAggroRange()))
|
||||
{
|
||||
if (nearby.isPlayable() && GeoEngine.getInstance().canSeeTarget(npc, nearby))
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ public class RecieveAdventurerBuffs extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isMoving())
|
||||
{
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 100))
|
||||
for (L2Npc nearby : L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 100))
|
||||
{
|
||||
if (CommonUtil.contains(ADVENTURERS_GUIDE, nearby.getId()))
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ public final class AdminPcCafePoints implements IAdminCommandHandler
|
||||
}
|
||||
else if (range > 0)
|
||||
{
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjects(activeChar, L2PcInstance.class, range), value);
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2PcInstance.class, range), value);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
|
||||
}
|
||||
break;
|
||||
|
@ -129,7 +129,7 @@ public final class AdminPrimePoints implements IAdminCommandHandler
|
||||
}
|
||||
else if (range > 0)
|
||||
{
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjects(activeChar, L2PcInstance.class, range), value);
|
||||
final int count = increaseForAll(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2PcInstance.class, range), value);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased Prime Point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
|
||||
}
|
||||
break;
|
||||
|
@ -175,7 +175,7 @@ public class AdminScan implements IAdminCommandHandler
|
||||
html.setFile(activeChar, "data/html/admin/scan.htm");
|
||||
|
||||
//@formatter:off
|
||||
final PageResult result = PageBuilder.newBuilder(L2World.getInstance().getVisibleObjects(activeChar, L2Npc.class, radius, condition), 15, bypassParser.toString())
|
||||
final PageResult result = PageBuilder.newBuilder(L2World.getInstance().getVisibleObjectsInRange(activeChar, L2Npc.class, radius, condition), 15, bypassParser.toString())
|
||||
.currentPage(page)
|
||||
.pageHandler(NextPrevPageHandler.INSTANCE)
|
||||
.formatter(BypassParserFormatter.INSTANCE)
|
||||
|
@ -96,7 +96,7 @@ public final class AirBind extends AbstractEffect
|
||||
@Override
|
||||
public void continuousInstant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
|
||||
{
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjects(effected, L2PcInstance.class, 1200))
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjectsInRange(effected, L2PcInstance.class, 1200))
|
||||
{
|
||||
if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) //
|
||||
&& nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive())
|
||||
|
@ -166,7 +166,7 @@ public final class KnockBack extends AbstractEffect
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjects(effected, L2PcInstance.class, 1200))
|
||||
for (L2PcInstance nearbyPlayer : L2World.getInstance().getVisibleObjectsInRange(effected, L2PcInstance.class, 1200))
|
||||
{
|
||||
if (nearbyPlayer.getRace() == Race.ERTHEIA)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ public class OpExistNpcSkillCondition implements ISkillCondition
|
||||
@Override
|
||||
public boolean canUse(L2Character caster, Skill skill, L2Object target)
|
||||
{
|
||||
final List<L2Npc> npcs = L2World.getInstance().getVisibleObjects(caster, L2Npc.class, _range);
|
||||
final List<L2Npc> npcs = L2World.getInstance().getVisibleObjectsInRange(caster, L2Npc.class, _range);
|
||||
return _isAround == npcs.stream().anyMatch(npc -> _npcIds.contains(npc.getId()));
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class RangeSortByHp implements IAffectScopeHandler
|
||||
return true;
|
||||
};
|
||||
|
||||
final List<L2Character> result = L2World.getInstance().getVisibleObjects(target, L2Character.class, affectRange, filter);
|
||||
final List<L2Character> result = L2World.getInstance().getVisibleObjectsInRange(target, L2Character.class, affectRange, filter);
|
||||
|
||||
// Add object of origin since its skipped in the getVisibleObjects method.
|
||||
if (target.isCharacter() && filter.test((L2Character) target))
|
||||
|
@ -239,7 +239,7 @@ public final class EvilIncubator extends AbstractInstance
|
||||
if (helperCount == 2)
|
||||
{
|
||||
st.setCond(7, true);
|
||||
L2World.getInstance().getVisibleObjects(world.getNpc(ADOLPH), FriendlyNpcInstance.class, 1000).forEach(c -> c.deleteMe());
|
||||
L2World.getInstance().getVisibleObjectsInRange(world.getNpc(ADOLPH), FriendlyNpcInstance.class, 1000).forEach(c -> c.deleteMe());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -122,7 +122,7 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
|
||||
}
|
||||
else if (!npc.isInCombat() || (npc.getTarget() == null))
|
||||
{
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 500);
|
||||
if (!monsterList.isEmpty())
|
||||
{
|
||||
final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
|
||||
@ -183,7 +183,7 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
|
||||
npc.doCast(skill_01.getSkill(), null, true, false);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 300);
|
||||
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjectsInRange(npc, L2MonsterInstance.class, 300);
|
||||
if (!monsterList.isEmpty())
|
||||
{
|
||||
for (L2MonsterInstance monster : monsterList)
|
||||
|
@ -101,7 +101,7 @@ public final class Q10742_AFurryFriend extends Quest
|
||||
showOnScreenMsg(player, NpcStringId.RICKY_IS_NOT_HERE_NTRY_SEARCHING_ANOTHER_KIKU_S_CAVE, ExShowScreenMessage.TOP_CENTER, 8000);
|
||||
htmltext = "33995-02.html";
|
||||
}
|
||||
else if (!L2World.getInstance().getVisibleObjects(player, L2Npc.class, 500).stream().anyMatch(n -> (n.getId() == RICKY) && (n.getSummoner() == player)))
|
||||
else if (!L2World.getInstance().getVisibleObjectsInRange(player, L2Npc.class, 500).stream().anyMatch(n -> (n.getId() == RICKY) && (n.getSummoner() == player)))
|
||||
{
|
||||
showOnScreenMsg(player, NpcStringId.TAKE_RICKY_TO_LEIRA_IN_UNDER_2_MINUTES, ExShowScreenMessage.MIDDLE_CENTER, 5000);
|
||||
player.sendPacket(new ExSendUIEvent(player, false, false, 120, 0, NpcStringId.REMAINING_TIME));
|
||||
@ -149,7 +149,7 @@ public final class Q10742_AFurryFriend extends Quest
|
||||
}
|
||||
else
|
||||
{
|
||||
final L2Npc leira = L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 300).stream().filter(n -> (n.getId() == LEIRA)).findAny().orElse(null);
|
||||
final L2Npc leira = L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 300).stream().filter(n -> (n.getId() == LEIRA)).findAny().orElse(null);
|
||||
if (leira != null)
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
|
@ -434,7 +434,7 @@ public final class Q10751_WindsOfFateEncounters extends Quest
|
||||
playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
|
||||
}
|
||||
|
||||
if ((killCount >= 5) && !L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 1000).stream().anyMatch(n -> ((n.getId() == TELESHA) && (n.getSummoner() == killer))))
|
||||
if ((killCount >= 5) && !L2World.getInstance().getVisibleObjectsInRange(npc, L2Npc.class, 1000).stream().anyMatch(n -> ((n.getId() == TELESHA) && (n.getSummoner() == killer))))
|
||||
{
|
||||
final L2Npc telsha = addSpawn(TELESHA, npc, false, 30000);
|
||||
telsha.setSummoner(killer);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user