From fdbdd632e02b729b7861a8479e9986e69bde55b9 Mon Sep 17 00:00:00 2001
From: NosBit <NosBit@users.noreply.github.com>
Date: Thu, 15 Jan 2015 20:38:53 +0200
Subject: [PATCH] DP-Part for
 L2J/L2J_Server@cef5f170c4d832ea1d5842bd73a5252559526338

---
 .../ai/group_template/FleeMonsters.java       | 11 +--------
 .../actionhandlers/L2PcInstanceAction.java    | 20 ++--------------
 .../actionhandlers/L2PetInstanceAction.java   | 23 +++----------------
 .../actionhandlers/L2SummonAction.java        | 17 ++------------
 .../admincommandhandlers/AdminPathNode.java   |  4 ++--
 .../handlers/effecthandlers/Blink.java        | 12 ++++------
 .../handlers/effecthandlers/EnemyCharge.java  | 13 ++++-------
 .../scripts/handlers/effecthandlers/Fear.java | 11 ++-------
 .../effecthandlers/TeleportToTarget.java      |  8 ++-----
 .../handlers/effecthandlers/ThrowUp.java      | 12 +++-------
 .../handlers/targethandlers/AreaFriendly.java |  3 +--
 .../CrystalCaverns/CrystalCaverns.java        | 12 ++++------
 12 files changed, 30 insertions(+), 116 deletions(-)

diff --git a/L2J_DataPack/dist/game/data/scripts/ai/group_template/FleeMonsters.java b/L2J_DataPack/dist/game/data/scripts/ai/group_template/FleeMonsters.java
index 6e51a588e5..a94528e587 100644
--- a/L2J_DataPack/dist/game/data/scripts/ai/group_template/FleeMonsters.java
+++ b/L2J_DataPack/dist/game/data/scripts/ai/group_template/FleeMonsters.java
@@ -20,7 +20,6 @@ package ai.group_template;
 
 import ai.npc.AbstractNpcAI;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.model.Location;
@@ -74,15 +73,7 @@ public final class FleeMonsters extends AbstractNpcAI
 		final int posY = (int) (npc.getY() + (FLEE_DISTANCE * Math.sin(radians)));
 		final int posZ = npc.getZ();
 		
-		final Location destination;
-		if (Config.GEODATA > 0)
-		{
-			destination = GeoData.getInstance().moveCheck(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, attacker.getInstanceId());
-		}
-		else
-		{
-			destination = new Location(posX, posY, posZ);
-		}
+		final Location destination = GeoData.getInstance().moveCheck(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, attacker.getInstanceId());
 		npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
 		return super.onAttack(npc, attacker, damage, isSummon);
 	}
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java b/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java
index 947546bfc1..b89956755b 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java
@@ -18,7 +18,6 @@
  */
 package handlers.actionhandlers;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.enums.InstanceType;
