Distance checking methods rework.

This commit is contained in:
MobiusDev
2018-09-05 01:50:44 +00:00
parent 0299a04d9b
commit b4be2cc560
1001 changed files with 2372 additions and 1802 deletions

View File

@@ -48,7 +48,7 @@ public final class SummonPc extends AbstractNpcAI
{
final int chance = getRandom(100);
final boolean attacked = npc.getVariables().getBoolean("attacked", false);
if ((npc.calculateDistance(attacker, true, false) > 300) && !attacked)
if ((npc.calculateDistance3D(attacker) > 300) && !attacked)
{
if (chance < 50)
{
@@ -66,7 +66,7 @@ public final class SummonPc extends AbstractNpcAI
}
}
}
else if ((npc.calculateDistance(attacker, true, false) > 100) && !attacked)
else if ((npc.calculateDistance3D(attacker) > 100) && !attacked)
{
final L2Attackable monster = (L2Attackable) npc;
if (monster.getMostHated() != null)

View File

@@ -143,7 +143,7 @@ public final class DragonValley extends AbstractNpcAI
{
final L2Playable playable = npc.getVariables().getObject("playable", L2Playable.class);
if ((playable != null) && (npc.calculateDistance(playable, true, false) < 250))
if ((playable != null) && (npc.calculateDistance3D(playable) < 250))
{
npc.disableCoreAI(true);
npc.doCast(SELF_DESTRUCTION.getSkill());
@@ -229,7 +229,7 @@ public final class DragonValley extends AbstractNpcAI
{
for (L2PcInstance member : player.getParty().getMembers())
{
if ((member.getLevel() >= MIN_LVL) && (member.getClassId().level() >= CLASS_LVL) && (npc.calculateDistance(member, true, false) < MIN_DISTANCE))
if ((member.getLevel() >= MIN_LVL) && (member.getClassId().level() >= CLASS_LVL) && (npc.calculateDistance3D(member) < MIN_DISTANCE))
{
points += CLASS_POINTS.get(member.getClassId());
}
@@ -250,7 +250,7 @@ public final class DragonValley extends AbstractNpcAI
for (L2PcInstance member : player.getParty().getMembers())
{
if (npc.calculateDistance(member, true, false) < MIN_DISTANCE)
if (npc.calculateDistance3D(member) < MIN_DISTANCE)
{
switch (moraleBoostLv)
{

View File

@@ -57,7 +57,7 @@ public final class LairOfAntharas extends AbstractNpcAI
{
if (event.equals("CHECK_HOME") && (npc != null) && !npc.isDead())
{
if ((npc.calculateDistance(npc.getSpawn().getLocation(), false, false) > 10) && !npc.isInCombat())
if ((npc.calculateDistance2D(npc.getSpawn().getLocation()) > 10) && !npc.isInCombat())
{
((L2Attackable) npc).returnHome();
}

View File

@@ -222,7 +222,7 @@ public final class Parade extends AbstractNpcAI
{
if (actor != null)
{
if (actor.calculateDistance(actor.getXdestination(), actor.getYdestination(), 0, false, true) < (100 * 100))
if (actor.calculateDistanceSq2D(actor.getXdestination(), actor.getYdestination(), 0) < (100 * 100))
{
actor.deleteMe();
spawns.remove(actor);

View File

@@ -103,7 +103,7 @@ public final class Maguen extends AbstractNpcAI
}
case "DIST_CHECK_TIMER":
{
if ((npc.calculateDistance(player, true, false) < 100) && (npc.getVariables().getInt("IS_NEAR_PLAYER") == 0))
if ((npc.calculateDistance3D(player) < 100) && (npc.getVariables().getInt("IS_NEAR_PLAYER") == 0))
{
npc.getVariables().set("IS_NEAR_PLAYER", 1);
startQuestTimer("FIRST_TIMER", 4000, npc, player);
@@ -371,7 +371,7 @@ public final class Maguen extends AbstractNpcAI
final L2PcInstance partyMember = getRandomPartyMember(killer);
final int i0 = 10 + (10 * killer.getParty().getMemberCount());
if ((getRandom(1000) < i0) && (npc.calculateDistance(killer, true, false) < 2000) && (npc.calculateDistance(partyMember, true, false) < 2000))
if ((getRandom(1000) < i0) && (npc.calculateDistance3D(killer) < 2000) && (npc.calculateDistance3D(partyMember) < 2000))
{
notifyEvent("SPAWN_MAGUEN", npc, partyMember);
}

View File

@@ -430,7 +430,7 @@ public class HallOfErosionAttack extends AbstractNpcAI
broadCastPacket(world, new ExShowScreenMessage(NpcStringId.S1_S_PARTY_HAS_MOVED_TO_A_DIFFERENT_LOCATION_THROUGH_THE_CRACK_IN_THE_TUMOR, 2, 8000));
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 500, true, false))
if (partyMember.isInsideRadius3D(player, 500))
{
partyMember.teleToLocation(loc, true);
}

View File

@@ -451,7 +451,7 @@ public class HallOfErosionDefence extends AbstractNpcAI
broadCastPacket(world, new ExShowScreenMessage(NpcStringId.S1_S_PARTY_HAS_MOVED_TO_A_DIFFERENT_LOCATION_THROUGH_THE_CRACK_IN_THE_TUMOR, 2, 8000));
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 500, true, false))
if (partyMember.isInsideRadius3D(player, 500))
{
partyMember.teleToLocation(loc, true);
}

View File

@@ -423,7 +423,7 @@ public class HeartInfinityAttack extends AbstractNpcAI
broadCastPacket(world, new ExShowScreenMessage(NpcStringId.S1_S_PARTY_HAS_MOVED_TO_A_DIFFERENT_LOCATION_THROUGH_THE_CRACK_IN_THE_TUMOR, 2, 8000));
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 800, true, false))
if (partyMember.isInsideRadius3D(player, 800))
{
partyMember.teleToLocation(-179548, 209584, -15504, true);
}
@@ -436,7 +436,7 @@ public class HeartInfinityAttack extends AbstractNpcAI
notifyEkimusRoomEntrance(world);
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 400, true, false))
if (partyMember.isInsideRadius3D(player, 400))
{
partyMember.teleToLocation(-179548, 209584, -15504, true);
}
@@ -458,7 +458,7 @@ public class HeartInfinityAttack extends AbstractNpcAI
broadCastPacket(world, new ExShowScreenMessage(NpcStringId.S1_S_PARTY_HAS_MOVED_TO_A_DIFFERENT_LOCATION_THROUGH_THE_CRACK_IN_THE_TUMOR, 2, 8000));
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 500, true, false))
if (partyMember.isInsideRadius3D(player, 500))
{
partyMember.teleToLocation(loc, true);
}

View File

@@ -470,7 +470,7 @@ public class HeartInfinityDefence extends AbstractNpcAI
broadCastPacket(world, new ExShowScreenMessage(NpcStringId.S1_S_PARTY_HAS_MOVED_TO_A_DIFFERENT_LOCATION_THROUGH_THE_CRACK_IN_THE_TUMOR, 2, 8000));
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 800, true, false))
if (partyMember.isInsideRadius3D(player, 800))
{
partyMember.teleToLocation(-179548, 209584, -15504, true);
}
@@ -481,7 +481,7 @@ public class HeartInfinityDefence extends AbstractNpcAI
player.destroyItemByItemId("SOI", 13797, 3, player, true);
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 400, true, false))
if (partyMember.isInsideRadius3D(player, 400))
{
partyMember.teleToLocation(-179548, 209584, -15504, true);
}
@@ -503,7 +503,7 @@ public class HeartInfinityDefence extends AbstractNpcAI
broadCastPacket(world, new ExShowScreenMessage(NpcStringId.S1_S_PARTY_HAS_MOVED_TO_A_DIFFERENT_LOCATION_THROUGH_THE_CRACK_IN_THE_TUMOR, 2, 8000));
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 500, true, false))
if (partyMember.isInsideRadius3D(player, 500))
{
partyMember.teleToLocation(loc, true);
}

