Distance checking methods rework.
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
| @@ -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); | ||||
| 			} | ||||
|   | ||||
| @@ -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)); | ||||
|   | ||||
| @@ -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++) | ||||
| 			{ | ||||
|   | ||||
| @@ -323,7 +323,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; | ||||
| 			} | ||||
|   | ||||
| @@ -77,7 +77,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())) | ||||
| 				{ | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -88,7 +88,7 @@ public class BossDailyMissionHandler extends AbstractDailyMissionHandler | ||||
| 			{ | ||||
| 				final L2CommandChannel channel = party.getCommandChannel(); | ||||
| 				final List<L2PcInstance> members = channel != null ? channel.getMembers() : party.getMembers(); | ||||
| 				members.stream().filter(member -> member.calculateDistance(monster, true, false) <= Config.ALT_PARTY_RANGE).forEach(this::processPlayerProgress); | ||||
| 				members.stream().filter(member -> member.calculateDistance3D(monster) <= Config.ALT_PARTY_RANGE).forEach(this::processPlayerProgress); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
|   | ||||
| @@ -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; | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDev
					MobiusDev