Replaced GeoData engine with newest version.

This commit is contained in:
MobiusDev
2017-07-19 23:56:27 +00:00
parent dc770c4a85
commit 40563ace6c
62 changed files with 4212 additions and 3499 deletions

View File

@@ -1,134 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.handler.admincommandhandlers;
import java.util.StringTokenizer;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.geoeditorcon.GeoEditorListener;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.GMAudit;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author Luno, Dezmond
*/
public class AdminGeoEditor implements IAdminCommandHandler
{
private static String[] _adminCommands =
{
"admin_ge_status",
"admin_ge_mode",
"admin_ge_join",
"admin_ge_leave"
};
private static final int REQUIRED_LEVEL = Config.GM_MIN;
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (!Config.ALT_PRIVILEGES_ADMIN)
{
if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))
{
return false;
}
}
final String target = (activeChar.getTarget() != null) ? activeChar.getTarget().getName() : "no-target";
GMAudit.auditGMAction(activeChar.getName(), command, target, "");
if (!Config.ACCEPT_GEOEDITOR_CONN)
{
activeChar.sendMessage("Server does not accept geoeditor connections now.");
return true;
}
if (command.startsWith("admin_ge_status"))
{
activeChar.sendMessage(GeoEditorListener.getInstance().getStatus());
}
else if (command.startsWith("admin_ge_mode"))
{
if (GeoEditorListener.getInstance().getThread() == null)
{
activeChar.sendMessage("Geoeditor is not connected.");
return true;
}
try
{
final String val = command.substring("admin_ge_mode".length());
final StringTokenizer st = new StringTokenizer(val);
if (st.countTokens() < 1)
{
activeChar.sendMessage("Usage: //ge_mode X");
activeChar.sendMessage("Mode 0: Don't send coordinates to geoeditor.");
activeChar.sendMessage("Mode 1: Send coordinates at ValidatePosition from clients.");
activeChar.sendMessage("Mode 2: Send coordinates each second.");
return true;
}
final int m = Integer.parseInt(st.nextToken());
GeoEditorListener.getInstance().getThread().setMode(m);
activeChar.sendMessage("Geoeditor connection mode set to " + m + ".");
}
catch (final Exception e)
{
activeChar.sendMessage("Usage: //ge_mode X");
activeChar.sendMessage("Mode 0: Don't send coordinates to geoeditor.");
activeChar.sendMessage("Mode 1: Send coordinates at ValidatePosition from clients.");
activeChar.sendMessage("Mode 2: Send coordinates each second.");
e.printStackTrace();
}
}
else if (command.equals("admin_ge_join"))
{
if (GeoEditorListener.getInstance().getThread() == null)
{
activeChar.sendMessage("Geoeditor is not connected.");
return true;
}
GeoEditorListener.getInstance().getThread().addGM(activeChar);
activeChar.sendMessage("You have been added to geoeditor's list.");
}
else if (command.equals("admin_ge_leave"))
{
if (GeoEditorListener.getInstance().getThread() == null)
{
activeChar.sendMessage("Geoeditor is not connected.");
return true;
}
GeoEditorListener.getInstance().getThread().removeGM(activeChar);
activeChar.sendMessage("You have been removed from geoeditor's list.");
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return _adminCommands;
}
private boolean checkLevel(int level)
{
return (level >= REQUIRED_LEVEL);
}
}

View File

@@ -17,10 +17,12 @@
package com.l2jmobius.gameserver.handler.admincommandhandlers;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.util.GeoUtils;
/**
* @author -Nemesiss-
@@ -32,7 +34,9 @@ public class AdminGeodata implements IAdminCommandHandler
"admin_geo_pos",
"admin_geo_spawn_pos",
"admin_geo_can_move",
"admin_geo_can_see"
"admin_geo_can_see",
"admin_geogrid",
"admin_geomap"
};
private static final int REQUIRED_LEVEL = Config.GM_MIN;
@@ -75,7 +79,7 @@ public class AdminGeodata implements IAdminCommandHandler
if (GeoData.getInstance().hasGeoPos(geoX, geoY))
{
activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getSpawnHeight(worldX, worldY, worldZ, worldZ));
activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getSpawnHeight(worldX, worldY, worldZ));
}
else
{
@@ -120,6 +124,16 @@ public class AdminGeodata implements IAdminCommandHandler
activeChar.sendMessage("Incorrect Target.");
}
}
else if (command.equals("admin_geogrid"))
{
GeoUtils.debugGrid(activeChar);
}
else if (command.equals("admin_geomap"))
{
final int x = ((activeChar.getX() - L2World.MAP_MIN_X) >> 15) + L2World.TILE_X_MIN;
final int y = ((activeChar.getY() - L2World.MAP_MIN_Y) >> 15) + L2World.TILE_Y_MIN;
activeChar.sendMessage("GeoMap: " + x + "_" + y);
}
else
{
return false;

View File

@@ -19,10 +19,10 @@ package com.l2jmobius.gameserver.handler.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.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.pathfinding.AbstractNodeLoc;
import com.l2jmobius.gameserver.pathfinding.PathFinding;
public class AdminPathNode implements IAdminCommandHandler
{
@@ -79,7 +79,7 @@ public class AdminPathNode implements IAdminCommandHandler
}
else if (command.equals("admin_find_path"))
{
if (Config.GEODATA < 2)
if (Config.PATHFINDING < 2)
{
activeChar.sendMessage("PathFinding has not been enabled.");
return true;

View File

@@ -17,8 +17,8 @@
package com.l2jmobius.gameserver.handler.skillhandlers;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.datatables.ZoneTable;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.handler.ISkillHandler;
import com.l2jmobius.gameserver.model.Inventory;
import com.l2jmobius.gameserver.model.L2Character;
@@ -169,7 +169,7 @@ public class Fishing implements ISkillHandler
if (aimingTo != null)
{
// fishing zone found, we can fish here
if (Config.GEODATA > 0)
if (Config.PATHFINDING > 0)
{
// geodata enabled, checking if we can see end of the pole
if (GeoData.getInstance().canSeeTarget(player.getX(), player.getY(), z, x, y, z))