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

@@ -0,0 +1,6 @@
@echo off
title L2D geodata converter
java -Xmx512m -cp ./../libs/*;GameServer.jar com.l2jmobius.tools.geodataconverter.GeoDataConverter
pause

View File

@@ -0,0 +1,4 @@
#! /bin/sh
java -Xmx512m -cp ./../libs/*;GameServer.jar com.l2jmobius.tools.geodataconverter.GeoDataConverter > log/stdout.log 2>&1

View File

@@ -395,11 +395,7 @@
<admin command="admin_mons" accessLevel="100" />
<!-- ADMIN PATH NODE -->
<admin command="admin_pn_info" accessLevel="30" />
<admin command="admin_show_path" accessLevel="30" />
<admin command="admin_path_debug" accessLevel="30" />
<admin command="admin_show_pn" accessLevel="30" />
<admin command="admin_find_path" accessLevel="30" />
<admin command="admin_path_find" accessLevel="100" />
<!-- ADMIN PETITION -->
<admin command="admin_view_petitions" accessLevel="30" />

View File

@@ -1,75 +0,0 @@
# ---------------------------------------------------------------------------
# GeoData
# ---------------------------------------------------------------------------
# Pathfinding options:
# 0 = Disabled
# 1 = Enabled using path node files
# 2 = Enabled using geodata cells at runtime
# Default: 0
PathFinding = 0
# Pathnode file directory
# Default: pathnode
PathnodePath = pathnode
# Pathfinding array buffers configuration
PathFindBuffers = 100x6;128x6;192x6;256x4;320x4;384x4;500x2
# Weight for nodes without obstacles far from walls
LowWeight = 0.5
# Weight for nodes near walls
MediumWeight = 2
# Weight for nodes with obstacles
HighWeight = 3
# Angle paths will be more "smart", but in cost of higher CPU utilization
AdvancedDiagonalStrategy = True
# Weight for diagonal movement. Used only with AdvancedDiagonalStrategy = True
# Default: LowWeight * sqrt(2)
DiagonalWeight = 0.707
# Maximum number of LOS postfilter passes, 0 will disable postfilter.
# Default: 3
MaxPostfilterPasses = 3
# Path debug function.
# Nodes known to pathfinder will be displayed as adena, constructed path as antidots.
# Number of the items show node cost * 10
# Potions display path after first stage filter
# Red potions - actual waypoints. Green potions - nodes removed by LOS postfilter
# This function FOR DEBUG PURPOSES ONLY, never use it on the live server !
DebugPath = False
# True = Loads GeoData buffer's content into physical memory.
# False = Does not necessarily imply that the GeoData buffer's content is not resident in physical memory.
# Default: True
ForceGeoData = True
# This setting controls Client <--> Server Player coordinates synchronization:
# -1 - Will synchronize only Z from Client --> Server. Default when no geodata.
# 1 - Synchronization Client --> Server only. Using this option (without geodata) makes it more difficult for players to bypass obstacles.
# 2 - Intended for geodata (at least with cell-level pathfinding, otherwise can you try -1).
# Server sends validation packet if client goes too far from server calculated coordinates.
# Default: -1
CoordSynchronize = -1
# Geodata file directory
GeoDataPath = geodata
# True: Try to load regions not specified below(won't disturb server startup when file does not exist)
# False: Don't load any regions other than the ones specified with True below
TryLoadUnspecifiedRegions = True
# List of regions to be required to load
# eg.:
# Both regions required
# 22_22=True
# 19_20=true
# Exclude region from loading
# 25_26=false
# True: Region is required for the server to startup
# False: Region is not considered to be loaded

View File

@@ -0,0 +1,55 @@
# =================================================================
# Geodata
# =================================================================
# Because of real-time performance we are using geodata files only in
# diagonal L2D format now (using filename e.g. 22_16.l2d).
# L2D geodata can be obtained by conversion of existing L2J or L2OFF geodata.
# Launch "GeoDataConverter.bat/sh" and follow instructions to start the conversion.
# Specifies the path to geodata files. For example, when using geodata files located
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
GeoDataPath = ./data/geodata/
# Player coordinates synchronization, default: 2
# 1 - partial synchronization Client --> Server ; don't use it with geodata
# 2 - partial synchronization Server --> Client ; use this setting with geodata
# -1 - Old system: will synchronize Z only
CoordSynchronize = 2
# =================================================================
# Path checking
# =================================================================
# 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
# =================================================================
# Path finding
# =================================================================
# 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
# Pathfinding array buffers configuration, default: 100x6;128x6;192x6;256x4;320x4;384x4;500x2
PathFindBuffers = 100x6;128x6;192x6;256x4;320x4;384x4;500x2
# Base path weight, when moving from one node to another on axis direction, default: 10
BaseWeight = 10
# Path weight, when moving from one node to another on diagonal direction, default: BaseWeight * sqrt(2) = 14
DiagonalWeight = 14
# When movement flags of target node is blocked to any direction, multiply movement weight by this multiplier.
# This causes pathfinding algorithm to avoid path construction exactly near an obstacle, default: 10
ObstacleMultiplier = 10
# Weight of the heuristic algorithm, which is giving estimated cost from node to target, default: 20
# For proper function must be higher than BaseWeight and/or DiagonalWeight.
HeuristicWeight = 20
# Maximum number of generated nodes per one path-finding process, default 3500
MaxIterations = 3500

View File

@@ -1,11 +1,41 @@
#####################################################
# L2J GeoData #
#####################################################
# #
# GeoData files should be unpacked inside: #
# gameserver/data/geodata/ #
# #
# More Info at: #
# http://www.l2jserver.com/forum/viewforum.php?f=89 #
# #
#####################################################
##############################################
GEODATA COMPENDIUM
##############################################
Comprehensive guide for geodata, by Tryskell and Hasha.
I - How to configure it
a - Prerequisites
b - Make it work
c - L2D format
II - Addendum
##############################################
I - How to configure it
##############################################
----------------------------------------------
a - Prerequisites
----------------------------------------------
* A 64bits Windows/Java JDK is a must-have to run server with geodata. Linux servers don't have the issue.
* The server can start (hardly) with -Xmx3000m. -Xmx4g is recommended.
----------------------------------------------
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.
----------------------------------------------
c - L2D format
----------------------------------------------
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.

View File

@@ -1,11 +0,0 @@
#####################################################
# L2J PathNode #
#####################################################
# #
# PathNode files should be unpacked inside: #
# gameserver/data/pathnode/ #
# #
# More Info at: #
# http://www.l2jserver.com/forum/viewforum.php?f=89 #
# #
#####################################################

View File

@@ -18,7 +18,7 @@ package ai.group_template;
import java.util.logging.Level;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -62,7 +62,7 @@ public final class AltarsOfSacrifice extends AbstractNpcAI
final int spawnX = (int) (radius * Math.cos(angleRadians)) + _middlePoint.getX();
final int spawnY = (int) (radius * Math.sin(angleRadians)) + _middlePoint.getY();
spawn.setXYZ(spawnX, spawnY, GeoData.getInstance().getHeight(spawnX, spawnY, _middlePoint.getZ()));
spawn.setXYZ(spawnX, spawnY, GeoEngine.getInstance().getHeight(spawnX, spawnY, _middlePoint.getZ()));
spawn.stopRespawn();
_spawnedBoss = spawn.spawnOne(false);
}

View File

@@ -17,7 +17,7 @@
package ai.group_template;
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.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.L2Summon;
@@ -71,7 +71,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 = GeoData.getInstance().moveCheck(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, attacker.getInstanceId());
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(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);
}

View File

@@ -17,7 +17,7 @@
package ai.group_template;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -78,7 +78,7 @@ public final class PlainsOfDion extends AbstractNpcAI
for (L2Character obj : npc.getKnownList().getKnownCharactersInRadius(npc.getTemplate().getClanHelpRange()))
{
if (obj.isMonster() && Util.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoData.getInstance().canSeeTarget(npc, obj))
if (obj.isMonster() && Util.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoEngine.getInstance().canSeeTarget(npc, obj))
{
final L2Npc monster = (L2Npc) obj;
addAttackDesire(monster, player);

View File

@@ -18,7 +18,7 @@ package ai.group_template;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.IItemHandler;
import com.l2jmobius.gameserver.handler.ItemHandler;
import com.l2jmobius.gameserver.model.Location;
@@ -269,7 +269,7 @@ public final 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 = GeoData.getInstance().moveCheck(npc.getX(), npc.getY(), npc.getZ(), newX, newY, npc.getZ(), npc.getInstanceId());
final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(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

@@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.Collection;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -222,7 +222,7 @@ public final class ScarletVanHalisha extends AbstractNpcAI
continue;
}
if (((((L2Character) obj).getZ() < (npc.getZ() - 100)) && (((L2Character) obj).getZ() > (npc.getZ() + 100))) || !GeoData.getInstance().canSeeTarget(((L2Character) obj).getX(), ((L2Character) obj).getY(), ((L2Character) obj).getZ(), npc.getX(), npc.getY(), npc.getZ()))
if (((((L2Character) obj).getZ() < (npc.getZ() - 100)) && (((L2Character) obj).getZ() > (npc.getZ() + 100))) || !GeoEngine.getInstance().canSeeTarget(obj, npc))
{
continue;
}

View File

@@ -23,7 +23,7 @@ import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.MountType;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
@@ -477,7 +477,7 @@ public final class Valakas extends AbstractNpcAI
final int posX = x + getRandom(-1400, 1400);
final int posY = y + getRandom(-1400, 1400);
if (GeoData.getInstance().canMove(x, y, z, posX, posY, z, npc.getInstanceId()))
if (GeoEngine.getInstance().canMoveToTarget(x, y, z, posX, posY, z, npc.getInstanceId()))
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, z, 0));
}

View File

@@ -26,7 +26,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.L2Territory;
import com.l2jmobius.gameserver.model.Location;
@@ -228,7 +228,7 @@ public class TarBeetleSpawn implements IXmlReader
spawn.setHeading(Rnd.get(65535));
spawn.setX(location.getX());
spawn.setY(location.getY());
spawn.setZ(GeoData.getInstance().getSpawnHeight(location));
spawn.setZ(GeoEngine.getInstance().getHeight(location.getX(), location.getY(), location.getZ()));
final L2Npc npc = spawn.doSpawn();
npc.setIsNoRndWalk(true);

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;
}

View File

@@ -27,7 +27,7 @@ import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.TrapAction;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2Party;
@@ -682,7 +682,7 @@ public final class CrystalCaverns extends AbstractInstance
final int _y = effector.getY() - (int) (offset * sin);
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.broadcastPacket(new FlyToLocation(effected, destination, FlyType.THROW_UP));

View File

@@ -33,7 +33,7 @@ import org.w3c.dom.Node;
import com.l2jmobius.gameserver.ThreadPoolManager;
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.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.L2CommandChannel;
import com.l2jmobius.gameserver.model.L2Object;
@@ -569,7 +569,7 @@ public final class FinalEmperialTomb extends AbstractInstance implements IXmlRea
final Location location = _spawnZoneList.get(spw.zone).getRandomPoint();
if (location != null)
{
spawn(world, spw.npcId, location.getX(), location.getY(), GeoData.getInstance().getSpawnHeight(location), getRandom(65535), spw.isNeededNextFlag);
spawn(world, spw.npcId, location.getX(), location.getY(), GeoEngine.getInstance().getHeight(location.getX(), location.getY(), location.getZ()), getRandom(65535), spw.isNeededNextFlag);
}
}
else