Diagonal movement GeoEngine.

This commit is contained in:
MobiusDev
2017-08-26 20:50:32 +00:00
parent 1e943ff506
commit 05f0a141c3
549 changed files with 25017 additions and 20141 deletions

View File

@@ -19,7 +19,7 @@ package handlers.actionhandlers;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.IActionHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location;
@@ -82,13 +82,13 @@ public class L2NpcAction implements IActionHandler
// Check if the activeChar is attackable (without a forced attack) and isn't dead
if (target.isAutoAttackable(activeChar) && !((L2Npc) target).isAlikeDead())
{
if (GeoData.getInstance().canSeeTarget(activeChar, target))
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
else
{
final Location destination = GeoData.getInstance().moveCheck(activeChar, target);
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), target.getX(), target.getY(), target.getZ(), activeChar.getInstanceId());
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
}
}

View File

@@ -19,7 +19,7 @@ package handlers.actionhandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.IActionHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location;
@@ -102,13 +102,13 @@ public class L2PcInstanceAction implements IActionHandler
}
else
{
if (GeoData.getInstance().canSeeTarget(activeChar, player))
if (GeoEngine.getInstance().canSeeTarget(activeChar, player))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
}
else
{
final Location destination = GeoData.getInstance().moveCheck(activeChar, player);
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), player.getX(), player.getY(), player.getZ(), activeChar.getInstanceId());
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
}
activeChar.onActionRequest();
@@ -118,13 +118,13 @@ 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 (GeoData.getInstance().canSeeTarget(activeChar, player))
if (GeoEngine.getInstance().canSeeTarget(activeChar, player))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
}
else
{
final Location destination = GeoData.getInstance().moveCheck(activeChar, player);
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), player.getX(), player.getY(), player.getZ(), activeChar.getInstanceId());
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
}
}

View File

@@ -18,7 +18,7 @@ package handlers.actionhandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.IActionHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -58,7 +58,7 @@ 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 (GeoData.getInstance().canSeeTarget(activeChar, target))
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
{
// Set the L2PcInstance Intention to AI_INTENTION_ATTACK
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
@@ -67,7 +67,7 @@ public class L2PetInstanceAction implements IActionHandler
}
else if (!((L2Character) target).isInsideRadius(activeChar, 150, false, false))
{
if (GeoData.getInstance().canSeeTarget(activeChar, target))
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
activeChar.onActionRequest();

View File

@@ -18,7 +18,7 @@ package handlers.actionhandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.IActionHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Summon;
@@ -58,7 +58,7 @@ public class L2SummonAction implements IActionHandler
{
if (target.isAutoAttackable(activeChar))
{
if (GeoData.getInstance().canSeeTarget(activeChar, target))
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
activeChar.onActionRequest();
@@ -74,7 +74,7 @@ public class L2SummonAction implements IActionHandler
}
else
{
if (GeoData.getInstance().canSeeTarget(activeChar, target))
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
}

View File

@@ -18,7 +18,7 @@ package handlers.admincommandhandlers;
import java.util.StringTokenizer;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
@@ -54,12 +54,12 @@ public class AdminGeodata implements IAdminCommandHandler
final int worldX = activeChar.getX();
final int worldY = activeChar.getY();
final int worldZ = activeChar.getZ();
final int geoX = GeoData.getInstance().getGeoX(worldX);
final int geoY = GeoData.getInstance().getGeoY(worldY);
final int geoX = GeoEngine.getInstance().getGeoX(worldX);
final int geoY = GeoEngine.getInstance().getGeoY(worldY);
if (GeoData.getInstance().hasGeoPos(geoX, geoY))
if (GeoEngine.getInstance().hasGeoPos(geoX, geoY))
{
activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getNearestZ(geoX, geoY, worldZ));
activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoEngine.getInstance().getHeight(geoX, geoY, worldZ));
}
else
{
@@ -72,12 +72,12 @@ public class AdminGeodata implements IAdminCommandHandler
final int worldX = activeChar.getX();
final int worldY = activeChar.getY();
final int worldZ = activeChar.getZ();
final int geoX = GeoData.getInstance().getGeoX(worldX);
final int geoY = GeoData.getInstance().getGeoY(worldY);
final int geoX = GeoEngine.getInstance().getGeoX(worldX);
final int geoY = GeoEngine.getInstance().getGeoY(worldY);
if (GeoData.getInstance().hasGeoPos(geoX, geoY))
if (GeoEngine.getInstance().hasGeoPos(geoX, geoY))
{
activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getSpawnHeight(worldX, worldY, worldZ));
activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoEngine.getInstance().getHeight(worldX, worldY, worldZ));
}
else
{
@@ -90,7 +90,7 @@ public class AdminGeodata implements IAdminCommandHandler
final L2Object target = activeChar.getTarget();
if (target != null)
{
if (GeoData.getInstance().canSeeTarget(activeChar, target))
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
{
activeChar.sendMessage("Can move beeline.");
}
@@ -110,7 +110,7 @@ public class AdminGeodata implements IAdminCommandHandler
final L2Object target = activeChar.getTarget();
if (target != null)
{
if (GeoData.getInstance().canSeeTarget(activeChar, target))
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
{
activeChar.sendMessage("Can see target.");
}

View File

@@ -18,78 +18,49 @@ package handlers.admincommandhandlers;
import java.util.List;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.geodata.pathfinding.AbstractNodeLoc;
import com.l2jmobius.gameserver.geodata.pathfinding.PathFinding;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
public class AdminPathNode implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_pn_info",
"admin_show_path",
"admin_path_debug",
"admin_show_pn",
"admin_find_path",
"admin_path_find",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_pn_info"))
if (command.equals("admin_path_find"))
{
final String[] info = PathFinding.getInstance().getStat();
if (info == null)
{
activeChar.sendMessage("Not supported");
}
else
{
for (String msg : info)
{
activeChar.sendMessage(msg);
}
}
}
else if (command.equals("admin_show_path"))
{
}
else if (command.equals("admin_path_debug"))
{
}
else if (command.equals("admin_show_pn"))
{
}
else if (command.equals("admin_find_path"))
{
if (Config.PATHFINDING == 0)
{
activeChar.sendMessage("PathFinding is disabled.");
return true;
}
if (activeChar.getTarget() != null)
{
final List<AbstractNodeLoc> path = PathFinding.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId(), true);
List<Location> path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId(), true);
if (path == null)
{
activeChar.sendMessage("No Route!");
return true;
activeChar.sendMessage("No route found or pathfinding disabled.");
}
for (AbstractNodeLoc a : path)
else
{
activeChar.sendMessage("x:" + a.getX() + " y:" + a.getY() + " z:" + a.getZ());
for (Location point : path)
{
activeChar.sendMessage("x:" + point.getX() + " y:" + point.getY() + " z:" + point.getZ());
}
}
}
else
{
activeChar.sendMessage("No Target!");
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else
{
return false;
}
return true;
}

View File

@@ -60,7 +60,7 @@ public class AdminServerInfo implements IAdminCommandHandler
html.replace("%slots%", getPlayersCount("ALL") + "/" + Config.MAXIMUM_ONLINE_USERS);
html.replace("%gameTime%", GameTimeController.getInstance().getGameHour() + ":" + GameTimeController.getInstance().getGameMinute());
html.replace("%dayNight%", GameTimeController.getInstance().isNight() ? "Night" : "Day");
html.replace("%geodata%", Config.PATHFINDING > 0 ? "Enabled" : "Disabled");
html.replace("%geodata%", Config.PATHFINDING ? "Enabled" : "Disabled");
html.replace("%serverTime%", fmt.format(new Date(System.currentTimeMillis())));
html.replace("%serverUpTime%", getServerUpTime());
html.replace("%onlineAll%", getPlayersCount("ALL"));

View File

@@ -31,7 +31,7 @@ import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.enums.PlayerAction;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.Location;
@@ -262,7 +262,7 @@ public class AdminZones extends AbstractNpcAI implements IAdminCommandHandler
{
final int x = zone.getX()[i];
final int y = zone.getY()[i];
holder.addNode(new Location(x, y, GeoData.getInstance().getSpawnHeight(x, y, Rnd.get(zone.getLowZ(), zone.getHighZ()))));
holder.addNode(new Location(x, y, GeoEngine.getInstance().getHeight(x, y, Rnd.get(zone.getLowZ(), zone.getHighZ()))));
}
showPoints(activeChar);
}

View File

@@ -17,7 +17,7 @@
package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -70,7 +70,7 @@ public final class Blink extends AbstractEffect
final int y = effected.getY() + y1;
final int z = effected.getZ();
final Location destination = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.DUMMY));

