Distance checking methods rework.
This commit is contained in:
parent
0299a04d9b
commit
b4be2cc560
@ -90,7 +90,7 @@ public abstract class AbstractNpcAI extends Quest
|
||||
return;
|
||||
}
|
||||
|
||||
final double distance = npc.calculateDistance(npcAround, true, false);
|
||||
final double distance = npc.calculateDistance3D(npcAround);
|
||||
if ((distance >= maxDistance) && npc.isScriptValue(0))
|
||||
{
|
||||
npc.setRunning();
|
||||
|
@ -152,7 +152,7 @@ public final class ImprovedBabyPets extends AbstractNpcAI
|
||||
}
|
||||
}
|
||||
|
||||
if (!previousFollowStatus && !summon.isInsideRadius(owner, skill.getSkill().getCastRange(), true, true))
|
||||
if (!previousFollowStatus && !summon.isInsideRadius3D(owner, skill.getSkill().getCastRange()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -183,7 +183,7 @@ public final class ImprovedBabyPets extends AbstractNpcAI
|
||||
|
||||
if ((skill != null) && (owner != null) && SkillCaster.checkUseConditions(summon, skill.getSkill()) && !owner.isDead())
|
||||
{
|
||||
if (!previousFollowStatus && !summon.isInsideRadius(owner, skill.getSkill().getCastRange(), true, true))
|
||||
if (!previousFollowStatus && !summon.isInsideRadius3D(owner, skill.getSkill().getCastRange()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public final class LeopardDragonHachling extends AbstractNpcAI
|
||||
{
|
||||
if ((npc != null) && event.equals("MOVE_TO_TRANSFORM"))
|
||||
{
|
||||
if (npc.calculateDistance(nearestLocation(npc), false, false) < 100)
|
||||
if (npc.calculateDistance2D(nearestLocation(npc)) < 100)
|
||||
{
|
||||
final int random = getRandom(1, 4);
|
||||
for (int counter = 1; counter < random; counter++)
|
||||
@ -99,7 +99,7 @@ public final class LeopardDragonHachling extends AbstractNpcAI
|
||||
Location gotoLoc = TRANSFORM_LOCATIONS.get(0);
|
||||
for (Location loc : TRANSFORM_LOCATIONS)
|
||||
{
|
||||
if (npc.calculateDistance(loc, false, false) < npc.calculateDistance(gotoLoc, false, false))
|
||||
if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc))
|
||||
{
|
||||
gotoLoc = loc;
|
||||
}
|
||||
|
@ -234,7 +234,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);
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -308,7 +308,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);
|
||||
|
@ -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);
|
||||
@ -369,7 +369,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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -107,7 +107,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());
|
||||
|
@ -530,11 +530,11 @@ public class Anakim extends AbstractNpcAI
|
||||
|
||||
for (L2PcInstance member : members)
|
||||
{
|
||||
if (member.isInsideRadius(npc, 1000, true, false) && (npc.getId() == ENTER_CUBIC))
|
||||
if (member.isInsideRadius3D(npc, 1000) && (npc.getId() == ENTER_CUBIC))
|
||||
{
|
||||
member.teleToLocation(ENTER_LOC, true);
|
||||
}
|
||||
else if (member.isInsideRadius(npc, 1000, true, false) && (npc.getId() == ANAKIM_CUBIC))
|
||||
else if (member.isInsideRadius3D(npc, 1000) && (npc.getId() == ANAKIM_CUBIC))
|
||||
{
|
||||
member.teleToLocation(ENTER_ANAKIM_LOC, true);
|
||||
}
|
||||
|
@ -234,7 +234,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);
|
||||
}
|
||||
@ -618,7 +618,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);
|
||||
@ -820,17 +820,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;
|
||||
}
|
||||
@ -878,7 +878,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;
|
||||
|
@ -247,12 +247,12 @@ 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);
|
||||
}
|
||||
else if ((_standbyPlayer != null) && _standbyPlayer.isInsideRadius(npc, 16000, true, false))
|
||||
else if ((_standbyPlayer != null) && _standbyPlayer.isInsideRadius3D(npc, 16000))
|
||||
{
|
||||
_standbyPlayer.teleToLocation(BAIUM_GIFT_LOC);
|
||||
startQuestTimer("PLAYER_KILL", 3000, npc, _standbyPlayer);
|
||||
@ -262,7 +262,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, player.getName() + ", How dare you wake me! Now you shall die!"); // TODO: replace with NpcStringId when are done core support
|
||||
@ -352,7 +352,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)
|
||||
{
|
||||
@ -525,7 +525,7 @@ public final class Baium extends AbstractNpcAI
|
||||
|
||||
if ((getRandom(100) < 10) && SkillCaster.checkUseConditions(mob, 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());
|
||||
@ -682,7 +682,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);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public final class BalokWarzone extends AbstractInstance
|
||||
{
|
||||
if (npc.getId() == MINION)
|
||||
{
|
||||
if (npc.calculateDistance(balok, false, true) > 113125)
|
||||
if (npc.calculateDistanceSq2D(balok) > 113125)
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(balok.getX() + 100, balok.getY() + 50, balok.getZ(), balok.getHeading()));
|
||||
getTimers().addTimer("stage_last_minion_walk", 2000, npc, player);
|
||||
|
@ -626,7 +626,7 @@ public final class Beleth extends AbstractNpcAI
|
||||
{
|
||||
if ((player != null) && !player.isDead())
|
||||
{
|
||||
final double distance2 = npc.calculateDistance(player, false, false);
|
||||
final double distance2 = npc.calculateDistance2D(player);
|
||||
if ((distance2 > 890) && !npc.isMovementDisabled())
|
||||
{
|
||||
npc.setTarget(player);
|
||||
@ -712,7 +712,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)
|
||||
|
@ -91,7 +91,7 @@ public final class Wormhole extends AbstractNpcAI
|
||||
{
|
||||
for (L2PcInstance member : members)
|
||||
{
|
||||
if (member.isInsideRadius(npc, 1000, true, false))
|
||||
if (member.isInsideRadius3D(npc, 1000))
|
||||
{
|
||||
member.teleToLocation(BELETH_LOCATION, true);
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
|
||||
case "LEADER_DASH":
|
||||
{
|
||||
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
|
||||
if (getRandomBoolean() && !npc.isCastingNow(SkillCaster::isAnyNormalType) && (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) < 1000))
|
||||
if (getRandomBoolean() && !npc.isCastingNow(SkillCaster::isAnyNormalType) && (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance3D(mostHated) < 1000))
|
||||
{
|
||||
npc.setTarget(mostHated);
|
||||
npc.doCast(LEADER_RUSH.getSkill());
|
||||
@ -772,13 +772,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) && SkillCaster.checkUseConditions(npc, ICE_BALL.getSkill()))
|
||||
if ((npc.calculateDistance3D(attacker) <= 800) && SkillCaster.checkUseConditions(npc, ICE_BALL.getSkill()))
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(ICE_BALL.getSkill());
|
||||
@ -794,7 +794,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
|
||||
{
|
||||
if (getRandomBoolean())
|
||||
{
|
||||
if ((npc.calculateDistance(attacker, true, false) <= 800) && SkillCaster.checkUseConditions(npc, SUMMON_ELEMENTAL.getSkill()))
|
||||
if ((npc.calculateDistance3D(attacker) <= 800) && SkillCaster.checkUseConditions(npc, SUMMON_ELEMENTAL.getSkill()))
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SUMMON_ELEMENTAL.getSkill());
|
||||
@ -856,13 +856,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) && SkillCaster.checkUseConditions(npc, ICE_BALL.getSkill()))
|
||||
if ((npc.calculateDistance3D(attacker) <= 800) && SkillCaster.checkUseConditions(npc, ICE_BALL.getSkill()))
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(ICE_BALL.getSkill());
|
||||
@ -878,7 +878,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
|
||||
{
|
||||
if (getRandomBoolean())
|
||||
{
|
||||
if ((npc.calculateDistance(attacker, true, false) <= 800) && SkillCaster.checkUseConditions(npc, SUMMON_ELEMENTAL.getSkill()))
|
||||
if ((npc.calculateDistance3D(attacker) <= 800) && SkillCaster.checkUseConditions(npc, SUMMON_ELEMENTAL.getSkill()))
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SUMMON_ELEMENTAL.getSkill());
|
||||
@ -961,7 +961,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)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ public final class IstinaCavern extends AbstractInstance
|
||||
case "DEATH_TIMER":
|
||||
{
|
||||
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
|
||||
if ((mostHated != null) && npc.isInsideRadius(mostHated, 15000, false, true))
|
||||
if ((mostHated != null) && npc.isInsideRadius2D(mostHated, 15000))
|
||||
{
|
||||
final SkillHolder death1 = npcParams.getSkillHolder("Istina_Death_Skill01");
|
||||
final SkillHolder death2 = npcParams.getSkillHolder("Istina_Death_Skill02");
|
||||
@ -187,7 +187,7 @@ public final class IstinaCavern extends AbstractInstance
|
||||
final SkillHolder death2 = npcParams.getSkillHolder("Istina_Death_Skill02");
|
||||
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
|
||||
|
||||
if ((mostHated != null) && npc.isInsideRadius(mostHated, 15000, false, true) && mostHated.isInCategory(CategoryType.TANKER_GROUP) && mostHated.isAffectedBySkill(death1))
|
||||
if ((mostHated != null) && npc.isInsideRadius2D(mostHated, 15000) && mostHated.isInCategory(CategoryType.TANKER_GROUP) && mostHated.isAffectedBySkill(death1))
|
||||
{
|
||||
addSkillCastDesire(npc, mostHated, death2, 23);
|
||||
}
|
||||
@ -223,7 +223,7 @@ public final class IstinaCavern extends AbstractInstance
|
||||
final L2Attackable istina = (L2Attackable) npc;
|
||||
if ((istina.getHateList() != null) && (istina.getHateList().size() > 0))
|
||||
{
|
||||
final L2Character target = istina.getHateList().stream().sorted((o1, o2) -> (int) o1.calculateDistance(o2, true, false)).findFirst().orElse(null);
|
||||
final L2Character target = istina.getHateList().stream().sorted((o1, o2) -> (int) o1.calculateDistance3D(o2)).findFirst().orElse(null);
|
||||
if (target != null)
|
||||
{
|
||||
final L2Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(target, 50, 50), false, 0, false, instance.getId());
|
||||
|
@ -95,7 +95,7 @@ public final class KimerianCommon extends AbstractInstance
|
||||
player = npc.getVariables().getObject("PC_INSTANCE", L2PcInstance.class);
|
||||
if (player != null)
|
||||
{
|
||||
final double distance = npc.calculateDistance(player, false, false);
|
||||
final double distance = npc.calculateDistance2D(player);
|
||||
if (distance > 1000)
|
||||
{
|
||||
npc.teleToLocation(new Location(player.getX() + getRandom(-100, 100), player.getY() + getRandom(-100, 100), player.getZ() + 50));
|
||||
|
@ -556,11 +556,11 @@ public class Lilith extends AbstractNpcAI
|
||||
|
||||
for (L2PcInstance member : members)
|
||||
{
|
||||
if (member.isInsideRadius(npc, 1000, true, false) && (npc.getId() == ENTER_CUBIC))
|
||||
if (member.isInsideRadius3D(npc, 1000) && (npc.getId() == ENTER_CUBIC))
|
||||
{
|
||||
member.teleToLocation(ENTER_LOC, true);
|
||||
}
|
||||
else if (member.isInsideRadius(npc, 1000, true, false) && (npc.getId() == LILITH_CUBIC))
|
||||
else if (member.isInsideRadius3D(npc, 1000) && (npc.getId() == LILITH_CUBIC))
|
||||
{
|
||||
member.teleToLocation(ENTER_LILITH_LOC, true);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class KatoSicanus extends AbstractNpcAI
|
||||
}
|
||||
for (L2PcInstance member : members)
|
||||
{
|
||||
if (member.isInsideRadius(npc, 1500, true, false))
|
||||
if (member.isInsideRadius3D(npc, 1500))
|
||||
{
|
||||
member.teleToLocation(LINDVIOR_LOCATION, true);
|
||||
addSpawn(INVISIBLE, 46707, -28586, -1400, 0, false, 0, false);
|
||||
|
@ -803,7 +803,7 @@ public class Lindvior extends AbstractNpcAI
|
||||
{
|
||||
npc.setTarget(generator);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, generator.getLocation());
|
||||
if (npc.distFromMe(generator) < 500)
|
||||
if (npc.calculateDistance3D(generator) < 500)
|
||||
{
|
||||
npc.reduceCurrentHp(1, generator, null);
|
||||
generator.reduceCurrentHp(1, npc, null);
|
||||
|
@ -310,7 +310,7 @@ public final class OctavisWarzone extends AbstractInstance
|
||||
case "MINION_CALL":
|
||||
{
|
||||
final L2PcInstance mostHated = ((L2Attackable) npc).getMostHated().getActingPlayer();
|
||||
if ((mostHated != null) && (mostHated.calculateDistance(npc, true, false) < 5000))
|
||||
if ((mostHated != null) && (mostHated.calculateDistance3D(npc) < 5000))
|
||||
{
|
||||
L2World.getInstance().getVisibleObjects(npc, L2Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion ->
|
||||
{
|
||||
@ -323,7 +323,7 @@ public final class OctavisWarzone extends AbstractInstance
|
||||
case "ATTACK_TIMER":
|
||||
{
|
||||
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
|
||||
if ((mostHated != null) && mostHated.isPlayable() && (npc.calculateDistance(mostHated, false, false) < 1000))
|
||||
if ((mostHated != null) && mostHated.isPlayable() && (npc.calculateDistance2D(mostHated) < 1000))
|
||||
{
|
||||
final int random = getRandom(5);
|
||||
if (random < 3)
|
||||
|
@ -212,7 +212,7 @@ public final class Orfen extends AbstractNpcAI
|
||||
{
|
||||
for (L2Attackable mob : _minions)
|
||||
{
|
||||
if (!npc.isInsideRadius(mob, 3000, false, false))
|
||||
if (!npc.isInsideRadius2D(mob, 3000))
|
||||
{
|
||||
mob.teleToLocation(npc.getLocation());
|
||||
((L2Attackable) npc).clearAggroList();
|
||||
@ -243,7 +243,7 @@ public final class Orfen extends AbstractNpcAI
|
||||
if (npc.getId() == ORFEN)
|
||||
{
|
||||
final L2Character originalCaster = isSummon ? caster.getServitors().values().stream().findFirst().orElse(caster.getPet()) : 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))
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, TEXT[getRandom(4)], caster.getName());
|
||||
originalCaster.teleToLocation(npc.getLocation());
|
||||
@ -296,7 +296,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))
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, TEXT[getRandom(3)], attacker.getName());
|
||||
attacker.teleToLocation(npc.getLocation());
|
||||
|
@ -404,7 +404,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));
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ public final class TeredorWarzone extends AbstractInstance
|
||||
if (npcId > 0)
|
||||
{
|
||||
final L2Npc minion = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), 0, false, 0, false, instance.getId());
|
||||
if ((player != null) && (minion.calculateDistance(player, true, false) < 2000))
|
||||
if ((player != null) && (minion.calculateDistance3D(player) < 2000))
|
||||
{
|
||||
addAttackPlayerDesire(minion, player, 23);
|
||||
}
|
||||
@ -470,7 +470,7 @@ public final class TeredorWarzone extends AbstractInstance
|
||||
final int hpPer = npc.getCurrentHpPercent();
|
||||
int teredorStatus = npcVars.getInt("TEREDOR_STATUS", 1);
|
||||
|
||||
if ((npc.distFromMe(attacker) > 450) && (getRandom(100) < 5))
|
||||
if ((npc.calculateDistance3D(attacker) > 450) && (getRandom(100) < 5))
|
||||
{
|
||||
addSkillCastDesire(npc, attacker, TEREDOR_POISON_SKILL, 23);
|
||||
addSpawn(TEREDOR_POISON, attacker.getX(), attacker.getY(), attacker.getZ(), 0, false, 0, false, instance.getId());
|
||||
|
@ -104,7 +104,7 @@ public class Daichir extends AbstractNpcAI
|
||||
}
|
||||
for (L2PcInstance member : members)
|
||||
{
|
||||
if (member.isInsideRadius(npc, 1500, true, false))
|
||||
if (member.isInsideRadius3D(npc, 1500))
|
||||
{
|
||||
member.teleToLocation(ENTER_LOCATION, true);
|
||||
GrandBossManager.getInstance().setBossStatus(TRASKEN, FIGHTING);
|
||||
|
@ -71,7 +71,7 @@ public final class AltarOfEvil extends AbstractNpcAI
|
||||
|
||||
private void teleportPlayer(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
if (npc.isScriptValue(0) && (npc.calculateDistance(player, true, false) > 200))
|
||||
if (npc.isScriptValue(0) && (npc.calculateDistance3D(player) > 200))
|
||||
{
|
||||
addSkillCastDesire(npc, player, SKILL, 23);
|
||||
npc.setScriptValue(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++)
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler
|
||||
|
||||
activeChar.sendPacket(new ExOlympiadMatchList());
|
||||
}
|
||||
else if ((olymanager == null) || (olymanager.getId() != MANAGER) || (!activeChar.inObserverMode() && !activeChar.isInsideRadius(olymanager, 300, false, false)))
|
||||
else if ((olymanager == null) || (olymanager.getId() != MANAGER) || (!activeChar.inObserverMode() && !activeChar.isInsideRadius2D(olymanager, 300)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -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))
|
||||
{
|
||||
@ -94,7 +94,7 @@ public final class PrisonGuards extends AbstractNpcAI
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_EASY_TO_OBTAIN);
|
||||
}
|
||||
}
|
||||
else if (!player.isAffectedBySkill(TIMER) && (npc.calculateDistance(npc.getSpawn().getLocation(), false, false) < 2000))
|
||||
else if (!player.isAffectedBySkill(TIMER) && (npc.calculateDistance2D(npc.getSpawn().getLocation()) < 2000))
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(STONE.getSkill());
|
||||
|
@ -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()) || target.isInvul())
|
||||
if (!npc.isInCombat() || (target == null) || (npc.calculateDistance2D(target) > npc.getAggroRange()) || target.isInvul())
|
||||
{
|
||||
for (L2Character nearby : L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange()))
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -222,7 +222,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);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ public final class Race extends Event
|
||||
{
|
||||
if ((player != null) && 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);
|
||||
|
@ -54,7 +54,7 @@ public class L2DoorInstanceAction implements IActionHandler
|
||||
}
|
||||
else if ((activeChar.getClan() != null) && (clanHall != null) && (activeChar.getClanId() == clanHall.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);
|
||||
}
|
||||
@ -73,7 +73,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);
|
||||
}
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -95,8 +95,8 @@ public class L2NpcActionShift implements IActionShiftHandler
|
||||
html.replace("%mpRewardTicks%", npc.getTemplate().getMpRewardTicks());
|
||||
html.replace("%mpRewardType%", npc.getTemplate().getMpRewardType().name());
|
||||
html.replace("%mpRewardAffectType%", npc.getTemplate().getMpRewardAffectType().name());
|
||||
html.replace("%loc2d%", String.valueOf((int) activeChar.calculateDistance(npc, false, false)));
|
||||
html.replace("%loc3d%", String.valueOf((int) activeChar.calculateDistance(npc, true, false)));
|
||||
html.replace("%loc2d%", String.valueOf((int) activeChar.calculateDistance2D(npc)));
|
||||
html.replace("%loc3d%", String.valueOf((int) activeChar.calculateDistance3D(npc)));
|
||||
|
||||
final AttributeType attackAttribute = npc.getAttackElement();
|
||||
html.replace("%ele_atk%", attackAttribute.name());
|
||||
|
@ -190,7 +190,7 @@ public class AdminScan implements IAdminCommandHandler
|
||||
sb.append("<tr>");
|
||||
sb.append("<td width=\"45\">").append(character.getId()).append("</td>");
|
||||
sb.append("<td><a action=\"bypass -h admin_move_to ").append(character.getX()).append(SPACE).append(character.getY()).append(SPACE).append(character.getZ()).append("\">").append(npcName.isEmpty() ? "No name NPC" : npcName).append("</a></td>");
|
||||
sb.append("<td width=\"60\">").append(Util.formatAdena(Math.round(activeChar.calculateDistance(character, false, false)))).append("</td>");
|
||||
sb.append("<td width=\"60\">").append(Util.formatAdena(Math.round(activeChar.calculateDistance2D(character)))).append("</td>");
|
||||
sb.append("<td width=\"54\"><a action=\"").append(builder.toStringBuilder()).append("\"><font color=\"LEVEL\">Delete</font></a></td>");
|
||||
sb.append("</tr>");
|
||||
}).build();
|
||||
|
@ -49,7 +49,7 @@ public class SphericBarrier extends AbstractStatAddEffect
|
||||
|
||||
private DamageReturn onDamageReceivedEvent(OnCreatureDamageReceived event)
|
||||
{
|
||||
if (event.getAttacker().calculateDistance(event.getTarget(), true, false) > _amount)
|
||||
if (event.getAttacker().calculateDistance3D(event.getTarget()) > _amount)
|
||||
{
|
||||
return new DamageReturn(false, true, false, 0);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public final class TeleportToNpc extends AbstractEffect
|
||||
|
||||
private void teleport(L2Character effected, ILocational location)
|
||||
{
|
||||
if (effected.isInsideRadius(location, 900, false, false))
|
||||
if (effected.isInsideRadius2D(location, 900))
|
||||
{
|
||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effected.broadcastPacket(new FlyToLocation(effected, location, FlyType.DUMMY));
|
||||
|
@ -67,7 +67,7 @@ public final class TeleportToSummon extends AbstractEffect
|
||||
{
|
||||
final L2Summon summon = effected.getActingPlayer().getFirstServitor();
|
||||
|
||||
if ((_maxDistance > 0) && (effector.calculateDistance(summon, false, false) >= _maxDistance))
|
||||
if ((_maxDistance > 0) && (effector.calculateDistance2D(summon) >= _maxDistance))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public final class SitStand implements IPlayerActionHandler
|
||||
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());
|
||||
activeChar.sendPacket(cs);
|
||||
|
@ -141,7 +141,7 @@ public final class SocialAction implements IPlayerActionHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final int distance = (int) player.calculateDistance(target, false, false);
|
||||
final int distance = (int) player.calculateDistance2D(target);
|
||||
if ((distance > 125) || (distance < 15) || (player.getObjectId() == target.getObjectId()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS);
|
||||
|
@ -37,6 +37,6 @@ public class OpCheckCastRangeSkillCondition implements ISkillCondition
|
||||
@Override
|
||||
public boolean canUse(L2Character caster, Skill skill, L2Object target)
|
||||
{
|
||||
return (target != null) && (caster.calculateDistance(target, true, true) >= _distance);
|
||||
return (target != null) && (caster.calculateDistance3D(target) /* for some reason this used Sq3D check */ >= _distance);
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class Enemy implements ITargetTypeHandler
|
||||
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
|
||||
if (dontMove)
|
||||
{
|
||||
if (activeChar.calculateDistance(target, false, false) > skill.getCastRange())
|
||||
if (activeChar.calculateDistance2D(target) > skill.getCastRange())
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ public class EnemyNot implements ITargetTypeHandler
|
||||
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
|
||||
if (dontMove)
|
||||
{
|
||||
if (activeChar.calculateDistance(target, false, false) > skill.getCastRange())
|
||||
if (activeChar.calculateDistance2D(target) > skill.getCastRange())
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ public class EnemyOnly implements ITargetTypeHandler
|
||||
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
|
||||
if (dontMove)
|
||||
{
|
||||
if (activeChar.calculateDistance(target, false, false) > skill.getCastRange())
|
||||
if (activeChar.calculateDistance2D(target) > skill.getCastRange())
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ public class Ground implements ITargetTypeHandler
|
||||
final Location worldPosition = activeChar.getActingPlayer().getCurrentSkillWorldPosition();
|
||||
if (worldPosition != null)
|
||||
{
|
||||
if (dontMove && !activeChar.isInsideRadius(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), skill.getCastRange() + activeChar.getTemplate().getCollisionRadius(), false, false))
|
||||
if (dontMove && !activeChar.isInsideRadius2D(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), skill.getCastRange() + activeChar.getTemplate().getCollisionRadius()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class NpcBody implements ITargetTypeHandler
|
||||
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
|
||||
if (dontMove)
|
||||
{
|
||||
if (activeChar.calculateDistance(npc, false, false) > skill.getCastRange())
|
||||
if (activeChar.calculateDistance2D(npc) > skill.getCastRange())
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ public class PcBody implements ITargetTypeHandler
|
||||
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
|
||||
if (dontMove)
|
||||
{
|
||||
if (activeChar.calculateDistance(target, false, false) > skill.getCastRange())
|
||||
if (activeChar.calculateDistance2D(target) > skill.getCastRange())
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ public class Target implements ITargetTypeHandler
|
||||
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
|
||||
if (dontMove)
|
||||
{
|
||||
if (activeChar.calculateDistance(target, false, false) > skill.getCastRange())
|
||||
if (activeChar.calculateDistance2D(target) > skill.getCastRange())
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
|
@ -82,9 +82,9 @@ public class PointBlank implements IAffectScopeHandler
|
||||
final Location worldPosition = activeChar.getActingPlayer().getCurrentSkillWorldPosition();
|
||||
if (worldPosition != null)
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, (int) (affectRange + activeChar.calculateDistance(worldPosition, false, false)), c ->
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, (int) (affectRange + activeChar.calculateDistance2D(worldPosition)), c ->
|
||||
{
|
||||
if (!c.isInsideRadius(worldPosition, affectRange, true, true))
|
||||
if (!c.isInsideRadius3D(worldPosition, affectRange))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -82,9 +82,9 @@ public class Range implements IAffectScopeHandler
|
||||
final Location worldPosition = activeChar.getActingPlayer().getCurrentSkillWorldPosition();
|
||||
if (worldPosition != null)
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, (int) (affectRange + activeChar.calculateDistance(worldPosition, false, false)), c ->
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, (int) (affectRange + activeChar.calculateDistance2D(worldPosition)), c ->
|
||||
{
|
||||
if (!c.isInsideRadius(worldPosition, affectRange, true, true))
|
||||
if (!c.isInsideRadius3D(worldPosition, affectRange))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class RingRange implements IAffectScopeHandler
|
||||
}
|
||||
|
||||
// Targets before the start range are unaffected.
|
||||
if (c.isInsideRadius(target, startRange, false, true))
|
||||
if (c.isInsideRadius2D(target, startRange))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ public final class ChamberOfProphecies extends AbstractInstance
|
||||
}
|
||||
case "CLOSE":
|
||||
{
|
||||
if (player.calculateDistance(world.getNpc(GRAIL), false, false) < 390)
|
||||
if (player.calculateDistance2D(world.getNpc(GRAIL)) < 390)
|
||||
{
|
||||
world.openCloseDoor(DOOR_4, false);
|
||||
world.despawnGroup("q10753_16_instance_halter_1_1");
|
||||
|
@ -302,7 +302,7 @@ public final class HarnakUndergroundRuins extends AbstractInstance
|
||||
final Instance world = player.getInstanceWorld();
|
||||
if (world != null)
|
||||
{
|
||||
if (npc.calculateDistance(player, true, false) < MAXIMUM_DEFENSE.getSkill().getCastRange())
|
||||
if (npc.calculateDistance3D(player) < MAXIMUM_DEFENSE.getSkill().getCastRange())
|
||||
{
|
||||
npc.doCast(MAXIMUM_DEFENSE.getSkill());
|
||||
|
||||
@ -331,7 +331,7 @@ public final class HarnakUndergroundRuins extends AbstractInstance
|
||||
final Instance world = player.getInstanceWorld();
|
||||
if ((world != null) && (world.isStatus(3) || world.isStatus(4)))
|
||||
{
|
||||
if (npc.calculateDistance(player, true, false) < LIGHT_HEAL.getSkill().getCastRange())
|
||||
if (npc.calculateDistance3D(player) < LIGHT_HEAL.getSkill().getCastRange())
|
||||
{
|
||||
npc.doCast(LIGHT_HEAL.getSkill());
|
||||
}
|
||||
|
@ -450,7 +450,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);
|
||||
|
@ -105,7 +105,7 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
|
||||
player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
|
||||
if (player != null)
|
||||
{
|
||||
final double distance = npc.calculateDistance(player, false, false);
|
||||
final double distance = npc.calculateDistance2D(player);
|
||||
if (distance > 300)
|
||||
{
|
||||
final Location loc = new Location(player.getX(), player.getY(), player.getZ() + 50);
|
||||
|
@ -99,7 +99,7 @@ public final class KartiaHelperBarton extends AbstractNpcAI
|
||||
final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
|
||||
if (adolph != null)
|
||||
{
|
||||
final double distance = npc.calculateDistance(adolph, false, false);
|
||||
final double distance = npc.calculateDistance2D(adolph);
|
||||
if (distance > 300)
|
||||
{
|
||||
final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
|
||||
|
@ -127,7 +127,7 @@ public final class KartiaHelperElise extends AbstractNpcAI
|
||||
}
|
||||
if (adolph != null)
|
||||
{
|
||||
final double distance = npc.calculateDistance(adolph, false, false);
|
||||
final double distance = npc.calculateDistance2D(adolph);
|
||||
if (distance > 300)
|
||||
{
|
||||
final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
|
||||
|
@ -95,7 +95,7 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
|
||||
final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
|
||||
if (adolph != null)
|
||||
{
|
||||
final double distance = npc.calculateDistance(adolph, false, false);
|
||||
final double distance = npc.calculateDistance2D(adolph);
|
||||
if (distance > 300)
|
||||
{
|
||||
final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
|
||||
|
@ -103,7 +103,7 @@ public final class KartiaHelperGuardian extends AbstractNpcAI
|
||||
final FriendlyNpcInstance eliyah = npc.getVariables().getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
|
||||
if (eliyah != null)
|
||||
{
|
||||
final double distance = npc.calculateDistance(eliyah, false, false);
|
||||
final double distance = npc.calculateDistance2D(eliyah);
|
||||
if (distance > 300)
|
||||
{
|
||||
final Location loc = new Location(eliyah.getX(), eliyah.getY(), eliyah.getZ() + 50);
|
||||
|
@ -100,7 +100,7 @@ public final class KartiaHelperHayuk extends AbstractNpcAI
|
||||
final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
|
||||
if (adolph != null)
|
||||
{
|
||||
final double distance = npc.calculateDistance(adolph, false, false);
|
||||
final double distance = npc.calculateDistance2D(adolph);
|
||||
if (distance > 300)
|
||||
{
|
||||
final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
|
||||
|
@ -932,7 +932,7 @@ public final class KartiasLabyrinth extends AbstractInstance
|
||||
|
||||
if ((world != null) && (creature.isPlayer() || creature.getInstanceType().isType(InstanceType.FriendlyNpcInstance)) && npc.isScriptValue(1))
|
||||
{
|
||||
final double distance = npc.calculateDistance(creature, false, false);
|
||||
final double distance = npc.calculateDistance2D(creature);
|
||||
if ((distance < 450) && !CommonUtil.contains(PRISONERS, creature.getId()))
|
||||
{
|
||||
npc.setTargetable(true);
|
||||
|
@ -67,7 +67,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());
|
||||
|
@ -370,7 +370,7 @@ public final class PailakaInjuredDragon extends AbstractInstance
|
||||
}
|
||||
case "ATTACK":
|
||||
{
|
||||
if (npc.calculateDistance(player, false, false) < 100)
|
||||
if (npc.calculateDistance2D(player) < 100)
|
||||
{
|
||||
if (getRandom(100) < 30)
|
||||
{
|
||||
@ -449,7 +449,7 @@ public final class PailakaInjuredDragon extends AbstractInstance
|
||||
{
|
||||
final L2Npc latana = world.getNpc(LATANA);
|
||||
final L2PcInstance player = world.getFirstPlayer();
|
||||
if ((latana != null) && (player != null) && (latana.calculateDistance(player, false, false) <= 900))
|
||||
if ((latana != null) && (player != null) && (latana.calculateDistance2D(player) <= 900))
|
||||
{
|
||||
addSkillCastDesire(npc, player, STUN, 500000);
|
||||
}
|
||||
@ -525,7 +525,7 @@ public final class PailakaInjuredDragon extends AbstractInstance
|
||||
final int longRangeGuardRate = npc.getParameters().getInt("LongRangeGuardRate", -1);
|
||||
if ((longRangeGuardRate != -1) && ((skill != null) && !CommonUtil.contains(REJECTED_SKILLS, skill.getId())))
|
||||
{
|
||||
if (npc.calculateDistance(attacker, false, false) > 150)
|
||||
if (npc.calculateDistance2D(attacker) > 150)
|
||||
{
|
||||
if ((npc.getEffectList().getFirstBuffInfoByAbnormalType(AbnormalType.PD_UP_SPECIAL) == null) && (getRandom(100) < longRangeGuardRate))
|
||||
{
|
||||
@ -539,7 +539,7 @@ public final class PailakaInjuredDragon extends AbstractInstance
|
||||
}
|
||||
if (CommonUtil.contains(WARRIORS, npc.getId()))
|
||||
{
|
||||
if (npc.calculateDistance(attacker, false, false) < 40)
|
||||
if (npc.calculateDistance2D(attacker) < 40)
|
||||
{
|
||||
addAttackPlayerDesire(npc, attacker, 1000);
|
||||
}
|
||||
@ -595,7 +595,7 @@ public final class PailakaInjuredDragon extends AbstractInstance
|
||||
{
|
||||
final L2Npc npc = event.getNpc();
|
||||
final L2PcInstance attacker = event.getAttacker();
|
||||
if (npc.calculateDistance(attacker, false, false) < 40)
|
||||
if (npc.calculateDistance2D(attacker) < 40)
|
||||
{
|
||||
addAttackPlayerDesire(npc, attacker, 1000);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ public final class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
for (L2PcInstance member : player.getParty().getMembers())
|
||||
{
|
||||
if (member.isInsideRadius(npc, 1500, true, true))
|
||||
if (member.isInsideRadius3D(npc, 1500))
|
||||
{
|
||||
member.teleToLocation(ORBIS_LOCATION);
|
||||
}
|
||||
@ -398,7 +398,7 @@ public final class PrisonOfDarkness extends AbstractInstance
|
||||
final Instance instance = npc.getInstanceWorld();
|
||||
if (isInInstance(instance))
|
||||
{
|
||||
if ((skill == TELEPORT.getSkill()) && (player != null) && (npc.calculateDistance(player, true, false) < 1000) && (npc.getCurrentHpPercent() > 10))
|
||||
if ((skill == TELEPORT.getSkill()) && (player != null) && (npc.calculateDistance3D(player) < 1000) && (npc.getCurrentHpPercent() > 10))
|
||||
{
|
||||
player.teleToLocation(PLAYERS_TELEPORT_RANDOM_LOCS[getRandom(PLAYERS_TELEPORT_RANDOM_LOCS.length)]);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public final class TalkingIslandPast extends AbstractInstance
|
||||
|
||||
if ((instance != null) && (npc.getId() == INVISIBLE_TI_NPC) && (qs != null) && qs.isCond(21) && qs.isMemoState(1))
|
||||
{
|
||||
final Location loc = npc.isInsideRadius(TI_LOC_1, 1000, false, false) ? TI_LOC_1 : TI_LOC_2;
|
||||
final Location loc = npc.isInsideRadius2D(TI_LOC_1, 1000) ? TI_LOC_1 : TI_LOC_2;
|
||||
qs.setMemoState(2);
|
||||
final L2Npc knight = addSpawn(MYSTERIOUS_DARK_KNIGHT, loc, false, 0, false, instance.getId());
|
||||
knight.getAI().startFollow(player);
|
||||
|
@ -296,7 +296,7 @@ public class Q00144_PailakaInjuredDragon extends Quest
|
||||
final QuestState qs = getQuestState(killer, false);
|
||||
if (qs != null)
|
||||
{
|
||||
if (qs.isCond(3) && (npc.calculateDistance(killer, false, false) <= 1500))
|
||||
if (qs.isCond(3) && (npc.calculateDistance2D(killer) <= 1500))
|
||||
{
|
||||
qs.setCond(4, true);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public final class Q00149_PrimalMotherIstina extends Quest
|
||||
public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
|
||||
if ((qs != null) && player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
giveItems(player, SHILENS_MARK, 1);
|
||||
qs.setCond(2, true);
|
||||
|
@ -135,7 +135,7 @@ public final class Q00150_ExtremeChallengePrimalMotherResurrected extends Quest
|
||||
public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
|
||||
if ((qs != null) && player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
giveItems(player, SHILENS_MARK, 1);
|
||||
qs.setCond(2, true);
|
||||
|
@ -173,7 +173,7 @@ public final class Q00193_SevenSignsDyingMessage extends Quest
|
||||
}
|
||||
case "heal":
|
||||
{
|
||||
if (!npc.isInsideRadius(player, 600, true, false))
|
||||
if (!npc.isInsideRadius3D(player, 600))
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LOOK_HERE_S1_DON_T_FALL_TOO_FAR_BEHIND, player.getName());
|
||||
}
|
||||
@ -216,7 +216,7 @@ public final class Q00193_SevenSignsDyingMessage extends Quest
|
||||
}
|
||||
|
||||
final QuestState st = getQuestState(partyMember, false);
|
||||
if (npc.isInsideRadius(partyMember, 1500, true, false))
|
||||
if (npc.isInsideRadius3D(partyMember, 1500))
|
||||
{
|
||||
giveItems(partyMember, SCULPTURE_OF_DOUBT, 1);
|
||||
playSound(partyMember, QuestSound.ITEMSOUND_QUEST_FINISH);
|
||||
|
@ -231,7 +231,7 @@ public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest
|
||||
}
|
||||
|
||||
final QuestState st = getQuestState(partyMember, false);
|
||||
if (npc.isInsideRadius(partyMember, 1500, true, false))
|
||||
if (npc.isInsideRadius3D(partyMember, 1500))
|
||||
{
|
||||
giveItems(partyMember, SCULPTURE_OF_DOUBT, 1);
|
||||
playSound(partyMember, QuestSound.ITEMSOUND_QUEST_FINISH);
|
||||
|
@ -121,7 +121,7 @@ public final class Q00198_SevenSignsEmbryo extends Quest
|
||||
}
|
||||
case "heal":
|
||||
{
|
||||
if (!npc.isInsideRadius(player, 600, true, false))
|
||||
if (!npc.isInsideRadius3D(player, 600))
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LOOK_HERE_S1_DON_T_FALL_TOO_FAR_BEHIND, player.getName());
|
||||
}
|
||||
@ -179,7 +179,7 @@ public final class Q00198_SevenSignsEmbryo extends Quest
|
||||
}
|
||||
|
||||
final QuestState st = getQuestState(partyMember, false);
|
||||
if (npc.isInsideRadius(partyMember, 1500, true, false))
|
||||
if (npc.isInsideRadius3D(partyMember, 1500))
|
||||
{
|
||||
giveItems(partyMember, SCULPTURE_OF_DOUBT, 1);
|
||||
st.setCond(2, true);
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -131,7 +131,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());
|
||||
}
|
||||
|
@ -95,7 +95,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);
|
||||
}
|
||||
|
@ -1180,7 +1180,7 @@ public class Q00620_FourGoblets extends Quest
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if ((npc.isInsideRadius(partyMember, 1000, true, false) && (getQuestItemsCount(partyMember, GOBLETS[0]) < 1)))
|
||||
if ((npc.isInsideRadius3D(partyMember, 1000) && (getQuestItemsCount(partyMember, GOBLETS[0]) < 1)))
|
||||
{
|
||||
giveItems(partyMember, GOBLETS[0], 1);
|
||||
}
|
||||
@ -1192,7 +1192,7 @@ public class Q00620_FourGoblets extends Quest
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if ((npc.isInsideRadius(partyMember, 1000, true, false) && (getQuestItemsCount(partyMember, GOBLETS[1]) < 1)))
|
||||
if ((npc.isInsideRadius3D(partyMember, 1000) && (getQuestItemsCount(partyMember, GOBLETS[1]) < 1)))
|
||||
{
|
||||
giveItems(partyMember, GOBLETS[1], 1);
|
||||
}
|
||||
@ -1204,7 +1204,7 @@ public class Q00620_FourGoblets extends Quest
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if ((npc.isInsideRadius(partyMember, 1000, true, false) && (getQuestItemsCount(partyMember, GOBLETS[2]) < 1)))
|
||||
if ((npc.isInsideRadius3D(partyMember, 1000) && (getQuestItemsCount(partyMember, GOBLETS[2]) < 1)))
|
||||
{
|
||||
giveItems(partyMember, GOBLETS[2], 1);
|
||||
}
|
||||
@ -1216,7 +1216,7 @@ public class Q00620_FourGoblets extends Quest
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if ((npc.isInsideRadius(partyMember, 1000, true, false) && (getQuestItemsCount(partyMember, GOBLETS[3]) < 1)))
|
||||
if ((npc.isInsideRadius3D(partyMember, 1000) && (getQuestItemsCount(partyMember, GOBLETS[3]) < 1)))
|
||||
{
|
||||
giveItems(partyMember, GOBLETS[3], 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);
|
||||
|
@ -136,7 +136,7 @@ public class Q00776_SlayDarkLordEkimus extends Quest
|
||||
public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && qs.isCond(1) && player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
|
||||
if ((qs != null) && qs.isCond(1) && player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class Q00777_SlayDarkLordTiat extends Quest
|
||||
public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && qs.isCond(1) && player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
|
||||
if ((qs != null) && qs.isCond(1) && player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class Q10304_ForForgottenHeroes extends Quest
|
||||
{
|
||||
int cond = qs.getCond();
|
||||
int npcId = npc.getId();
|
||||
if (player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
|
||||
if (player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
if ((npcId == YUI) && (cond == 2))
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ public final class Q10316_UndecayingMemoryOfThePast extends Quest
|
||||
public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
|
||||
if ((qs != null) && player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public final class Q10326_RespectYourElders extends Quest
|
||||
final L2PcInstance owner = npc.getVariables().getObject("OWNER", L2PcInstance.class);
|
||||
if (owner != null)
|
||||
{
|
||||
if (npc.calculateDistance(owner, false, false) < 120)
|
||||
if (npc.calculateDistance2D(owner) < 120)
|
||||
{
|
||||
npc.getVariables().set("FAIL_COUNT", 0);
|
||||
final int loc_index = npc.getVariables().getInt("MOVE_INDEX", -1) + 1;
|
||||
|
@ -128,7 +128,7 @@ public final class Q10329_BackupSeekers extends Quest
|
||||
final L2PcInstance owner = npc.getSummoner().getActingPlayer();
|
||||
if (owner != null)
|
||||
{
|
||||
if (npc.calculateDistance(owner, false, false) < 150)
|
||||
if (npc.calculateDistance2D(owner) < 150)
|
||||
{
|
||||
npc.getVariables().set("FAIL_COUNT", 0);
|
||||
final int loc_index = npc.getVariables().getInt("MOVE_INDEX", -1) + 1;
|
||||
|
@ -136,7 +136,7 @@ public final class Q10351_OwnerOfHall extends Quest
|
||||
public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
|
||||
if ((qs != null) && player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public final class Q10354_ResurrectedOwnerOfHall extends Quest
|
||||
public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
|
||||
if ((qs != null) && player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ public final class Q10363_RequestOfTheSeeker extends Quest
|
||||
{
|
||||
final L2Npc npc = (L2Npc) player.getTarget();
|
||||
|
||||
if (!player.isInsideRadius(npc, 120, true, true))
|
||||
if (!player.isInsideRadius3D(npc, 120))
|
||||
{
|
||||
showOnScreenMsg(player, NpcStringId.YOU_ARE_TOO_FAR_FROM_THE_CORPSE, ExShowScreenMessage.TOP_CENTER, 4500);
|
||||
npc.deleteMe();
|
||||
|
@ -142,7 +142,7 @@ public final class Q10365_SeekerEscort extends Quest
|
||||
final L2PcInstance owner = npc.getSummoner().getActingPlayer();
|
||||
if (owner != null)
|
||||
{
|
||||
if (npc.calculateDistance(owner, false, false) < 180)
|
||||
if (npc.calculateDistance2D(owner) < 180)
|
||||
{
|
||||
npc.getVariables().set("FAIL_COUNT", 0);
|
||||
final int loc_index = npc.getVariables().getInt("MOVE_INDEX", -1) + 1;
|
||||
|
@ -443,7 +443,7 @@ public final class Q10369_NoblesseSoulTesting extends Quest
|
||||
final L2PcInstance partyMember = getRandomPartyMember(killer);
|
||||
final QuestState qs = getQuestState(partyMember, false);
|
||||
|
||||
if (canProgress(partyMember) && (qs != null) && qs.isStarted() && (partyMember.calculateDistance(npc, false, false) <= 1500))
|
||||
if (canProgress(partyMember) && (qs != null) && qs.isStarted() && (partyMember.calculateDistance2D(npc) <= 1500))
|
||||
{
|
||||
switch (qs.getCond())
|
||||
{
|
||||
@ -629,11 +629,11 @@ public final class Q10369_NoblesseSoulTesting extends Quest
|
||||
qs.setCond(17, true);
|
||||
giveItems(player, ASHES_OF_REMNANTS, 1);
|
||||
|
||||
if (npc.isInsideRadius(HELPING_TREE_LOC_1, 2000, false, false))
|
||||
if (npc.isInsideRadius2D(HELPING_TREE_LOC_1, 2000))
|
||||
{
|
||||
addSpawn(HELPING_TREE, HELPING_TREE_LOC_1, false, 300000);
|
||||
}
|
||||
else if (npc.isInsideRadius(HELPING_TREE_LOC_2, 2000, false, false))
|
||||
else if (npc.isInsideRadius2D(HELPING_TREE_LOC_2, 2000))
|
||||
{
|
||||
addSpawn(HELPING_TREE, HELPING_TREE_LOC_2, false, 300000);
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ public final class Q10385_RedThreadOfFate extends Quest
|
||||
{
|
||||
final L2Npc npc = (L2Npc) player.getTarget();
|
||||
|
||||
if (((qs != null) && (qs.isCond(3))) && (event.getSocialActionId() == SOCIAL_BOW) && (player.isInsideRadius(npc, 120, true, true)))
|
||||
if (((qs != null) && (qs.isCond(3))) && (event.getSocialActionId() == SOCIAL_BOW) && (player.isInsideRadius3D(npc, 120)))
|
||||
{
|
||||
qs.setCond(4, true);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public final class Q10742_AFurryFriend extends Quest
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
|
||||
|
||||
// Check Ricky position
|
||||
final double distanceToRicky = player.calculateDistance(npc, false, false);
|
||||
final double distanceToRicky = player.calculateDistance2D(npc);
|
||||
if (distanceToRicky > 350)
|
||||
{
|
||||
showOnScreenMsg(player, NpcStringId.YOU_ARE_FAR_FROM_RICKY, ExShowScreenMessage.TOP_CENTER, 5000);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user