Distance checking methods rework.
This commit is contained in:
+2
-2
@@ -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)
|
||||
|
||||
+3
-3
@@ -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)
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+3
-3
@@ -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);
|
||||
}
|
||||
|
||||
+3
-3
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
+5
-5
@@ -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)
|
||||
{
|
||||
|
||||
+3
-3
@@ -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";
|
||||
}
|
||||
|
||||
+1
-1
@@ -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());
|
||||
|
||||
Vendored
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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());
|
||||
|
||||
+6
-6
@@ -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;
|
||||
|
||||
+5
-5
@@ -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);
|
||||
}
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
+3
-3
@@ -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());
|
||||
|
||||
+1
-1
@@ -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));
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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++)
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
+3
-3
@@ -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());
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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()))
|
||||
{
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Vendored
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -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))
|
||||
{
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Vendored
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java
Vendored
+2
-2
@@ -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));
|
||||
|
||||
Vendored
+1
-1
@@ -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>");
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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))
|
||||
{
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Vendored
+1
-1
@@ -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);
|
||||
|
||||
+8
-8
@@ -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)
|
||||
{
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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());
|
||||
|
||||
Vendored
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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))
|
||||
{
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+6
-6
@@ -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);
|
||||
|
||||
+1
-1
@@ -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";
|
||||
}
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+1
-1
@@ -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());
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -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());
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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";
|
||||
}
|
||||
|
||||
+1
-1
@@ -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";
|
||||
}
|
||||
|
||||
+1
-1
@@ -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";
|
||||
}
|
||||
|
||||
+1
-1
@@ -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";
|
||||
}
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
@@ -103,9 +103,9 @@ public abstract class AbstractAI implements Ctrl
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_actor.isInsideRadius(followTarget, _range, true, false))
|
||||
if (!_actor.isInsideRadius3D(followTarget, _range))
|
||||
{
|
||||
if (!_actor.isInsideRadius(followTarget, 3000, true, false))
|
||||
if (!_actor.isInsideRadius3D(followTarget, 3000))
|
||||
{
|
||||
// if the target is too far (maybe also teleported)
|
||||
if (_actor.isSummon())
|
||||
|
||||
@@ -194,7 +194,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
}
|
||||
|
||||
// Check if the target isn't dead, is in the Aggro range and is at the same height
|
||||
if (target.isAlikeDead() || (target.isPlayable() && !me.isInsideRadius(target, me.getAggroRange(), true, false)))
|
||||
if (target.isAlikeDead() || (target.isPlayable() && !me.isInsideRadius3D(target, me.getAggroRange())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
return false;
|
||||
}
|
||||
|
||||
if (me.isChaos() && me.isInsideRadius(target, me.getAggroRange(), false, false))
|
||||
if (me.isChaos() && me.isInsideRadius2D(target, me.getAggroRange()))
|
||||
{
|
||||
if (((L2Attackable) target).isInMyClan(me))
|
||||
{
|
||||
@@ -351,7 +351,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
{
|
||||
intention = AI_INTENTION_ACTIVE;
|
||||
}
|
||||
else if ((npc.getSpawn() != null) && !npc.isInsideRadius(npc.getSpawn().getLocation(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE, true, false))
|
||||
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn().getLocation(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
|
||||
{
|
||||
intention = AI_INTENTION_ACTIVE;
|
||||
}
|
||||
@@ -502,7 +502,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
|
||||
{
|
||||
final int hating = npc.getHating(t);
|
||||
final double distance = npc.calculateDistance(t, false, false);
|
||||
final double distance = npc.calculateDistance2D(t);
|
||||
if ((hating == 0) && (closestDistance > distance))
|
||||
{
|
||||
nearestTarget = t;
|
||||
@@ -521,7 +521,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
final L2ItemInstance droppedItem = npc.getFakePlayerDrops().get(itemIndex);
|
||||
if ((droppedItem != null) && droppedItem.isSpawned())
|
||||
{
|
||||
if (npc.calculateDistance(droppedItem, false, false) > 50)
|
||||
if (npc.calculateDistance2D(droppedItem) > 50)
|
||||
{
|
||||
moveTo(droppedItem);
|
||||
}
|
||||
@@ -681,7 +681,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
npc.setWalking();
|
||||
}
|
||||
|
||||
if (npc.calculateDistance(leader, false, true) > (offset * offset))
|
||||
if (npc.calculateDistanceSq2D(leader) > (offset * offset))
|
||||
{
|
||||
int x1 = Rnd.get(minRadius * 2, offset * 2); // x
|
||||
int y1 = Rnd.get(x1, offset * 2); // distance
|
||||
@@ -725,7 +725,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
y1 = npc.getSpawn().getY();
|
||||
z1 = npc.getSpawn().getZ();
|
||||
|
||||
if (!npc.isInsideRadius(x1, y1, 0, range, false, false))
|
||||
if (!npc.isInsideRadius2D(x1, y1, 0, range))
|
||||
{
|
||||
npc.setisReturningToSpawnPoint(true);
|
||||
}
|
||||
@@ -891,14 +891,14 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
{
|
||||
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||
{
|
||||
if (npc.isInsideRadius(nearby, collision, false, false) && (nearby != mostHate))
|
||||
if (npc.isInsideRadius2D(nearby, collision) && (nearby != mostHate))
|
||||
{
|
||||
int newX = combinedCollision + Rnd.get(40);
|
||||
newX = Rnd.nextBoolean() ? mostHate.getX() + newX : mostHate.getX() - newX;
|
||||
int newY = combinedCollision + Rnd.get(40);
|
||||
newY = Rnd.nextBoolean() ? mostHate.getY() + newY : mostHate.getY() - newY;
|
||||
|
||||
if (!npc.isInsideRadius(newX, newY, 0, collision, false, false))
|
||||
if (!npc.isInsideRadius2D(newX, newY, 0, collision))
|
||||
{
|
||||
final int newZ = npc.getZ() + 30;
|
||||
|
||||
@@ -915,7 +915,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
if (Rnd.get(100) <= npc.getDodge())
|
||||
{
|
||||
// Micht: Keeping this one otherwise we should do 2 sqrt
|
||||
double distance2 = npc.calculateDistance(mostHate, false, true);
|
||||
double distance2 = npc.calculateDistanceSq2D(mostHate);
|
||||
if (Math.sqrt(distance2) <= (60 + combinedCollision))
|
||||
{
|
||||
int posX = npc.getX();
|
||||
@@ -1208,7 +1208,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
}
|
||||
}
|
||||
|
||||
final double dist = npc.calculateDistance(mostHate, false, false);
|
||||
final double dist = npc.calculateDistance2D(mostHate);
|
||||
final int dist2 = (int) dist - collision;
|
||||
int range = npc.getPhysicalAttackRange() + combinedCollision;
|
||||
if (mostHate.isMoving())
|
||||
@@ -1298,7 +1298,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
return false;
|
||||
}
|
||||
|
||||
final double dist = caster.calculateDistance(attackTarget, false, false);
|
||||
final double dist = caster.calculateDistance2D(attackTarget);
|
||||
double dist2 = dist - attackTarget.getTemplate().getCollisionRadius();
|
||||
final double range = caster.getPhysicalAttackRange() + caster.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
|
||||
final double srange = sk.getCastRange() + caster.getTemplate().getCollisionRadius();
|
||||
@@ -1761,7 +1761,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
npc.setTarget(target);
|
||||
}
|
||||
|
||||
final double dist = npc.calculateDistance(target, false, false);
|
||||
final double dist = npc.calculateDistance2D(target);
|
||||
final int range = npc.getPhysicalAttackRange() + npc.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
|
||||
// TODO(Zoey76): Review this "magic changes".
|
||||
final int random = Rnd.get(100);
|
||||
@@ -1896,7 +1896,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
try
|
||||
{
|
||||
actor.setTarget(getAttackTarget());
|
||||
dist = actor.calculateDistance(obj, false, false);
|
||||
dist = actor.calculateDistance2D(obj);
|
||||
dist2 = dist - actor.getTemplate().getCollisionRadius();
|
||||
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
|
||||
if (obj.isMoving())
|
||||
@@ -1925,7 +1925,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
try
|
||||
{
|
||||
actor.setTarget(getAttackTarget());
|
||||
dist = actor.calculateDistance(obj, false, false);
|
||||
dist = actor.calculateDistance2D(obj);
|
||||
dist2 = dist;
|
||||
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
|
||||
if (obj.isMoving())
|
||||
@@ -1964,7 +1964,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
try
|
||||
{
|
||||
actor.setTarget(getAttackTarget());
|
||||
dist = actor.calculateDistance(targets, false, false);
|
||||
dist = actor.calculateDistance2D(targets);
|
||||
dist2 = dist - actor.getTemplate().getCollisionRadius();
|
||||
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + targets.getTemplate().getCollisionRadius();
|
||||
if (targets.isMoving())
|
||||
@@ -1997,7 +1997,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
try
|
||||
{
|
||||
actor.setTarget(getAttackTarget());
|
||||
dist = actor.calculateDistance(obj, false, false);
|
||||
dist = actor.calculateDistance2D(obj);
|
||||
dist2 = dist - actor.getTemplate().getCollisionRadius();
|
||||
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
|
||||
if (obj.isMoving())
|
||||
@@ -2036,7 +2036,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
try
|
||||
{
|
||||
actor.setTarget(getAttackTarget());
|
||||
dist = actor.calculateDistance(obj, false, false);
|
||||
dist = actor.calculateDistance2D(obj);
|
||||
dist2 = dist - actor.getTemplate().getCollisionRadius();
|
||||
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
|
||||
// if(obj.isMoving())
|
||||
@@ -2060,7 +2060,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
try
|
||||
{
|
||||
actor.setTarget(getAttackTarget());
|
||||
dist = actor.calculateDistance(target, false, false);
|
||||
dist = actor.calculateDistance2D(target);
|
||||
dist2 = dist;
|
||||
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
|
||||
// if(obj.isMoving())
|
||||
@@ -2113,7 +2113,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
}
|
||||
try
|
||||
{
|
||||
dist = actor.calculateDistance(obj, false, false);
|
||||
dist = actor.calculateDistance2D(obj);
|
||||
dist2 = dist - actor.getTemplate().getCollisionRadius();
|
||||
range = actor.getPhysicalAttackRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
|
||||
if (obj.isMoving())
|
||||
|
||||
@@ -926,7 +926,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
return false; // skill radius -1
|
||||
}
|
||||
|
||||
if (!_actor.isInsideRadius(worldPosition, offset + _actor.getTemplate().getCollisionRadius(), false, false))
|
||||
if (!_actor.isInsideRadius2D(worldPosition, offset + _actor.getTemplate().getCollisionRadius()))
|
||||
{
|
||||
if (_actor.isMovementDisabled())
|
||||
{
|
||||
@@ -1003,13 +1003,13 @@ public class L2CharacterAI extends AbstractAI
|
||||
offset += ((L2Character) target).getTemplate().getCollisionRadius();
|
||||
}
|
||||
|
||||
if (!_actor.isInsideRadius(target, offset, false, false))
|
||||
if (!_actor.isInsideRadius2D(target, offset))
|
||||
{
|
||||
// Caller should be L2Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
|
||||
if (getFollowTarget() != null)
|
||||
{
|
||||
// allow larger hit range when the target is moving (check is run only once per second)
|
||||
if (!_actor.isInsideRadius(target, offset + 100, false, false))
|
||||
if (!_actor.isInsideRadius2D(target, offset + 100))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
+5
-5
@@ -195,7 +195,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
final L2ControllableMobAI ctrlAi = (L2ControllableMobAI) theTarget.getAI();
|
||||
ctrlAi.forceAttack(_actor);
|
||||
|
||||
final double dist2 = _actor.calculateDistance(target, false, true);
|
||||
final double dist2 = _actor.calculateDistanceSq2D(target);
|
||||
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
|
||||
int max_range = range;
|
||||
|
||||
@@ -235,7 +235,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
}
|
||||
|
||||
_actor.setTarget(getForcedTarget());
|
||||
final double dist2 = _actor.calculateDistance(getForcedTarget(), false, true);
|
||||
final double dist2 = _actor.calculateDistanceSq2D(getForcedTarget());
|
||||
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
|
||||
int max_range = range;
|
||||
|
||||
@@ -289,7 +289,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_actor.isInsideRadius(npc, npc.getTemplate().getClanHelpRange(), true, true))
|
||||
if (_actor.isInsideRadius3D(npc, npc.getTemplate().getClanHelpRange()))
|
||||
{
|
||||
npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
|
||||
}
|
||||
@@ -297,7 +297,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
}
|
||||
|
||||
_actor.setTarget(getAttackTarget());
|
||||
final double dist2 = _actor.calculateDistance(getAttackTarget(), false, true);
|
||||
final double dist2 = _actor.calculateDistanceSq2D(getAttackTarget());
|
||||
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
|
||||
int max_range = range;
|
||||
|
||||
@@ -394,7 +394,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
}
|
||||
|
||||
final L2Attackable me = getActiveChar();
|
||||
if (!me.isInsideRadius(target, me.getAggroRange(), false, false) || (Math.abs(_actor.getZ() - target.getZ()) > 100))
|
||||
if (!me.isInsideRadius2D(target, me.getAggroRange()) || (Math.abs(_actor.getZ() - target.getZ()) > 100))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class L2DoorAI extends L2CharacterAI
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObject(_door, L2DefenderInstance.class, guard ->
|
||||
{
|
||||
if (_actor.isInsideRadius(guard, guard.getTemplate().getClanHelpRange(), true, true))
|
||||
if (_actor.isInsideRadius3D(guard, guard.getTemplate().getClanHelpRange()))
|
||||
{
|
||||
guard.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, _attacker, 15);
|
||||
}
|
||||
|
||||
@@ -152,12 +152,12 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
if (target.isSummon())
|
||||
{
|
||||
final L2PcInstance owner = ((L2Summon) target).getOwner();
|
||||
if (_actor.isInsideRadius(owner, 1000, true, false))
|
||||
if (_actor.isInsideRadius3D(owner, 1000))
|
||||
{
|
||||
target = owner;
|
||||
}
|
||||
}
|
||||
return (!target.isPlayable() || !((L2Playable) target).isSilentMovingAffected() || _actor.isInsideRadius(target, 250, false, false)) && _actor.isAutoAttackable(target) && GeoEngine.getInstance().canSeeTarget(_actor, target);
|
||||
return (!target.isPlayable() || !((L2Playable) target).isSilentMovingAffected() || _actor.isInsideRadius2D(target, 250)) && _actor.isAutoAttackable(target) && GeoEngine.getInstance().canSeeTarget(_actor, target);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -398,7 +398,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
|
||||
if (npc.getAI() != null) // TODO: possibly check not needed
|
||||
{
|
||||
if (!npc.isDead() && (Math.abs(target.getZ() - npc.getZ()) < 600) && ((npc.getAI()._intention == AI_INTENTION_IDLE) || (npc.getAI()._intention == AI_INTENTION_ACTIVE)) && target.isInsideRadius(npc, 1500, true, false) && GeoEngine.getInstance().canSeeTarget(npc, target))
|
||||
if (!npc.isDead() && (Math.abs(target.getZ() - npc.getZ()) < 600) && ((npc.getAI()._intention == AI_INTENTION_IDLE) || (npc.getAI()._intention == AI_INTENTION_ACTIVE)) && target.isInsideRadius3D(npc, 1500) && GeoEngine.getInstance().canSeeTarget(npc, target))
|
||||
{
|
||||
// Notify the L2Object AI with EVT_AGGRESSION
|
||||
npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
|
||||
@@ -446,7 +446,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
_actor.setTarget(attackTarget);
|
||||
skills = _actor.getAllSkills();
|
||||
dist_2 = _actor.calculateDistance(attackTarget, false, true);
|
||||
dist_2 = _actor.calculateDistanceSq2D(attackTarget);
|
||||
range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
|
||||
if (attackTarget.isMoving())
|
||||
{
|
||||
|
||||
@@ -137,14 +137,14 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
if (target.isSummon())
|
||||
{
|
||||
final L2PcInstance owner = ((L2Summon) target).getOwner();
|
||||
if (_actor.isInsideRadius(owner, 1000, true, false))
|
||||
if (_actor.isInsideRadius3D(owner, 1000))
|
||||
{
|
||||
target = owner;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the target isn't in silent move mode AND too far (>100)
|
||||
if (target.isPlayable() && ((L2Playable) target).isSilentMovingAffected() && !_actor.isInsideRadius(target, 250, false, false))
|
||||
if (target.isPlayable() && ((L2Playable) target).isSilentMovingAffected() && !_actor.isInsideRadius2D(target, 250))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -391,7 +391,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
|
||||
if (npc.getAI() != null) // TODO: possibly check not needed
|
||||
{
|
||||
if (!npc.isDead() && (Math.abs(target.getZ() - npc.getZ()) < 600) && ((npc.getAI()._intention == AI_INTENTION_IDLE) || (npc.getAI()._intention == AI_INTENTION_ACTIVE)) && target.isInsideRadius(npc, 1500, true, false) && GeoEngine.getInstance().canSeeTarget(npc, target))
|
||||
if (!npc.isDead() && (Math.abs(target.getZ() - npc.getZ()) < 600) && ((npc.getAI()._intention == AI_INTENTION_IDLE) || (npc.getAI()._intention == AI_INTENTION_ACTIVE)) && target.isInsideRadius3D(npc, 1500) && GeoEngine.getInstance().canSeeTarget(npc, target))
|
||||
{
|
||||
// Notify the L2Object AI with EVT_AGGRESSION
|
||||
npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
|
||||
@@ -440,7 +440,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
_actor.setTarget(attackTarget);
|
||||
skills = _actor.getAllSkills();
|
||||
dist_2 = _actor.calculateDistance(attackTarget, false, true);
|
||||
dist_2 = _actor.calculateDistanceSq2D(attackTarget);
|
||||
range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
|
||||
if (attackTarget.isMoving())
|
||||
{
|
||||
|
||||
@@ -226,7 +226,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
|
||||
private void avoidAttack(L2Character attacker)
|
||||
{
|
||||
// trying to avoid if summon near owner
|
||||
if ((((L2Summon) _actor).getOwner() != null) && (((L2Summon) _actor).getOwner() != attacker) && ((L2Summon) _actor).getOwner().isInsideRadius(_actor, 2 * AVOID_RADIUS, true, false))
|
||||
if ((((L2Summon) _actor).getOwner() != null) && (((L2Summon) _actor).getOwner() != attacker) && ((L2Summon) _actor).getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS))
|
||||
{
|
||||
_startAvoid = true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ public final class FakePlayerChatManager implements IGameXmlReader
|
||||
final L2Npc npc = spawn.getLastSpawn();
|
||||
if (npc != null)
|
||||
{
|
||||
if (npc.calculateDistance(player, false, false) < 3000)
|
||||
if (npc.calculateDistance2D(player) < 3000)
|
||||
{
|
||||
if (GeoEngine.getInstance().canSeeTarget(npc, player) && !player.isInvisible())
|
||||
{
|
||||
|
||||
+3
-3
@@ -254,9 +254,9 @@ public final class WalkingManager implements IGameXmlReader
|
||||
node = walk.getCurrentNode();
|
||||
}
|
||||
|
||||
if (!npc.isInsideRadius(node, 3000, true, false))
|
||||
if (!npc.isInsideRadius3D(node, 3000))
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": " + "Route '" + routeName + "': NPC (id=" + npc.getId() + ", x=" + npc.getX() + ", y=" + npc.getY() + ", z=" + npc.getZ() + ") is too far from starting point (node x=" + node.getX() + ", y=" + node.getY() + ", z=" + node.getZ() + ", range=" + npc.calculateDistance(node, true, true) + "). Teleporting to proper location.");
|
||||
LOGGER.warning(getClass().getSimpleName() + ": " + "Route '" + routeName + "': NPC (id=" + npc.getId() + ", x=" + npc.getX() + ", y=" + npc.getY() + ", z=" + npc.getZ() + ") is too far from starting point (node x=" + node.getX() + ", y=" + node.getY() + ", z=" + node.getZ() + ", range=" + npc.calculateDistance3D(node) + "). Teleporting to proper location.");
|
||||
npc.teleToLocation(node);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ public final class WalkingManager implements IGameXmlReader
|
||||
}
|
||||
|
||||
final L2NpcWalkerNode node = walk.getRoute().getNodeList().get(walk.getCurrentNodeId());
|
||||
if (!npc.isInsideRadius(node, 10, false, false))
|
||||
if (!npc.isInsideRadius2D(node, 10))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -802,30 +802,91 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates distance between this L2Object and given x, y , z.
|
||||
* Calculates 2D distance between this L2Object and given x, y, z.
|
||||
* @param x the X coordinate
|
||||
* @param y the Y coordinate
|
||||
* @param z the Z coordinate
|
||||
* @param includeZAxis if {@code true} Z axis will be included
|
||||
* @param squared if {@code true} return will be squared
|
||||
* @return distance between object and given x, y, z.
|
||||
*/
|
||||
public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared)
|
||||
public double calculateDistance2D(int x, int y, int z)
|
||||
{
|
||||
final double distance = Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + (includeZAxis ? Math.pow(z - _z.get(), 2) : 0);
|
||||
return squared ? distance : Math.sqrt(distance);
|
||||
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates distance between this L2Object and given location.
|
||||
* Calculates the 2D distance between this L2Object and given location.
|
||||
* @param loc the location object
|
||||
* @param includeZAxis if {@code true} Z axis will be included
|
||||
* @param squared if {@code true} return will be squared
|
||||
* @return distance between object and given location.
|
||||
*/
|
||||
public final double calculateDistance(ILocational loc, boolean includeZAxis, boolean squared)
|
||||
public double calculateDistance2D(ILocational loc)
|
||||
{
|
||||
return calculateDistance(loc.getX(), loc.getY(), loc.getZ(), includeZAxis, squared);
|
||||
return calculateDistance2D(loc.getX(), loc.getY(), loc.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the 3D distance between this L2Object and given x, y, z.
|
||||
* @param x the X coordinate
|
||||
* @param y the Y coordinate
|
||||
* @param z the Z coordinate
|
||||
* @return distance between object and given x, y, z.
|
||||
*/
|
||||
public double calculateDistance3D(int x, int y, int z)
|
||||
{
|
||||
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates 3D distance between this L2Object and given location.
|
||||
* @param loc the location object
|
||||
* @return distance between object and given location.
|
||||
*/
|
||||
public double calculateDistance3D(ILocational loc)
|
||||
{
|
||||
return calculateDistance3D(loc.getX(), loc.getY(), loc.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the non squared 2D distance between this L2Object and given x, y, z.
|
||||
* @param x the X coordinate
|
||||
* @param y the Y coordinate
|
||||
* @param z the Z coordinate
|
||||
* @return distance between object and given x, y, z.
|
||||
*/
|
||||
public double calculateDistanceSq2D(int x, int y, int z)
|
||||
{
|
||||
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the non squared 2D distance between this L2Object and given location.
|
||||
* @param loc the location object
|
||||
* @return distance between object and given location.
|
||||
*/
|
||||
public double calculateDistanceSq2D(ILocational loc)
|
||||
{
|
||||
return calculateDistanceSq2D(loc.getX(), loc.getY(), loc.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the non squared 3D distance between this L2Object and given x, y, z.
|
||||
* @param x the X coordinate
|
||||
* @param y the Y coordinate
|
||||
* @param z the Z coordinate
|
||||
* @return distance between object and given x, y, z.
|
||||
*/
|
||||
public double calculateDistanceSq3D(int x, int y, int z)
|
||||
{
|
||||
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the non squared 3D distance between this L2Object and given location.
|
||||
* @param loc the location object
|
||||
* @return distance between object and given location.
|
||||
*/
|
||||
public double calculateDistanceSq3D(ILocational loc)
|
||||
{
|
||||
return calculateDistanceSq3D(loc.getX(), loc.getY(), loc.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -835,7 +896,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
|
||||
* @param target the object to which to calculate the angle
|
||||
* @return the angle this object has to turn to have the given object in front of it
|
||||
*/
|
||||
public final double calculateDirectionTo(ILocational target)
|
||||
public double calculateDirectionTo(ILocational target)
|
||||
{
|
||||
int heading = Util.calculateHeadingFrom(this, target) - _heading.get();
|
||||
if (heading < 0)
|
||||
|
||||
@@ -627,7 +627,7 @@ public final class L2World
|
||||
continue;
|
||||
}
|
||||
|
||||
if (visibleObject.calculateDistance(object, true, false) <= range)
|
||||
if (visibleObject.calculateDistance3D(object) <= range)
|
||||
{
|
||||
c.accept(clazz.cast(visibleObject));
|
||||
}
|
||||
|
||||
+32
-13
@@ -1137,7 +1137,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
|
||||
// Bows Ranged Damage Formula (Damage gradually decreases when 60% or lower than full hit range, and increases when 60% or higher).
|
||||
// full hit range is 500 which is the base bow range, and the 60% of this is 800.
|
||||
damage1 *= (calculateDistance(target, true, false) / 4000) + 0.8;
|
||||
damage1 *= (calculateDistance3D(target) / 4000) + 0.8;
|
||||
}
|
||||
|
||||
// Check if the L2Character is a L2PcInstance
|
||||
@@ -4482,32 +4482,51 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this object is inside the given radius around the given point.
|
||||
* Check if this object is inside the given 2D radius around the given point.
|
||||
* @param loc Location of the target
|
||||
* @param radius the radius around the target
|
||||
* @param checkZAxis should we check Z axis also
|
||||
* @param strictCheck true if (distance < radius), false if (distance <= radius)
|
||||
* @return true if the L2Character is inside the radius.
|
||||
*/
|
||||
public final boolean isInsideRadius(ILocational loc, int radius, boolean checkZAxis, boolean strictCheck)
|
||||
public final boolean isInsideRadius2D(ILocational loc, int radius)
|
||||
{
|
||||
return isInsideRadius(loc.getX(), loc.getY(), loc.getZ(), radius, checkZAxis, strictCheck);
|
||||
return isInsideRadius2D(loc.getX(), loc.getY(), loc.getZ(), radius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this object is inside the given radius around the given point.
|
||||
* Check if this object is inside the given 2D radius around the given point.
|
||||
* @param x X position of the target
|
||||
* @param y Y position of the target
|
||||
* @param z Z position of the target
|
||||
* @param radius the radius around the target
|
||||
* @param checkZAxis should we check Z axis also
|
||||
* @param strictCheck true if (distance < radius), false if (distance <= radius)
|
||||
* @return true if the L2Character is inside the radius.
|
||||
*/
|
||||
public final boolean isInsideRadius(int x, int y, int z, int radius, boolean checkZAxis, boolean strictCheck)
|
||||
public final boolean isInsideRadius2D(int x, int y, int z, int radius)
|
||||
{
|
||||
final double distance = calculateDistance(x, y, z, checkZAxis, true);
|
||||
return (strictCheck) ? (distance < (radius * radius)) : (distance <= (radius * radius));
|
||||
return calculateDistanceSq2D(x, y, z) < (radius * radius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this object is inside the given 3D radius around the given point.
|
||||
* @param loc Location of the target
|
||||
* @param radius the radius around the target
|
||||
* @return true if the L2Character is inside the radius.
|
||||
*/
|
||||
public final boolean isInsideRadius3D(ILocational loc, int radius)
|
||||
{
|
||||
return isInsideRadius3D(loc.getX(), loc.getY(), loc.getZ(), radius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this object is inside the given 3D radius around the given point.
|
||||
* @param x X position of the target
|
||||
* @param y Y position of the target
|
||||
* @param z Z position of the target
|
||||
* @param radius the radius around the target
|
||||
* @return true if the L2Character is inside the radius.
|
||||
*/
|
||||
public final boolean isInsideRadius3D(int x, int y, int z, int radius)
|
||||
{
|
||||
return calculateDistanceSq3D(x, y, z) < (radius * radius);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5222,7 +5241,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
{
|
||||
if (target.isCharacter())
|
||||
{
|
||||
if (!isInsideRadius(target.getX(), target.getY(), target.getZ(), escapeRange + _template.getCollisionRadius(), true, false))
|
||||
if (!isInsideRadius3D(target.getX(), target.getY(), target.getZ(), escapeRange + _template.getCollisionRadius()))
|
||||
{
|
||||
skipRange++;
|
||||
continue;
|
||||
|
||||
@@ -555,7 +555,7 @@ public class L2Npc extends L2Character
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!isInsideRadius(player, INTERACTION_DISTANCE, true, false))
|
||||
else if (!isInsideRadius3D(player, INTERACTION_DISTANCE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ public final class L2BabyPetInstance extends L2PetInstance
|
||||
final boolean previousFollowStatus = getFollowStatus();
|
||||
|
||||
// pet not following and owner outside cast range
|
||||
if (!previousFollowStatus && !isInsideRadius(getOwner(), skill.getCastRange(), true, true))
|
||||
if (!previousFollowStatus && !isInsideRadius3D(getOwner(), skill.getCastRange()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ public class L2DefenderInstance extends L2Attackable
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!isInsideRadius(getSpawn(), 40, false, false))
|
||||
if (!isInsideRadius2D(getSpawn(), 40))
|
||||
{
|
||||
setisReturningToSpawnPoint(true);
|
||||
clearAggroList();
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ public class L2FortCommanderInstance extends L2DefenderInstance
|
||||
@Override
|
||||
public void returnHome()
|
||||
{
|
||||
if (!isInsideRadius(getSpawn(), 200, false, false))
|
||||
if (!isInsideRadius2D(getSpawn(), 200))
|
||||
{
|
||||
setisReturningToSpawnPoint(true);
|
||||
clearAggroList();
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public final class L2ObservationInstance extends L2Npc
|
||||
{
|
||||
String filename = null;
|
||||
|
||||
if (isInsideRadius(-79884, 86529, 0, 50, false, true) || isInsideRadius(-78858, 111358, 0, 50, false, true) || isInsideRadius(-76973, 87136, 0, 50, false, true) || isInsideRadius(-75850, 111968, 0, 50, false, true))
|
||||
if (isInsideRadius2D(-79884, 86529, 0, 50) || isInsideRadius2D(-78858, 111358, 0, 50) || isInsideRadius2D(-76973, 87136, 0, 50) || isInsideRadius2D(-75850, 111968, 0, 50))
|
||||
{
|
||||
if (val == 0)
|
||||
{
|
||||
|
||||
+4
-4
@@ -1474,7 +1474,7 @@ public final class L2PcInstance extends L2Playable
|
||||
if (_questNpcObject > 0)
|
||||
{
|
||||
final L2Object object = L2World.getInstance().findObject(getLastQuestNpcObject());
|
||||
if (object.isNpc() && isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
|
||||
if (object.isNpc() && isInsideRadius2D(object, L2Npc.INTERACTION_DISTANCE))
|
||||
{
|
||||
final L2Npc npc = (L2Npc) object;
|
||||
quest.notifyEvent(event, npc, this);
|
||||
@@ -4154,7 +4154,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
L2World.getInstance().forEachVisibleObject(this, L2PcInstance.class, player ->
|
||||
{
|
||||
if (!isVisibleFor(player) || (calculateDistance(player, true, false) >= radiusInKnownlist))
|
||||
if (!isVisibleFor(player) || (calculateDistance3D(player) >= radiusInKnownlist))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -8837,7 +8837,7 @@ public final class L2PcInstance extends L2Playable
|
||||
// Calculate the distance between the L2PcInstance and the target
|
||||
if (sklTargetType == L2TargetType.GROUND)
|
||||
{
|
||||
if (!isInsideRadius(_currentSkillWorldPosition.getX(), _currentSkillWorldPosition.getY(), _currentSkillWorldPosition.getZ(), skill.getCastRange() + getTemplate().getCollisionRadius(), false, false))
|
||||
if (!isInsideRadius2D(_currentSkillWorldPosition.getX(), _currentSkillWorldPosition.getY(), _currentSkillWorldPosition.getZ(), skill.getCastRange() + getTemplate().getCollisionRadius()))
|
||||
{
|
||||
// Send a System Message to the caster
|
||||
sendPacket(SystemMessageId.YOUR_TARGET_IS_OUT_OF_RANGE);
|
||||
@@ -8847,7 +8847,7 @@ public final class L2PcInstance extends L2Playable
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ((skill.getCastRange() > 0) && !isInsideRadius(target, skill.getCastRange() + getTemplate().getCollisionRadius(), false, false))
|
||||
else if ((skill.getCastRange() > 0) && !isInsideRadius2D(target, skill.getCastRange() + getTemplate().getCollisionRadius()))
|
||||
{
|
||||
// Send a System Message to the caster
|
||||
sendPacket(SystemMessageId.YOUR_TARGET_IS_OUT_OF_RANGE);
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ public class L2RaidBossInstance extends L2MonsterInstance
|
||||
|
||||
if (!isInCombat() && !isMovementDisabled())
|
||||
{
|
||||
if (!isInsideRadius(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200), true, false))
|
||||
if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200)))
|
||||
{
|
||||
teleToLocation(spawnX, spawnY, spawnZ, false);
|
||||
}
|
||||
|
||||
+3
-3
@@ -294,7 +294,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
|
||||
|
||||
public boolean isTooFarFromHome()
|
||||
{
|
||||
return !isInsideRadius(_homeX, _homeY, _homeZ, MAX_DISTANCE_FROM_HOME, true, true);
|
||||
return !isInsideRadius3D(_homeX, _homeY, _homeZ, MAX_DISTANCE_FROM_HOME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -334,7 +334,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
|
||||
return;
|
||||
}
|
||||
// if the owner is too far away, stop anything else and immediately run towards the owner.
|
||||
if (!_owner.isInsideRadius(this, MAX_DISTANCE_FROM_OWNER, true, true))
|
||||
if (!_owner.isInsideRadius3D(this, MAX_DISTANCE_FROM_OWNER))
|
||||
{
|
||||
getAI().startFollow(_owner);
|
||||
return;
|
||||
@@ -510,7 +510,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
|
||||
return;
|
||||
}
|
||||
// if the owner is too far away, stop anything else and immediately run towards the owner.
|
||||
if (!isInsideRadius(owner, MAX_DISTANCE_FROM_OWNER, true, true))
|
||||
if (!isInsideRadius3D(owner, MAX_DISTANCE_FROM_OWNER))
|
||||
{
|
||||
getAI().startFollow(owner);
|
||||
return;
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
public boolean checkTarget(L2Character target)
|
||||
{
|
||||
// Range seems to be reduced from Freya(300) to H5(150)
|
||||
if (!target.isInsideRadius(this, 150, false, false))
|
||||
if (!target.isInsideRadius2D(this, 150))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,6 +40,6 @@ public class ConditionMinDistance extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effected != null) && (effector.calculateDistance(effected, true, true) >= _sqDistance);
|
||||
return (effected != null) && (effector.calculateDistanceSq3D(effected) >= _sqDistance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -910,7 +910,7 @@ public class Duel
|
||||
}
|
||||
|
||||
// Are the players too far apart?
|
||||
if (!_playerA.isInsideRadius(_playerB, 1600, false, false))
|
||||
if (!_playerA.isInsideRadius2D(_playerB, 1600))
|
||||
{
|
||||
return DuelResult.CANCELED;
|
||||
}
|
||||
|
||||
@@ -1536,7 +1536,7 @@ public class Siege implements Siegable
|
||||
continue;
|
||||
}
|
||||
|
||||
final double distance = ct.calculateDistance(spawn, true, true);
|
||||
final double distance = ct.calculateDistanceSq3D(spawn);
|
||||
|
||||
if (distance < distanceClosest)
|
||||
{
|
||||
|
||||
@@ -2232,7 +2232,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
continue;
|
||||
}
|
||||
temp = partyMember.getQuestState(getName());
|
||||
if ((temp != null) && (temp.get(var) != null) && temp.get(var).equalsIgnoreCase(value) && partyMember.isInsideRadius(target, 1500, true, false))
|
||||
if ((temp != null) && (temp.get(var) != null) && temp.get(var).equalsIgnoreCase(value) && partyMember.isInsideRadius3D(target, 1500))
|
||||
{
|
||||
candidates.add(partyMember);
|
||||
}
|
||||
@@ -2279,7 +2279,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
continue;
|
||||
}
|
||||
temp = partyMember.getQuestState(getName());
|
||||
if ((temp != null) && (temp.getState() == state) && partyMember.isInsideRadius(target, 1500, true, false))
|
||||
if ((temp != null) && (temp.getState() == state) && partyMember.isInsideRadius3D(target, 1500))
|
||||
{
|
||||
candidates.add(partyMember);
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ public final class Formulas
|
||||
}
|
||||
|
||||
// Check the distance between the player and the player spawn point, in the center of the arena.
|
||||
final double distToCenter = activeChar.calculateDistance(festivalCenter[0], festivalCenter[1], 0, false, false);
|
||||
final double distToCenter = activeChar.calculateDistance2D(festivalCenter[0], festivalCenter[1], 0);
|
||||
|
||||
return 1.0 - (distToCenter * 0.0005); // Maximum Decreased Regen of ~ -65%;
|
||||
}
|
||||
|
||||
+1
-1
@@ -273,7 +273,7 @@ public class L2BossZone extends L2ZoneType
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!raid.isInsideRadius(raid.getSpawn(), 150, false, false))
|
||||
if (!raid.isInsideRadius2D(raid.getSpawn(), 150))
|
||||
{
|
||||
raid.returnHome();
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class AnswerCoupleAction implements IClientIncomingPacket
|
||||
}
|
||||
else if (_answer == 1) // approve
|
||||
{
|
||||
final int distance = (int) activeChar.calculateDistance(target, false, false);
|
||||
final int distance = (int) activeChar.calculateDistance2D(target);
|
||||
if ((distance > 125) || (distance < 15) || (activeChar.getObjectId() == target.getObjectId()))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS);
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
|
||||
if (!player.isGM() && (npc != null))
|
||||
{
|
||||
if (!player.isInsideRadius(npc, INTERACTION_DISTANCE, true, false) || (player.getInstanceId() != npc.getInstanceId()))
|
||||
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
|
||||
+2
-2
@@ -1070,7 +1070,7 @@ public final class RequestActionUse implements IClientIncomingPacket
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!activeChar.isSitting() && (target instanceof L2StaticObjectInstance) && (((L2StaticObjectInstance) target).getType() == 1) && activeChar.isInsideRadius(target, L2StaticObjectInstance.INTERACTION_DISTANCE, false, false))
|
||||
if (!activeChar.isSitting() && (target instanceof L2StaticObjectInstance) && (((L2StaticObjectInstance) target).getType() == 1) && activeChar.isInsideRadius2D(target, L2StaticObjectInstance.INTERACTION_DISTANCE))
|
||||
{
|
||||
final ChairSit cs = new ChairSit(activeChar, target.getId());
|
||||
_client.sendPacket(cs);
|
||||
@@ -1315,7 +1315,7 @@ public final class RequestActionUse implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final int distance = (int) requester.calculateDistance(target, false, false);
|
||||
final int distance = (int) requester.calculateDistance2D(target);
|
||||
if ((distance > 125) || (distance < 15) || (requester.getObjectId() == target.getObjectId()))
|
||||
{
|
||||
_client.sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS);
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ public final class RequestBuyItem implements IClientIncomingPacket
|
||||
L2Character merchant = null;
|
||||
if (!player.isGM() && (_listId != CUSTOM_CB_SELL_LIST))
|
||||
{
|
||||
if (!(target instanceof L2MerchantInstance) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) || (player.getInstanceId() != target.getInstanceId()))
|
||||
if (!(target instanceof L2MerchantInstance) || (!player.isInsideRadius3D(target, INTERACTION_DISTANCE)) || (player.getInstanceId() != target.getInstanceId()))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ public final class RequestBypassToServer implements IClientIncomingPacket
|
||||
{
|
||||
final L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
|
||||
|
||||
if ((object != null) && object.isNpc() && (endOfId > 0) && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
|
||||
if ((object != null) && object.isNpc() && (endOfId > 0) && activeChar.isInsideRadius2D(object, L2Npc.INTERACTION_DISTANCE))
|
||||
{
|
||||
((L2Npc) object).onBypassFeedback(activeChar, _command.substring(endOfId + 1));
|
||||
}
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ public final class RequestDropItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeChar.isInsideRadius(_x, _y, 0, 150, false, false) || (Math.abs(_z - activeChar.getZ()) > 50))
|
||||
if (!activeChar.isInsideRadius2D(_x, _y, 0, 150) || (Math.abs(_z - activeChar.getZ()) > 50))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DISCARD_SOMETHING_THAT_FAR_AWAY_FROM_YOU);
|
||||
return;
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public final class RequestDuelStart implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
// Players may not be too far apart
|
||||
else if (!activeChar.isInsideRadius(targetChar, 250, false, false))
|
||||
else if (!activeChar.isInsideRadius2D(targetChar, 250))
|
||||
{
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_CANNOT_RECEIVE_A_DUEL_CHALLENGE_BECAUSE_C1_IS_TOO_FAR_AWAY);
|
||||
msg.addString(targetChar.getName());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user