@@ -101,15 +100,7 @@ public class L2PcInstanceAction implements IActionHandler
 					}
 					else
 					{
-						if (Config.GEODATA > 0)
-						{
-							if (GeoData.getInstance().canSeeTarget(activeChar, target))
-							{
-								activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
-								activeChar.onActionRequest();
-							}
-						}
-						else
+						if (GeoData.getInstance().canSeeTarget(activeChar, target))
 						{
 							activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
 							activeChar.onActionRequest();
@@ -120,14 +111,7 @@ public class L2PcInstanceAction implements IActionHandler
 				{
 					// This Action Failed packet avoids activeChar getting stuck when clicking three or more times
 					activeChar.sendPacket(ActionFailed.STATIC_PACKET);
-					if (Config.GEODATA > 0)
-					{
-						if (GeoData.getInstance().canSeeTarget(activeChar, target))
-						{
-							activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
-						}
-					}
-					else
+					if (GeoData.getInstance().canSeeTarget(activeChar, target))
 					{
 						activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
 					}
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2PetInstanceAction.java b/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2PetInstanceAction.java
index b9247c8328..1a6895331e 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2PetInstanceAction.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2PetInstanceAction.java
@@ -18,7 +18,6 @@
  */
 package handlers.actionhandlers;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.enums.InstanceType;
@@ -61,32 +60,16 @@ public class L2PetInstanceAction implements IActionHandler
 			// Check if the pet is attackable (without a forced attack) and isn't dead
 			if (target.isAutoAttackable(activeChar) && !isOwner)
 			{
-				if (Config.GEODATA > 0)
-				{
-					if (GeoData.getInstance().canSeeTarget(activeChar, target))
-					{
-						// Set the L2PcInstance Intention to AI_INTENTION_ATTACK
-						activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
-						activeChar.onActionRequest();
-					}
-				}
-				else
+				if (GeoData.getInstance().canSeeTarget(activeChar, target))
 				{
+					// Set the L2PcInstance Intention to AI_INTENTION_ATTACK
 					activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
 					activeChar.onActionRequest();
 				}
 			}
 			else if (!((L2Character) target).isInsideRadius(activeChar, 150, false, false))
 			{
-				if (Config.GEODATA > 0)
-				{
-					if (GeoData.getInstance().canSeeTarget(activeChar, target))
-					{
-						activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
-						activeChar.onActionRequest();
-					}
-				}
-				else
+				if (GeoData.getInstance().canSeeTarget(activeChar, target))
 				{
 					activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
 					activeChar.onActionRequest();
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2SummonAction.java b/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2SummonAction.java
index 962aebe58f..a2ad9f1a48 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2SummonAction.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/actionhandlers/L2SummonAction.java
@@ -18,7 +18,6 @@
  */
 package handlers.actionhandlers;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.enums.InstanceType;
@@ -61,15 +60,7 @@ public class L2SummonAction implements IActionHandler
 		{
 			if (target.isAutoAttackable(activeChar))
 			{
-				if (Config.GEODATA > 0)
-				{
-					if (GeoData.getInstance().canSeeTarget(activeChar, target))
-					{
-						activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
-						activeChar.onActionRequest();
-					}
-				}
-				else
+				if (GeoData.getInstance().canSeeTarget(activeChar, target))
 				{
 					activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
 					activeChar.onActionRequest();
@@ -83,17 +74,13 @@ public class L2SummonAction implements IActionHandler
 				{
 					activeChar.updateNotMoveUntil();
 				}
-				else if (Config.GEODATA > 0)
+				else
 				{
 					if (GeoData.getInstance().canSeeTarget(activeChar, target))
 					{
 						activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
 					}
 				}
-				else
-				{
-					activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
-				}
 			}
 		}
 		return true;
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java b/L2J_DataPack/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java
index 1ba87c8505..c6c3dd2cdf 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java
@@ -69,9 +69,9 @@ public class AdminPathNode implements IAdminCommandHandler
 		}
 		else if (command.equals("admin_find_path"))
 		{
-			if (Config.GEODATA < 2)
+			if (Config.PATHFINDING == 0)
 			{
-				activeChar.sendMessage("PathFinding has not been enabled.");
+				activeChar.sendMessage("PathFinding is disabled.");
 				return true;
 			}
 			if (activeChar.getTarget() != null)
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Blink.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Blink.java
index f1dd6b7434..40c32a246c 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Blink.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Blink.java
@@ -18,7 +18,6 @@
  */
 package handlers.effecthandlers;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.model.Location;
@@ -72,17 +71,14 @@ public final class Blink extends AbstractEffect
 		int x = effected.getX() + x1;
 		int y = effected.getY() + y1;
 		int z = effected.getZ();
-		Location loc = new Location(x, y, z);
-		if (Config.GEODATA > 0)
-		{
-			loc = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
-		}
+		
+		final Location destination = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
 		
 		effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		effected.broadcastPacket(new FlyToLocation(effected, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
+		effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.DUMMY));
 		effected.abortAttack();
 		effected.abortCast();
-		effected.setXYZ(loc);
+		effected.setXYZ(destination);
 		effected.broadcastPacket(new ValidateLocation(effected));
 	}
 }
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java
index e8b849b503..f73665d50c 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java
@@ -18,7 +18,6 @@
  */
 package handlers.effecthandlers;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.StatsSet;
@@ -94,16 +93,12 @@ public final class EnemyCharge extends AbstractEffect
 		int y = curY + (int) ((distance - offset) * sin);
 		int z = info.getEffected().getZ();
 		
-		if (Config.GEODATA > 0)
-		{
-			Location destiny = GeoData.getInstance().moveCheck(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
-			x = destiny.getX();
-			y = destiny.getY();
-		}
-		info.getEffector().broadcastPacket(new FlyToLocation(info.getEffector(), x, y, z, FlyType.CHARGE));
+		final Location destination = GeoData.getInstance().moveCheck(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
+		
+		info.getEffector().broadcastPacket(new FlyToLocation(info.getEffector(), destination, FlyType.CHARGE));
 		
 		// maybe is need force set X,Y,Z
-		info.getEffector().setXYZ(x, y, z);
+		info.getEffector().setXYZ(destination);
 		info.getEffector().broadcastPacket(new ValidateLocation(info.getEffector()));
 	}
 }
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Fear.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Fear.java
index dd5fe65f9e..1c07b35c01 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Fear.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Fear.java
@@ -18,7 +18,6 @@
  */
 package handlers.effecthandlers;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.ai.CtrlEvent;
 import com.l2jserver.gameserver.ai.CtrlIntention;
@@ -101,18 +100,12 @@ public final class Fear extends AbstractEffect
 		int posY = (int) (info.getEffected().getY() + (FEAR_RANGE * Math.sin(radians)));
 		int posZ = info.getEffected().getZ();
 		
-		if (Config.GEODATA > 0)
-		{
-			Location destiny = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
-			posX = destiny.getX();
-			posY = destiny.getY();
-		}
-		
 		if (!info.getEffected().isPet())
 		{
 			info.getEffected().setRunning();
 		}
 		
-		info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ));
+		final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
+		info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
 	}
 }
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/TeleportToTarget.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/TeleportToTarget.java
index 284a5255fa..c5c5799fc7 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/TeleportToTarget.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/TeleportToTarget.java
@@ -18,7 +18,6 @@
  */
 package handlers.effecthandlers;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.model.Location;
