New l2j geoengine rework.
This commit is contained in:
@@ -6,33 +6,44 @@
|
||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||
GeoDataPath = ./data/geodata/
|
||||
|
||||
# Specifies the geodata files type. Default: L2J
|
||||
# L2J: Using L2J geodata files (filename e.g. 22_16.l2j)
|
||||
# L2OFF: Using L2OFF geodata files (filename e.g. 22_16_conv.dat)
|
||||
GeoDataType = L2J
|
||||
|
||||
# =================================================================
|
||||
# Path finding
|
||||
# Pathfinding
|
||||
# =================================================================
|
||||
|
||||
# When line of movement check fails, the pathfinding algoritm is performed to look for
|
||||
# an alternative path (e.g. walk around obstacle), default: true
|
||||
PathFinding = true
|
||||
# an alternative path (e.g. walk around obstacle), default: True
|
||||
PathFinding = True
|
||||
|
||||
# Pathfinding array buffers configuration, default: 100x6;128x6;192x6;256x4;320x4;384x4;500x2
|
||||
PathFindBuffers = 100x6;128x6;192x6;256x4;320x4;384x4;500x2
|
||||
# Pathfinding array buffers configuration, default: 500x10;1000x10;3000x5;5000x3;10000x3
|
||||
PathFindBuffers = 500x10;1000x10;3000x5;5000x3;10000x3
|
||||
|
||||
# Weight for nodes without obstacles far from walls
|
||||
LowWeight = 0.5
|
||||
# Movement weight, when moving from one to another axially and diagonally, default: 10 and 14
|
||||
MoveWeight = 10
|
||||
MoveWeightDiag = 14
|
||||
|
||||
# Weight for nodes near walls
|
||||
MediumWeight = 2
|
||||
# When movement flags of target node is blocked to any direction, use this weight instead of MoveWeight or MoveWeightDiag.
|
||||
# This causes pathfinding algorithm to avoid path construction exactly near an obstacle, default: 30
|
||||
ObstacleWeight = 30
|
||||
|
||||
# Weight for nodes with obstacles
|
||||
HighWeight = 3
|
||||
# Weight of the heuristic algorithm, which is giving estimated cost from node to target, default: 12 and 18
|
||||
# For proper function must be higher than MoveWeight.
|
||||
HeuristicWeight = 12
|
||||
HeuristicWeightDiag = 18
|
||||
|
||||
# Weight for diagonal movement.
|
||||
# Default: LowWeight * sqrt(2)
|
||||
DiagonalWeight = 0.707
|
||||
# Maximum number of generated nodes per one path-finding process, default 3500
|
||||
MaxIterations = 3500
|
||||
|
||||
# =================================================================
|
||||
# Other
|
||||
# Line of Sight
|
||||
# =================================================================
|
||||
|
||||
# Correct player Z after falling through the ground.
|
||||
CorrectPlayerZ = False
|
||||
# Line of sight start at X percent of the character height, default: 75
|
||||
PartOfCharacterHeight = 75
|
||||
|
||||
# Maximum height of an obstacle, which can exceed the line of sight, default: 32
|
||||
MaxObstacleHeight = 32
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -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.
|
||||
|
@@ -298,7 +298,7 @@ public class FourSepulchers extends AbstractNpcAI implements IXmlReader
|
||||
{
|
||||
if ((npc != null) && !npc.isDead())
|
||||
{
|
||||
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(npc.getX(), npc.getY(), npc.getZ(), npc.getSpawn().getLocation().getX() + getRandom(-400, 400), npc.getSpawn().getLocation().getY() + getRandom(-400, 400), npc.getZ(), npc.getInstanceWorld());
|
||||
final Location destination = GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), npc.getSpawn().getLocation().getX() + getRandom(-400, 400), npc.getSpawn().getLocation().getY() + getRandom(-400, 400), npc.getZ(), npc.getInstanceWorld());
|
||||
if (Util.calculateDistance(npc, npc.getSpawn().getLocation(), false, false) < 600)
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
|
||||
|
@@ -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.getInstanceWorld());
|
||||
final Location loc = GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), newX, newY, npc.getZ(), npc.getInstanceWorld());
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc, 0);
|
||||
}
|
||||
else if (ag_type == 1)
|
||||
|
@@ -59,7 +59,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.getInstanceWorld());
|
||||
final Location destination = GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld());
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@ public class RandomWalkingGuards extends AbstractNpcAI
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
final Location randomLoc = Util.getRandomPosition(npc.getSpawn().getLocation(), 0, Config.MAX_DRIFT_RANGE);
|
||||
addMoveToDesire(npc, GeoEngine.getInstance().canMoveToTargetLoc(npc.getX(), npc.getY(), npc.getZ(), randomLoc.getX(), randomLoc.getY(), randomLoc.getZ(), npc.getInstanceWorld()), 23);
|
||||
addMoveToDesire(npc, GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), randomLoc.getX(), randomLoc.getY(), randomLoc.getZ(), npc.getInstanceWorld()), 23);
|
||||
}
|
||||
startQuestTimer("RANDOM_WALK", getRandom(MIN_WALK_DELAY, MAX_WALK_DELAY), npc, null);
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -57,8 +57,8 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
{
|
||||
case "admin_geomap_missing_htmls":
|
||||
{
|
||||
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;
|
||||
final int topLeftX = (x - World.TILE_ZERO_COORD_X) * World.TILE_SIZE;
|
||||
final int topLeftY = (y - World.TILE_ZERO_COORD_Y) * World.TILE_SIZE;
|
||||
final int bottomRightX = (((x - World.TILE_ZERO_COORD_X) * World.TILE_SIZE) + World.TILE_SIZE) - 1;
|
||||
|
@@ -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.getInstanceWorld());
|
||||
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.getInstanceWorld());
|
||||
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());
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ public class Blink extends AbstractEffect
|
||||
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.getInstanceWorld());
|
||||
final Location destination = GeoEngine.getInstance().getValidLocation(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceWorld());
|
||||
|
||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effected.broadcastPacket(new FlyToLocation(effected, destination, _flyType, _flySpeed, _flyDelay, _animationSpeed));
|
||||
|
@@ -100,7 +100,7 @@ public class Fear extends AbstractEffect
|
||||
final int posY = (int) (effected.getY() + (FEAR_RANGE * Math.sin(radians)));
|
||||
final int posZ = effected.getZ();
|
||||
|
||||
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(effected.getX(), effected.getY(), effected.getZ(), posX, posY, posZ, effected.getInstanceWorld());
|
||||
final Location destination = GeoEngine.getInstance().getValidLocation(effected.getX(), effected.getY(), effected.getZ(), posX, posY, posZ, effected.getInstanceWorld());
|
||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ public class FlyAway extends AbstractEffect
|
||||
final int y = (int) (effector.getY() - (nRadius * (dy / distance)));
|
||||
final int z = effector.getZ();
|
||||
|
||||
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceWorld());
|
||||
final Location destination = GeoEngine.getInstance().getValidLocation(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceWorld());
|
||||
|
||||
effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.THROW_UP));
|
||||
effected.setXYZ(destination);
|
||||
|
@@ -133,7 +133,7 @@ public class KnockBack extends AbstractEffect
|
||||
final int x = (int) (effected.getX() + (_distance * Math.cos(radians)));
|
||||
final int y = (int) (effected.getY() + (_distance * Math.sin(radians)));
|
||||
final int z = effected.getZ();
|
||||
final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceWorld());
|
||||
final Location loc = GeoEngine.getInstance().getValidLocation(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceWorld());
|
||||
|
||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effected.broadcastPacket(new FlyToLocation(effected, loc, _type, _speed, _delay, _animationSpeed));
|
||||
|
@@ -73,7 +73,7 @@ public class PullBack extends AbstractEffect
|
||||
}
|
||||
|
||||
// In retail, you get debuff, but you are not even moved if there is obstacle. You are still disabled from using skills and moving though.
|
||||
if (GeoEngine.getInstance().canMoveToTarget(effected.getX(), effected.getY(), effected.getZ(), effector.getX(), effector.getY(), effector.getZ(), effector.getInstanceWorld()))
|
||||
if (GeoEngine.getInstance().canMoveToTarget(effected.getX(), effected.getY(), effected.getZ(), effector.getX(), effector.getY(), effector.getZ(), effected.getInstanceWorld()))
|
||||
{
|
||||
effected.broadcastPacket(new FlyToLocation(effected, effector, _type, _speed, _delay, _animationSpeed));
|
||||
effected.setXYZ(effector.getX(), effector.getY(), GeoEngine.getInstance().getHeight(effector.getX(), effector.getY(), effector.getZ()) + 10);
|
||||
|
@@ -87,7 +87,7 @@ public class TeleportToSummon extends AbstractEffect
|
||||
final int y = (int) (py + (25 * Math.sin(ph)));
|
||||
final int z = summon.getZ();
|
||||
|
||||
final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(effector.getX(), effector.getY(), effector.getZ(), x, y, z, effector.getInstanceWorld());
|
||||
final Location loc = GeoEngine.getInstance().getValidLocation(effector.getX(), effector.getY(), effector.getZ(), x, y, z,effector.getInstanceWorld());
|
||||
|
||||
effector.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effector.broadcastPacket(new FlyToLocation(effector, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
|
||||
|
@@ -76,7 +76,7 @@ public class TeleportToTarget extends AbstractEffect
|
||||
final int y = (int) (py + (25 * Math.sin(ph)));
|
||||
final int z = effected.getZ();
|
||||
|
||||
final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(effector.getX(), effector.getY(), effector.getZ(), x, y, z, effector.getInstanceWorld());
|
||||
final Location loc = GeoEngine.getInstance().getValidLocation(effector.getX(), effector.getY(), effector.getZ(), x, y, z,effector.getInstanceWorld());
|
||||
|
||||
effector.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effector.broadcastPacket(new FlyToLocation(effector, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
|
||||
|
@@ -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.getInstanceWorld());
|
||||
final Location destination = GeoEngine.getInstance().getValidLocation(player.getX(), player.getY(), player.getZ(), x, y, z, player.getInstanceWorld());
|
||||
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);
|
||||
|
@@ -52,7 +52,7 @@ public class Ground implements ITargetTypeHandler
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!GeoEngine.getInstance().canSeeTarget(creature, worldPosition))
|
||||
if (!GeoEngine.getInstance().canSeeLocation(creature, worldPosition))
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
|
Reference in New Issue
Block a user