New l2j geoengine rework.

This commit is contained in:
MobiusDevelopment
2021-03-28 21:17:00 +00:00
parent fb5a0626cd
commit 061bc41de8
1388 changed files with 61022 additions and 193387 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -23,8 +23,8 @@ a - Prerequisites
b - Make it work
----------------------------------------------
To make geodata working:
* unpack your geodata files into "/data/geodata" folder
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
- CoordSynchronize = 2
* If you do not use any geodata files, the server will automatically change this setting to -1.
To make geodata work:
* unpack your geodata files into "/data/geodata" folder (or any other folder)
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following configs:
- GeoDataPath = set path to your geodata, if elsewhere than "./data/geodata/"
- GeoDataType = set the geodata format, which you are using.

View File

@@ -270,7 +270,7 @@ public class PrimevalIsle extends AbstractNpcAI
final double cos = Math.cos(radian);
final int newX = (int) (npc.getX() + (cos * distance));
final int newY = (int) (npc.getY() + (sin * distance));
final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(npc.getX(), npc.getY(), npc.getZ(), newX, newY, npc.getZ(), npc.getInstanceId());
final Location loc = GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), newX, newY, npc.getZ(), npc.getInstanceId());
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc, 0);
}
else if (ag_type == 1)

View File

@@ -69,7 +69,7 @@ public class FleeMonsters extends AbstractNpcAI
final int posX = (int) (npc.getX() + (FLEE_DISTANCE * Math.cos(radians)));
final int posY = (int) (npc.getY() + (FLEE_DISTANCE * Math.sin(radians)));
final int posZ = npc.getZ();
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, attacker.getInstanceId());
final Location destination = GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceId());
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
return super.onAttack(npc, attacker, damage, isSummon);
}

View File

@@ -55,8 +55,8 @@ public class AdminGeodata implements IAdminCommandHandler
final int worldX = activeChar.getX();
final int worldY = activeChar.getY();
final int worldZ = activeChar.getZ();
final int geoX = GeoEngine.getInstance().getGeoX(worldX);
final int geoY = GeoEngine.getInstance().getGeoY(worldY);
final int geoX = GeoEngine.getGeoX(worldX);
final int geoY = GeoEngine.getGeoY(worldY);
if (GeoEngine.getInstance().hasGeoPos(geoX, geoY))
{
@@ -73,8 +73,8 @@ public class AdminGeodata implements IAdminCommandHandler
final int worldX = activeChar.getX();
final int worldY = activeChar.getY();
final int worldZ = activeChar.getZ();
final int geoX = GeoEngine.getInstance().getGeoX(worldX);
final int geoY = GeoEngine.getInstance().getGeoY(worldY);
final int geoX = GeoEngine.getGeoX(worldX);
final int geoY = GeoEngine.getGeoY(worldY);
if (GeoEngine.getInstance().hasGeoPos(geoX, geoY))
{
@@ -133,8 +133,8 @@ public class AdminGeodata implements IAdminCommandHandler
}
case "admin_geomap":
{
final int x = ((activeChar.getX() - World.MAP_MIN_X) >> 15) + World.TILE_X_MIN;
final int y = ((activeChar.getY() - World.MAP_MIN_Y) >> 15) + World.TILE_Y_MIN;
final int x = ((activeChar.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
final int y = ((activeChar.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
BuilderUtil.sendSysMessage(activeChar, "GeoMap: " + x + "_" + y + " (" + ((x - World.TILE_ZERO_COORD_X) * World.TILE_SIZE) + "," + ((y - World.TILE_ZERO_COORD_Y) * World.TILE_SIZE) + " to " + ((((x - World.TILE_ZERO_COORD_X) * World.TILE_SIZE) + World.TILE_SIZE) - 1) + "," + ((((y - World.TILE_ZERO_COORD_Y) * World.TILE_SIZE) + World.TILE_SIZE) - 1) + ")");
break;
}

View File

@@ -19,9 +19,9 @@ package handlers.admincommandhandlers;
import java.util.List;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.geoengine.GeoEnginePathfinding;
import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.util.BuilderUtil;
@@ -44,13 +44,13 @@ public class AdminPathNode implements IAdminCommandHandler
}
if (activeChar.getTarget() != null)
{
final List<AbstractNodeLoc> path = GeoEnginePathfinding.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId());
final 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());
if (path == null)
{
BuilderUtil.sendSysMessage(activeChar, "No Route!");
return true;
}
for (AbstractNodeLoc a : path)
for (Location a : path)
{
BuilderUtil.sendSysMessage(activeChar, "x:" + a.getX() + " y:" + a.getY() + " z:" + a.getZ());
}

View File

@@ -68,7 +68,7 @@ public class Blink extends AbstractEffect
final int x = effected.getX() + x1;
final int y = effected.getY() + y1;
final int z = effected.getZ();
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
final Location destination = GeoEngine.getInstance().getValidLocation(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));
effected.abortAttack();

View File

@@ -90,7 +90,7 @@ public class EnemyCharge extends AbstractEffect
final int x = curX + (int) ((distance - offset) * cos);
final int y = curY + (int) ((distance - offset) * sin);
final int z = info.getEffected().getZ();
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
final Location destination = GeoEngine.getInstance().getValidLocation(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

View File

@@ -236,7 +236,7 @@ public class Fishing extends AbstractEffect
// always use water zone, fishing zone high z is high in the air...
final int baitZ = waterZone.getWaterZ();
if (!GeoEngine.getInstance().canSeeTarget(player, new Location(baitX, baitY, baitZ)))
if (!GeoEngine.getInstance().canSeeLocation(player, new Location(baitX, baitY, baitZ)))
{
return Integer.MIN_VALUE;
}

View File

@@ -82,7 +82,7 @@ public class TeleportToTarget extends AbstractEffect
final int x = (int) (px + (25 * Math.cos(ph)));
final int y = (int) (py + (25 * Math.sin(ph)));
final int z = target.getZ();
final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(creature.getX(), creature.getY(), creature.getZ(), x, y, z, creature.getInstanceId());
final Location loc = GeoEngine.getInstance().getValidLocation(creature.getX(), creature.getY(), creature.getZ(), x, y, z, creature.getInstanceId());
creature.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
creature.broadcastPacket(new FlyToLocation(creature, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
creature.abortAttack();

View File

@@ -93,7 +93,7 @@ public class ThrowUp extends AbstractEffect
final int x = info.getEffector().getX() - (int) (offset * cos);
final int y = info.getEffector().getY() - (int) (offset * sin);
final int z = info.getEffected().getZ();
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId());
final Location destination = GeoEngine.getInstance().getValidLocation(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.
info.getEffected().setXYZ(destination);

View File

@@ -65,7 +65,7 @@ public class RollingDice implements IItemHandler
final int x = player.getX() + x1;
final int y = player.getY() + y1;
final int z = player.getZ();
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(player.getX(), player.getY(), player.getZ(), x, y, z, player.getInstanceId());
final Location destination = GeoEngine.getInstance().getValidLocation(player.getX(), player.getY(), player.getZ(), x, y, z, player.getInstanceId());
Broadcast.toSelfAndKnownPlayers(player, new Dice(player.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ()));
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2);

View File

@@ -677,7 +677,7 @@ public class CrystalCaverns extends AbstractInstance
final int _x = effector.getX() - (int) (offset * cos);
final int _y = effector.getY() - (int) (offset * sin);
final int _z = effected.getZ();
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(effected.getX(), effected.getY(), effected.getZ(), _x, _y, _z, effected.getInstanceId());
final Location destination = GeoEngine.getInstance().getValidLocation(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