@@ -80,11 +79,8 @@ public final class TeleportToTarget extends AbstractEffect
 		int x = (int) (px + (25 * Math.cos(ph)));
 		int y = (int) (py + (25 * Math.sin(ph)));
 		int z = target.getZ();
-		Location loc = new Location(x, y, z);
-		if (Config.GEODATA > 0)
-		{
-			loc = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceId());
-		}
+		
+		final Location loc = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceId());
 		
 		activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 		activeChar.broadcastPacket(new FlyToLocation(activeChar, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/ThrowUp.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/ThrowUp.java
index e71f399d27..0552d4f331 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/ThrowUp.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/ThrowUp.java
@@ -18,7 +18,6 @@
  */
 package handlers.effecthandlers;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.StatsSet;
@@ -98,16 +97,11 @@ public final class ThrowUp extends AbstractEffect
 		int y = info.getEffector().getY() - (int) (offset * sin);
 		int z = info.getEffected().getZ();
 		
-		if (Config.GEODATA > 0)
-		{
-			Location destiny = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId());
-			x = destiny.getX();
-			y = destiny.getY();
-		}
+		final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId());
 		
-		info.getEffected().broadcastPacket(new FlyToLocation(info.getEffected(), x, y, z, FlyType.THROW_UP));
+		info.getEffected().broadcastPacket(new FlyToLocation(info.getEffected(), destination, FlyType.THROW_UP));
 		// TODO: Review.
-		info.getEffected().setXYZ(x, y, z);
+		info.getEffected().setXYZ(destination);
 		info.getEffected().broadcastPacket(new ValidateLocation(info.getEffected()));
 	}
 }
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/targethandlers/AreaFriendly.java b/L2J_DataPack/dist/game/data/scripts/handlers/targethandlers/AreaFriendly.java
index 9062953661..11fdb7bc23 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/targethandlers/AreaFriendly.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/targethandlers/AreaFriendly.java
@@ -24,7 +24,6 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import com.l2jserver.Config;
 import com.l2jserver.gameserver.GeoData;
 import com.l2jserver.gameserver.handler.ITargetTypeHandler;
 import com.l2jserver.gameserver.model.L2Object;
@@ -99,7 +98,7 @@ public class AreaFriendly implements ITargetTypeHandler
 	
 	private boolean checkTarget(L2Character activeChar, L2Character target)
 	{
-		if ((Config.GEODATA > 0) && !GeoData.getInstance().canSeeTarget(activeChar, target))
+		if (!GeoData.getInstance().canSeeTarget(activeChar, target))
 		{
 			return false;
 		}
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java b/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
index 4b8c5eadd7..a73a95869b 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
@@ -1642,16 +1642,12 @@ public final class CrystalCaverns extends Quest
 		int _y = effector.getY() - (int) (offset * sin);
 		int _z = effected.getZ();
 		
-		if (Config.GEODATA > 0)
-		{
-			Location destiny = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), _x, _y, _z, effected.getInstanceId());
-			_x = destiny.getX();
-			_y = destiny.getY();
-		}
-		effected.broadcastPacket(new FlyToLocation(effected, _x, _y, _z, FlyType.THROW_UP));
+		Location destination = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), _x, _y, _z, effected.getInstanceId());
+		
+		effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.THROW_UP));
 		
 		// maybe is need force set X,Y,Z
-		effected.setXYZ(_x, _y, _z);
+		effected.setXYZ(destination);
 		effected.broadcastPacket(new ValidateLocation(effected));
 	}
 	
-- 
GitLab