View File

@@ -16,7 +16,7 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
@@ -91,7 +91,7 @@ public final class EnemyCharge extends AbstractEffect
final int y = curY + (int) ((distance - offset) * sin);
final int z = info.getEffected().getZ();
final Location destination = GeoData.getInstance().moveCheck(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(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));

View File

@@ -17,8 +17,9 @@
package handlers.effecthandlers;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.PcCondOverride;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -237,19 +238,19 @@ public final class Fishing extends AbstractEffect
// always use water zone, fishing zone high z is high in the air...
final int baitZ = waterZone.getWaterZ();
if (!GeoData.getInstance().canSeeTarget(player.getX(), player.getY(), player.getZ(), baitX, baitY, baitZ))
if (!GeoEngine.getInstance().canSeeTarget(player, new Location(baitX, baitY, baitZ)))
{
return Integer.MIN_VALUE;
}
if (GeoData.getInstance().hasGeo(baitX, baitY))
if (GeoEngine.getInstance().hasGeo(baitX, baitY))
{
if (GeoData.getInstance().getHeight(baitX, baitY, baitZ) > baitZ)
if (GeoEngine.getInstance().getHeight(baitX, baitY, baitZ) > baitZ)
{
return Integer.MIN_VALUE;
}
if (GeoData.getInstance().getHeight(baitX, baitY, player.getZ()) > baitZ)
if (GeoEngine.getInstance().getHeight(baitX, baitY, player.getZ()) > baitZ)
{
return Integer.MIN_VALUE;
}

View File

@@ -17,7 +17,7 @@
package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -78,7 +78,7 @@ public final class TeleportToTarget extends AbstractEffect
final int y = (int) (py + (25 * Math.sin(ph)));
final int z = target.getZ();
final Location loc = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceId());
final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(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));

View File

@@ -16,7 +16,7 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
@@ -95,7 +95,7 @@ public final class ThrowUp extends AbstractEffect
final int y = info.getEffector().getY() - (int) (offset * sin);
final int z = info.getEffected().getZ();
final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId());
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId());
info.getEffected().broadcastPacket(new FlyToLocation(info.getEffected(), destination, FlyType.THROW_UP));
// TODO: Review.

View File

@@ -22,7 +22,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.ITargetTypeHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -100,7 +100,7 @@ public class AreaFriendly implements ITargetTypeHandler
private boolean checkTarget(L2PcInstance activeChar, L2Character target)
{
if (!GeoData.getInstance().canSeeTarget(activeChar, target))
if (!GeoEngine.getInstance().canSeeTarget(activeChar, target))
{
return false;
}