View File

@@ -219,7 +219,7 @@ public final class AirShipGludioGracia extends AbstractNpcAI implements Runnable
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
return null;
}
else if (_ship.isInDock() && _ship.isInsideRadius(player, 600, true, false))
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
{
_ship.addPassenger(player);
}

View File

@@ -72,7 +72,7 @@ public final class Chimeras extends AbstractNpcAI
if (HellboundEngine.getInstance().getLevel() == 7) // Have random spawn points only in 7 lvl
{
final Location loc = LOCATIONS[getRandom(LOCATIONS.length)];
if (!npc.isInsideRadius(loc, 200, false, false))
if (!npc.isInsideRadius2D(loc, 200))
{
npc.getSpawn().setLocation(loc);
ThreadPool.schedule(new Teleport(npc, loc), 100);

View File

@@ -255,7 +255,7 @@ public final class AnomicFoundry extends AbstractNpcAI
for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(helperId))
{
final L2MonsterInstance monster = (L2MonsterInstance) spawn.getLastSpawn();
if ((monster != null) && (agressor != null) && !monster.isDead() && monster.isInsideRadius(requester, range, true, false) && !agressor.isDead())
if ((monster != null) && (agressor != null) && !monster.isDead() && monster.isInsideRadius3D(requester, range) && !agressor.isDead())
{
monster.addDamageHate(agressor, 0, 1000);
}

View File

@@ -829,7 +829,7 @@ public final class TowerOfNaia extends AbstractNpcAI
int time = 0;
if (npc != null)
{
final double distance = npc.calculateDistance(coords[0], coords[1], coords[2], true, false);
final double distance = npc.calculateDistance3D(coords[0], coords[1], coords[2]);
final int heading = Util.calculateHeadingFrom(npc.getX(), npc.getY(), coords[0], coords[1]);
time = (int) ((distance / npc.getWalkSpeed()) * 1000);
npc.setWalking();

View File

@@ -578,7 +578,7 @@ public final class TullyWorkshop extends AbstractNpcAI
{
return "32370-01.htm";
}
else if (npc.isInsideRadius(-45531, 245872, -14192, 100, true, false)) // Hello from Tower of Naia! :) Due to onFirstTalk limitation it should be here
else if (npc.isInsideRadius3D(-45531, 245872, -14192, 100)) // Hello from Tower of Naia! :) Due to onFirstTalk limitation it should be here
{
return "32370-03.htm";
}
@@ -604,11 +604,11 @@ public final class TullyWorkshop extends AbstractNpcAI
}
else if (npcId == CUBE_68)
{
if (npc.isInsideRadius(-12752, 279696, -13596, 100, true, false))
if (npc.isInsideRadius3D(-12752, 279696, -13596, 100))
{
return "32467-01.htm";
}
else if (npc.isInsideRadius(-12752, 279696, -10492, 100, true, false))
else if (npc.isInsideRadius3D(-12752, 279696, -10492, 100))
{
return "32467-02.htm";
}
@@ -1195,7 +1195,7 @@ public final class TullyWorkshop extends AbstractNpcAI
{
final int npcId = npc.getId();
if ((npcId == TULLY) && npc.isInsideRadius(-12557, 273901, -9000, 1000, false, false))
if ((npcId == TULLY) && npc.isInsideRadius2D(-12557, 273901, -9000, 1000))
{
for (int i[] : POST_MORTEM_SPAWNLIST)
{
@@ -1399,7 +1399,7 @@ public final class TullyWorkshop extends AbstractNpcAI
@Override
public final String onSpawn(L2Npc npc)
{
if ((npc.getId() == TULLY) && npc.isInsideRadius(-12557, 273901, -9000, 1000, true, false))
if ((npc.getId() == TULLY) && npc.isInsideRadius3D(-12557, 273901, -9000, 1000))
{
for (L2Npc spawnedNpc : postMortemSpawn)
{

View File

@@ -63,17 +63,17 @@ public final class MithrilMinesTeleporter extends AbstractNpcAI
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
if (npc.isInsideRadius(173147, -173762, 0, L2Npc.INTERACTION_DISTANCE, false, true))
if (npc.isInsideRadius2D(173147, -173762, 0, L2Npc.INTERACTION_DISTANCE))
{
return "32652-01.htm";
}
if (npc.isInsideRadius(181941, -174614, 0, L2Npc.INTERACTION_DISTANCE, false, true))
if (npc.isInsideRadius2D(181941, -174614, 0, L2Npc.INTERACTION_DISTANCE))
{
return "32652-02.htm";
}
if (npc.isInsideRadius(179560, -182956, 0, L2Npc.INTERACTION_DISTANCE, false, true))
if (npc.isInsideRadius2D(179560, -182956, 0, L2Npc.INTERACTION_DISTANCE))
{
return "32652-03.htm";
}

View File

@@ -212,7 +212,7 @@ public final class PrimevalIsle extends AbstractNpcAI
if ((npc != null) && (player != null))
{
npc.setScriptValue(0);
if (player.isInsideRadius(npc, 800, true, false))
if (player.isInsideRadius3D(npc, 800))
{
npc.setTarget(player);
npc.doCast(LONGRANGEDMAGIC1.getSkill());

View File

@@ -306,7 +306,7 @@ public final class Venom extends AbstractNpcAI
@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
{
final double distance = npc.calculateDistance(attacker, false, false);
final double distance = npc.calculateDistance2D(attacker);
if (_aggroMode && (getRandom(100) < 25))
{
npc.setTarget(attacker);

View File

@@ -61,7 +61,7 @@ public final class StakatoNestTeleporter extends AbstractNpcAI
{
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.isInsideRadius(player, 1000, true, true))
if (partyMember.isInsideRadius3D(player, 1000))
{
partyMember.teleToLocation(loc, true);
}

View File

@@ -105,7 +105,7 @@ public final class Anais extends AbstractNpcAI
{
if (_nextTarget != null)
{
final double distance = npc.calculateDistance(_nextTarget, false, false);
final double distance = npc.calculateDistance2D(_nextTarget);
if (distance < 100)
{
npc.doCast(DIVINE_NOVA.getSkill());

View File

@@ -232,7 +232,7 @@ public final class Antharas extends AbstractNpcAI
{
for (L2PcInstance member : members)
{
if (member.isInsideRadius(npc, 1000, true, false))
if (member.isInsideRadius3D(npc, 1000))
{
member.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709);
}
@@ -616,7 +616,7 @@ public final class Antharas extends AbstractNpcAI
if (npc.getId() == BOMBER)
{
if (npc.calculateDistance(attacker, true, false) < 230)
if (npc.calculateDistance3D(attacker) < 230)
{
npc.doCast(DISPEL_BOM.getSkill());
npc.doDie(attacker);
@@ -816,17 +816,17 @@ public final class Antharas extends AbstractNpcAI
int i1 = 0;
int i2 = 0;
L2PcInstance c2 = null;
if ((attacker_1 == null) || (npc.calculateDistance(attacker_1, true, false) > 9000) || attacker_1.isDead())
if ((attacker_1 == null) || (npc.calculateDistance3D(attacker_1) > 9000) || attacker_1.isDead())
{
attacker_1_hate = 0;
}
if ((attacker_2 == null) || (npc.calculateDistance(attacker_2, true, false) > 9000) || attacker_2.isDead())
if ((attacker_2 == null) || (npc.calculateDistance3D(attacker_2) > 9000) || attacker_2.isDead())
{
attacker_2_hate = 0;
}
if ((attacker_3 == null) || (npc.calculateDistance(attacker_3, true, false) > 9000) || attacker_3.isDead())
if ((attacker_3 == null) || (npc.calculateDistance3D(attacker_3) > 9000) || attacker_3.isDead())
{
attacker_3_hate = 0;
}
@@ -874,7 +874,7 @@ public final class Antharas extends AbstractNpcAI
}
}
final double distance_c2 = npc.calculateDistance(c2, true, false);
final double distance_c2 = npc.calculateDistance3D(c2);
final double direction_c2 = npc.calculateDirectionTo(c2);
SkillHolder skillToCast = null;

View File

@@ -245,7 +245,7 @@ public final class Baium extends AbstractNpcAI
{
if (npc != null)
{
if ((player != null) && player.isInsideRadius(npc, 16000, true, false))
if ((player != null) && player.isInsideRadius3D(npc, 16000))
{
player.teleToLocation(BAIUM_GIFT_LOC);
startQuestTimer("PLAYER_KILL", 3000, npc, player);
@@ -268,7 +268,7 @@ public final class Baium extends AbstractNpcAI
}
case "PLAYER_KILL":
{
if ((player != null) && player.isInsideRadius(npc, 16000, true, false))
if ((player != null) && player.isInsideRadius3D(npc, 16000))
{
zone.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HOW_DARE_YOU_WAKE_ME_NOW_YOU_SHALL_DIE, player.getName());
@@ -351,7 +351,7 @@ public final class Baium extends AbstractNpcAI
if (!found)
{
if (mob.isInsideRadius(_baium, 40, true, false))
if (mob.isInsideRadius3D(_baium, 40))
{
if (mob.getTarget() != _baium)
{
@@ -520,7 +520,7 @@ public final class Baium extends AbstractNpcAI
if ((getRandom(100) < 10) && mob.checkDoCastConditions(SPEAR_ATTACK.getSkill()))
{
if ((mostHated != null) && (npc.calculateDistance(mostHated, true, false) < 1000) && zone.isCharacterInZone(mostHated))
if ((mostHated != null) && (npc.calculateDistance3D(mostHated) < 1000) && zone.isCharacterInZone(mostHated))
{
mob.setTarget(mostHated);
mob.doCast(SPEAR_ATTACK.getSkill());
@@ -673,7 +673,7 @@ public final class Baium extends AbstractNpcAI
for (int i = 0; i < 3; i++)
{
final L2Character attacker = vars.getObject("c_quest" + i, L2Character.class);
if ((attacker == null) || (npc.calculateDistance(attacker, true, false) > 9000) || attacker.isDead())
if ((attacker == null) || (npc.calculateDistance3D(attacker) > 9000) || attacker.isDead())
{
vars.set("i_quest" + i, 0);
}

View File

@@ -629,7 +629,7 @@ public final class Beleth extends AbstractNpcAI
{
if (!player.isDead())
{
final double distance2 = npc.calculateDistance(player, false, false);
final double distance2 = npc.calculateDistance2D(player);
if ((distance2 > 890) && !npc.isMovementDisabled())
{
npc.setTarget(player);
@@ -709,7 +709,7 @@ public final class Beleth extends AbstractNpcAI
return null;
}
final double distance = npc.calculateDistance(attacker, false, false);
final double distance = npc.calculateDistance2D(attacker);
if ((distance > 500) || (getRandom(100) < 80))
{
for (L2Npc beleth : _minions)

View File

@@ -207,7 +207,7 @@ public final class Orfen extends AbstractNpcAI
for (int i = 0; i < MINIONS.size(); i++)
{
final L2Attackable mob = MINIONS.get(i);
if (!npc.isInsideRadius(mob, 3000, false, false))
if (!npc.isInsideRadius2D(mob, 3000))
{
mob.teleToLocation(npc.getLocation());
((L2Attackable) npc).clearAggroList();
@@ -242,7 +242,7 @@ public final class Orfen extends AbstractNpcAI
if (npc.getId() == ORFEN)
{
final L2Character originalCaster = isSummon ? caster.getSummon() : caster;
if ((skill.getEffectPoint() > 0) && (getRandom(5) == 0) && npc.isInsideRadius(originalCaster, 1000, false, false))
if ((skill.getEffectPoint() > 0) && (getRandom(5) == 0) && npc.isInsideRadius2D(originalCaster, 1000))
{
final NpcSay packet = new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), TEXT[getRandom(4)]);
packet.addStringParameter(caster.getName());
@@ -297,7 +297,7 @@ public final class Orfen extends AbstractNpcAI
_IsTeleported = true;
setSpawnPoint(npc, 0);
}
else if (npc.isInsideRadius(attacker, 1000, false, false) && !npc.isInsideRadius(attacker, 300, false, false) && (getRandom(10) == 0))
else if (npc.isInsideRadius2D(attacker, 1000) && !npc.isInsideRadius2D(attacker, 300) && (getRandom(10) == 0))
{
final NpcSay packet = new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npcId, TEXT[getRandom(3)]);
packet.addStringParameter(attacker.getName());

View File

@@ -387,7 +387,7 @@ public final class QueenAnt extends AbstractNpcAI
_task.cancel(false);
_task = null;
}
else if (_queen.calculateDistance(QUEEN_X, QUEEN_Y, QUEEN_Z, false, false) > 2000.)
else if (_queen.calculateDistance2D(QUEEN_X, QUEEN_Y, QUEEN_Z) > 2000.)
{
_queen.clearAggroList();
_queen.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(QUEEN_X, QUEEN_Y, QUEEN_Z, 0));

View File

@@ -121,7 +121,7 @@ public final class Sailren extends AbstractNpcAI
_lastAttack = System.currentTimeMillis();
for (L2PcInstance member : player.getParty().getMembers())
{
if (member.isInsideRadius(npc, 1000, true, false))
if (member.isInsideRadius3D(npc, 1000))
{
member.teleToLocation(27549, -6638, -2008);
}

View File

@@ -116,7 +116,7 @@ public final class Epidos extends AbstractNpcAI
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
if (npc.isInsideRadius(-45474, 247450, -13994, 2000, true, false))
if (npc.isInsideRadius3D(-45474, 247450, -13994, 2000))
{
addSpawn(32376, -45482, 246277, -14184, 0, false, 0, false);
}

View File

@@ -55,7 +55,7 @@ public class FairyTrees extends AbstractNpcAI
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
if (npc.calculateDistance(killer, true, false) <= MIN_DISTANCE)
if (npc.calculateDistance3D(killer) <= MIN_DISTANCE)
{
for (int i = 0; i < 20; i++)
{

View File

@@ -242,7 +242,7 @@ public final class CabaleBuffer extends AbstractNpcAI
*/
private boolean handleCast(L2PcInstance player, int skillId)
{
if (player.isDead() || !player.isSpawned() || !_npc.isInsideRadius(player, DISTANCE_TO_WATCH_OBJECT, false, false))
if (player.isDead() || !player.isSpawned() || !_npc.isInsideRadius2D(player, DISTANCE_TO_WATCH_OBJECT))
{
return false;
}

View File

@@ -61,7 +61,7 @@ public final class PrisonGuards extends AbstractNpcAI
}
else if (event.equals("CHECK_HOME"))
{
if ((npc.calculateDistance(npc.getSpawn().getLocation(), false, false) > 10) && !npc.isInCombat() && !npc.isDead())
if ((npc.calculateDistance2D(npc.getSpawn().getLocation()) > 10) && !npc.isInCombat() && !npc.isDead())
{
npc.teleToLocation(npc.getSpawn().getLocation());
}
@@ -77,7 +77,7 @@ public final class PrisonGuards extends AbstractNpcAI
{
if (player.isAffectedBySkill(TIMER))
{
if ((getRandom(100) < 10) && (npc.calculateDistance(player, true, false) < 100))
if ((getRandom(100) < 10) && (npc.calculateDistance3D(player) < 100))
{
if ((getQuestItemsCount(player, STAMP) <= 3) && npc.isScriptValue(0))
{
@@ -96,7 +96,7 @@ public final class PrisonGuards extends AbstractNpcAI
}
else
{
if (!player.isAffectedBySkill(TIMER) && (npc.calculateDistance(npc.getSpawn().getLocation(), false, false) < 2000))
if (!player.isAffectedBySkill(TIMER) && (npc.calculateDistance2D(npc.getSpawn().getLocation()) < 2000))
{
npc.setTarget(player);
npc.doCast(STONE.getSkill());

View File

@@ -87,7 +87,7 @@ public final class RandomSpawn extends AbstractNpcAI
{
final Location[] spawnlist = SPAWN_POINTS.get(npc.getId());
final Location loc = spawnlist[getRandom(spawnlist.length)];
if (!npc.isInsideRadius(loc, 200, false, false))
if (!npc.isInsideRadius2D(loc, 200))
{
npc.getSpawn().setLocation(loc);
ThreadPool.schedule(new Teleport(npc, loc), 100);

View File

@@ -103,7 +103,7 @@ public class SiegeGuards extends AbstractNpcAI
if ((npc != null) && !npc.isDead())
{
final L2Object target = npc.getTarget();
if (!npc.isInCombat() || (target == null) || (npc.calculateDistance(target, false, false) > npc.getAggroRange()))
if (!npc.isInCombat() || (target == null) || (npc.calculateDistance2D(target) > npc.getAggroRange()))
{
for (L2Character nearby : L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange()))
{

View File

@@ -80,7 +80,7 @@ public final class SteelCitadelTeleport extends AbstractNpcAI
for (L2PcInstance pl : party.getMembers())
{
if (pl.isInsideRadius(npc.getX(), npc.getY(), npc.getZ(), 3000, true, false))
if (pl.isInsideRadius3D(npc.getX(), npc.getY(), npc.getZ(), 3000))
{
zone.allowPlayerEntry(pl, 30);
pl.teleToLocation(TELEPORT_CITADEL, true);

View File

@@ -340,7 +340,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
final L2PcInstance seller = L2World.getInstance().getPlayer(objId);
if (seller != null)
{
if (!seller.isSellingBuffs() || !activeChar.isInsideRadius(seller, L2Npc.INTERACTION_DISTANCE, true, true))
if (!seller.isSellingBuffs() || !activeChar.isInsideRadius3D(seller, L2Npc.INTERACTION_DISTANCE))
{
return false;
}

View File

@@ -217,7 +217,7 @@ public final class Rabbits extends Event
}
else if (skill.getId() == RABBIT_MAGIC_EYE.getSkillId())
{
if (npc.isInvisible() && npc.isInsideRadius(caster, skill.getAffectRange(), false, false))
if (npc.isInvisible() && npc.isInsideRadius2D(caster, skill.getAffectRange()))
{
npc.setInvisible(false);
}

View File

@@ -165,7 +165,7 @@ public final class Race extends Event
{
if (player.isOnline())
{
if (player.isInsideRadius(_npc, 500, false, false))
if (player.isInsideRadius2D(_npc, 500))
{
sendMessage(player, "Race started! Go find Finish NPC as fast as you can... He is located near " + _locations[location]);
transformPlayer(player);

View File

@@ -52,7 +52,7 @@ public class L2DoorInstanceAction implements IActionHandler
}
else if ((activeChar.getClan() != null) && (door.getClanHall() != null) && (activeChar.getClanId() == door.getClanHall().getOwnerId()))
{
if (!door.isInsideRadius(activeChar, L2Npc.INTERACTION_DISTANCE, false, false))
if (!door.isInsideRadius2D(activeChar, L2Npc.INTERACTION_DISTANCE))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -71,7 +71,7 @@ public class L2DoorInstanceAction implements IActionHandler
}
else if ((activeChar.getClan() != null) && (((L2DoorInstance) target).getFort() != null) && (activeChar.getClan() == ((L2DoorInstance) target).getFort().getOwnerClan()) && ((L2DoorInstance) target).isOpenableBySkill() && !((L2DoorInstance) target).getFort().getSiege().isInProgress())
{
if (!((L2Character) target).isInsideRadius(activeChar, L2Npc.INTERACTION_DISTANCE, false, false))
if (!((L2Character) target).isInsideRadius2D(activeChar, L2Npc.INTERACTION_DISTANCE))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}

View File

@@ -65,7 +65,7 @@ public class L2PetInstanceAction implements IActionHandler
activeChar.onActionRequest();
}
}
else if (!((L2Character) target).isInsideRadius(activeChar, 150, false, false))
else if (!((L2Character) target).isInsideRadius2D(activeChar, 150))
{
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
{

View File

@@ -46,7 +46,7 @@ public class L2StaticObjectInstanceAction implements IActionHandler
else if (interact)
{
// Calculate the distance between the L2PcInstance and the L2NpcInstance
if (!activeChar.isInsideRadius(staticObject, L2Npc.INTERACTION_DISTANCE, false, false))
if (!activeChar.isInsideRadius2D(staticObject, L2Npc.INTERACTION_DISTANCE))
{
// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, staticObject);

View File

@@ -68,7 +68,7 @@ public class L2SummonAction implements IActionHandler
{
// This Action Failed packet avoids activeChar getting stuck when clicking three or more times
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
if (((L2Summon) target).isInsideRadius(activeChar, 150, false, false))
if (((L2Summon) target).isInsideRadius2D(activeChar, 150))
{
activeChar.updateNotMoveUntil();
}

View File

@@ -101,8 +101,8 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%heading%", String.valueOf(((L2Character) target).getHeading()));
html.replace("%collision_radius%", String.valueOf(((L2Character) target).getTemplate().getfCollisionRadius()));
html.replace("%collision_height%", String.valueOf(((L2Character) target).getTemplate().getfCollisionHeight()));
html.replace("%loc2d%", String.valueOf((int) activeChar.calculateDistance(target, false, false)));
html.replace("%loc3d%", String.valueOf((int) activeChar.calculateDistance(target, true, false)));
html.replace("%loc2d%", String.valueOf((int) activeChar.calculateDistance2D(target)));
html.replace("%loc3d%", String.valueOf((int) activeChar.calculateDistance3D(target)));
final byte attackAttribute = ((L2Character) target).getAttackElement();
html.replace("%ele_atk%", Elementals.getElementName(attackAttribute));

View File

@@ -133,7 +133,7 @@ public class AdminScan implements IAdminCommandHandler
sb.append("<tr>");
sb.append("<td width=\"54\">" + character.getId() + "</td>");
sb.append("<td width=\"54\">" + character.getName() + "</td>");
sb.append("<td width=\"54\">" + Math.round(activeChar.calculateDistance(character, false, false)) + "</td>");
sb.append("<td width=\"54\">" + Math.round(activeChar.calculateDistance2D(character)) + "</td>");
sb.append("<td width=\"54\"><a action=\"bypass -h admin_deleteNpcByObjectId " + character.getObjectId() + "\"><font color=\"LEVEL\">Delete</font></a></td>");
sb.append("<td width=\"54\"><a action=\"bypass -h admin_move_to " + character.getX() + " " + character.getY() + " " + character.getZ() + "\"><font color=\"LEVEL\">Go to</font></a></td>");
sb.append("</tr>");

View File

@@ -65,7 +65,7 @@ public class OlympiadObservation implements IBypassHandler
return false;
}
if (!activeChar.inObserverMode() && !activeChar.isInsideRadius(olymanager, 300, false, false))
if (!activeChar.inObserverMode() && !activeChar.isInsideRadius2D(olymanager, 300))
{
return false;
}

View File

@@ -44,7 +44,7 @@ public class Ground implements ITargetTypeHandler
L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, character ->
{
if ((character != null) && character.isInsideRadius(player.getCurrentSkillWorldPosition(), skill.getAffectRange(), false, false))
if ((character != null) && character.isInsideRadius2D(player.getCurrentSkillWorldPosition(), skill.getAffectRange()))
{
if (!Skill.checkForAreaOffensiveSkills(activeChar, character, skill, srcInArena))
{

View File

@@ -238,7 +238,7 @@ public final class CavernOfThePirateCaptain extends AbstractInstance
return false;
}
if (!player.isInsideRadius(groupMembers, 1000, true, true))
if (!player.isInsideRadius3D(groupMembers, 1000))
{
broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED, true);
return false;
@@ -381,7 +381,7 @@ public final class CavernOfThePirateCaptain extends AbstractInstance
{
for (L2PcInstance playersInside : world.getParameters().getList("playersInside", L2PcInstance.class))
{
if ((playersInside != null) && ((playersInside.getInstanceId() == world.getInstanceId()) && playersInside.isInsideRadius(npc, 1500, true, true)))
if ((playersInside != null) && ((playersInside.getInstanceId() == world.getInstanceId()) && playersInside.isInsideRadius3D(npc, 1500)))
{
final long time = System.currentTimeMillis() - world.getParameters().getLong("storeTime", 0);
if (time <= 300000) // 5 minutes

View File

@@ -255,7 +255,7 @@ public final class DarkCloudMansion extends AbstractInstance
player.sendPacket(sm);
return false;
}
if (!partyMember.isInsideRadius(player, 1000, true, true))
if (!partyMember.isInsideRadius3D(player, 1000))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
sm.addPcName(partyMember);

View File

@@ -654,7 +654,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
case "LEADER_DASH":
{
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
if (getRandomBoolean() && !npc.isCastingNow() && (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) < 1000))
if (getRandomBoolean() && !npc.isCastingNow() && (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance3D(mostHated) < 1000))
{
npc.setTarget(mostHated);
npc.doCast(LEADER_RUSH.getSkill());
@@ -801,13 +801,13 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) <= 800);
final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance3D(mostHated) <= 800);
if (getRandom(10000) < 3333)
{
if (getRandomBoolean())
{
if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow())
if ((npc.calculateDistance3D(attacker) <= 800) && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow())
{
npc.setTarget(attacker);
npc.doCast(ICE_BALL.getSkill());
@@ -826,7 +826,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
{
if (getRandomBoolean())
{
if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(SUMMON_ELEMENTAL.getSkill()) && !npc.isCastingNow())
if ((npc.calculateDistance3D(attacker) <= 800) && npc.checkDoCastConditions(SUMMON_ELEMENTAL.getSkill()) && !npc.isCastingNow())
{
npc.setTarget(attacker);
npc.doCast(SUMMON_ELEMENTAL.getSkill());
@@ -891,13 +891,13 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) <= 800);
final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance3D(mostHated) <= 800);
if (getRandom(10000) < 3333)
{
if (getRandomBoolean())
{
if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow())
if ((npc.calculateDistance3D(attacker) <= 800) && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow())
{
npc.setTarget(attacker);
npc.doCast(ICE_BALL.getSkill());
@@ -916,7 +916,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
{
if (getRandomBoolean())
{
if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(SUMMON_ELEMENTAL.getSkill()) && !npc.isCastingNow())
if ((npc.calculateDistance3D(attacker) <= 800) && npc.checkDoCastConditions(SUMMON_ELEMENTAL.getSkill()) && !npc.isCastingNow())
{
npc.setTarget(attacker);
npc.doCast(SUMMON_ELEMENTAL.getSkill());
@@ -1002,7 +1002,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
else if ((npc.getVariables().getInt("OFF_SHOUT") == 0) && (npc.getVariables().getInt("DELAY_VAL") == 1))
{
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) < 1000);
final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance3D(mostHated) < 1000);
if (npc.getVariables().getInt("TIMER_ON") == 0)
{

View File

@@ -470,7 +470,7 @@ public final class Kamaloka extends AbstractInstance
return false;
}
// player must be near party leader
if (!partyMember.isInsideRadius(player, 1000, true, true))
if (!partyMember.isInsideRadius3D(player, 1000))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
sm.addPcName(partyMember);

View File

@@ -79,7 +79,7 @@ public final class MithrilMine extends AbstractInstance
{
case "BUFF":
{
if ((player != null) && npc.isInsideRadius(player, 1000, true, false) && npc.isScriptValue(1) && !player.isDead())
if ((player != null) && npc.isInsideRadius3D(player, 1000) && npc.isScriptValue(1) && !player.isDead())
{
npc.setTarget(player);
npc.doCast(BLESS_OF_SWORD.getSkill());

View File

@@ -428,7 +428,7 @@ public final class NornilsGarden extends AbstractInstance
return "32330-06.html";
}
// player must be near party leader
if (!partyMember.isInsideRadius(player, 500, true, true))
if (!partyMember.isInsideRadius3D(player, 500))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
sm.addPcName(partyMember);

View File

@@ -636,7 +636,7 @@ public abstract class AbstractSagaQuest extends Quest
for (L2PcInstance player1 : party.getMembers())
{
final QuestState st1 = findQuest(player1);
if ((st1 != null) && player1.isInsideRadius(player, Config.ALT_PARTY_RANGE2, false, false))
if ((st1 != null) && player1.isInsideRadius2D(player, Config.ALT_PARTY_RANGE2))
{
if (st1.isCond(15))
{

View File

@@ -174,7 +174,7 @@ public final class Q00193_SevenSignsDyingMessage extends Quest
}
case "heal":
{
if (!npc.isInsideRadius(player, 600, true, false))
if (!npc.isInsideRadius3D(player, 600))
{
final NpcSay ns = new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LOOK_HERE_S1_DON_T_FALL_TOO_FAR_BEHIND);
ns.addStringParameter(player.getName());
@@ -219,7 +219,7 @@ public final class Q00193_SevenSignsDyingMessage extends Quest
}
final QuestState qs = getQuestState(partyMember, false);
if (npc.isInsideRadius(partyMember, 1500, true, false))
if (npc.isInsideRadius3D(partyMember, 1500))
{
giveItems(player, SCULPTURE_OF_DOUBT, 1);
playSound(player, QuestSound.ITEMSOUND_QUEST_FINISH);

View File

@@ -230,7 +230,7 @@ public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest
}
final QuestState qs = getQuestState(partyMember, false);
if (npc.isInsideRadius(partyMember, 1500, true, false))
if (npc.isInsideRadius3D(partyMember, 1500))
{
giveItems(player, SCULPTURE_OF_DOUBT, 1);
playSound(player, QuestSound.ITEMSOUND_QUEST_FINISH);

View File

@@ -118,7 +118,7 @@ public final class Q00198_SevenSignsEmbryo extends Quest
}
case "heal":
{
if (!npc.isInsideRadius(player, 600, true, false))
if (!npc.isInsideRadius3D(player, 600))
{
final NpcSay ns = new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LOOK_HERE_S1_DON_T_FALL_TOO_FAR_BEHIND);
ns.addStringParameter(player.getName());
@@ -172,7 +172,7 @@ public final class Q00198_SevenSignsEmbryo extends Quest
}
final QuestState qs = getQuestState(partyMember, false);
if (npc.isInsideRadius(partyMember, 1500, true, false))
if (npc.isInsideRadius3D(partyMember, 1500))
{
giveItems(partyMember, SCULPTURE_OF_DOUBT, 1);
qs.setCond(2, true);

View File

@@ -385,7 +385,7 @@ public class Q00348_AnArrogantSearch extends Quest
case PLATINUM_TRIBE_SHAMAN:
{
final QuestState st = getRandomPartyMemberState(attacker, -1, 3, npc);
if ((st != null) && npc.isInsideRadius(attacker, 1500, true, false))
if ((st != null) && npc.isInsideRadius3D(attacker, 1500))
{
if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1))
{
@@ -419,7 +419,7 @@ public class Q00348_AnArrogantSearch extends Quest
case PLATINUM_TRIBE_OVERLORD:
{
final QuestState st = getRandomPartyMemberState(attacker, -1, 3, npc);
if ((st != null) && npc.isInsideRadius(attacker, 1500, true, false))
if ((st != null) && npc.isInsideRadius3D(attacker, 1500))
{
if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1))
{
@@ -458,13 +458,13 @@ public class Q00348_AnArrogantSearch extends Quest
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
final QuestState st = getRandomPartyMemberState(player, -1, 3, npc);
if ((st != null) && npc.isInsideRadius(player, 1500, true, false))
if ((st != null) && npc.isInsideRadius3D(player, 1500))
{
switch (npc.getId())
{
case ARK_GUARDIAN_ELBEROTH:
{
if (npc.isInsideRadius(player, 1500, true, false))
if (npc.isInsideRadius3D(player, 1500))
{
if ((st.getMemoStateEx(0) < 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 1) && !hasQuestItems(st.getPlayer(), SECOND_KEY_OF_ARK) && !hasQuestItems(st.getPlayer(), BOOK_OF_SAINT))
{
@@ -483,7 +483,7 @@ public class Q00348_AnArrogantSearch extends Quest
}
case ARK_GUARDIAN_SHADOWFANG:
{
if (npc.isInsideRadius(player, 1500, true, false))
if (npc.isInsideRadius3D(player, 1500))
{
if ((st.getMemoStateEx(0) < 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 1) && !hasQuestItems(st.getPlayer(), THIRD_KEY_OF_ARK) && !hasQuestItems(st.getPlayer(), BOUGH_OF_SAINT))
{
@@ -503,7 +503,7 @@ public class Q00348_AnArrogantSearch extends Quest
case YINTZU:
case PALIOTE:
{
if (npc.isInsideRadius(player, 1500, true, false) && st.isMemoState(1) && !hasQuestItems(st.getPlayer(), SHELL_OF_MONSTERS))
if (npc.isInsideRadius3D(player, 1500) && st.isMemoState(1) && !hasQuestItems(st.getPlayer(), SHELL_OF_MONSTERS))
{
giveItems(st.getPlayer(), SHELL_OF_MONSTERS, 1);
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);

View File

@@ -94,7 +94,7 @@ public class Q00423_TakeYourBestShot extends Quest
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
if (npc.isInsideRadius(96782, 85918, 0, 100, false, true))
if (npc.isInsideRadius2D(96782, 85918, 0, 100))
{
return "32740-ugoros.html";
}

View File

@@ -113,7 +113,7 @@ public final class Q00457_LostAndFound extends Quest
}
case "CHECK":
{
final double distance = npc.calculateDistance(player, true, false);
final double distance = npc.calculateDistance3D(player);
if (distance > 1000)
{
if (distance > 5000)
@@ -140,7 +140,7 @@ public final class Q00457_LostAndFound extends Quest
for (L2Spawn escortSpawn : _escortCheckers)
{
final L2Npc escort = escortSpawn.getLastSpawn();
if ((escort != null) && npc.isInsideRadius(escort, 1000, false, false))
if ((escort != null) && npc.isInsideRadius2D(escort, 1000))
{
startQuestTimer("STOP", 1000, npc, player);
startQuestTimer("BYE", 3000, npc, player);

View File

@@ -149,7 +149,7 @@ public class Q00508_AClansReputation extends Quest
else
{
final L2PcInstance pleader = player.getClan().getLeader().getPlayerInstance();
if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false))
if ((pleader != null) && player.isInsideRadius3D(pleader, 1500))
{
qs = pleader.getQuestState(getName());
}

View File

@@ -132,7 +132,7 @@ public class Q00509_AClansFame extends Quest
else
{
final L2PcInstance pleader = player.getClan().getLeader().getPlayerInstance();
if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false))
if ((pleader != null) && player.isInsideRadius3D(pleader, 1500))
{
qs = pleader.getQuestState(getName());
}

View File

@@ -94,7 +94,7 @@ public class Q00510_AClansPrestige extends Quest
else
{
final L2PcInstance pleader = player.getClan().getLeader().getPlayerInstance();
if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false))
if ((pleader != null) && player.isInsideRadius3D(pleader, 1500))
{
qs = getQuestState(pleader, false);
}

View File

@@ -100,7 +100,7 @@ public final class Q00624_TheFinestIngredientsPart1 extends Quest
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
final L2PcInstance partyMember = getRandomPartyMember(killer, 1);
if ((partyMember != null) && partyMember.isInsideRadius(npc, 1500, true, false))
if ((partyMember != null) && partyMember.isInsideRadius3D(npc, 1500))
{
final int item = MONSTER_DROPS.get(npc.getId());
final long count = getQuestItemsCount(partyMember, item);

View File

@@ -183,7 +183,7 @@ public class Q00708_PathToBecomingALordGludio extends Quest
}
else if (isLordAvailable(2, qs))
{
if (castleOwner.calculateDistance(npc, false, false) <= 200)
if (castleOwner.calculateDistance2D(npc) <= 200)
{
htmltext = "sayres_q708_07.htm";
}

View File

@@ -179,7 +179,7 @@ public class Q00709_PathToBecomingALordDion extends Quest
}
else if (isLordAvailable(2, qs))
{
if (castleOwner.calculateDistance(npc, false, false) <= 200)
if (castleOwner.calculateDistance2D(npc) <= 200)
{
htmltext = "crosby_q709_05.htm";
}

View File

@@ -149,7 +149,7 @@ public class Q00711_PathToBecomingALordInnadril extends Quest
}
else if (isLordAvailable(2, qs))
{
if (castleOwner.calculateDistance(npc, false, false) <= 200)
if (castleOwner.calculateDistance2D(npc) <= 200)
{
htmltext = "neurath_q711_07.htm";
}

View File

@@ -146,7 +146,7 @@ public class Q00716_PathToBecomingALordRune extends Quest
}
else if ((castleOwner != null) && (castleOwner != qs.getPlayer()) && (castleOwner.getQuestState(Q00716_PathToBecomingALordRune.class.getSimpleName()) != null) && (castleOwner.getQuestState(Q00716_PathToBecomingALordRune.class.getSimpleName()).isCond(4)))
{
if (castleOwner.calculateDistance(npc, false, false) <= 200)
if (castleOwner.calculateDistance2D(npc) <= 200)
{
htmltext = "frederick_q716_07.htm";
}

View File

@@ -225,7 +225,7 @@ public class Q00726_LightWithinTheDarkness extends Quest
{
if (qs.isCond(1) && (npc.getId() == KANADIS_GUIDE3))
{
if (!partymember.isDead() && partymember.isInsideRadius(npc, 1000, true, false))
if (!partymember.isDead() && partymember.isInsideRadius3D(npc, 1000))
{
if (qs.getInt("kanadis") == 0)
{
@@ -312,7 +312,7 @@ public class Q00726_LightWithinTheDarkness extends Quest
}
for (L2PcInstance partymember : party.getMembers())
{
if (!partymember.isInsideRadius(player, 1000, true, true))
if (!partymember.isInsideRadius3D(player, 1000))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
sm.addPcName(partymember);