From 96a6fc5a8b9f15b440aa0c12cb3c2bd92210de1a Mon Sep 17 00:00:00 2001
From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Wed, 21 Jun 2017 22:45:44 +0000
Subject: [PATCH] Addition of //geomap_missing_htmls admin command.
---
.../dist/game/config/AdminCommands.xml | 1 +
.../admincommandhandlers/AdminGeodata.java | 27 ++++++++++++++++++-
.../l2jmobius/gameserver/cache/HtmCache.java | 17 ++++++++++++
.../dist/game/config/AdminCommands.xml | 1 +
.../admincommandhandlers/AdminGeodata.java | 27 ++++++++++++++++++-
.../l2jmobius/gameserver/cache/HtmCache.java | 17 ++++++++++++
.../dist/game/config/AdminCommands.xml | 1 +
.../admincommandhandlers/AdminGeodata.java | 27 ++++++++++++++++++-
.../l2jmobius/gameserver/cache/HtmCache.java | 17 ++++++++++++
9 files changed, 132 insertions(+), 3 deletions(-)
diff --git a/L2J_Mobius_Classic/dist/game/config/AdminCommands.xml b/L2J_Mobius_Classic/dist/game/config/AdminCommands.xml
index 2f6757243b..5f663048fb 100644
--- a/L2J_Mobius_Classic/dist/game/config/AdminCommands.xml
+++ b/L2J_Mobius_Classic/dist/game/config/AdminCommands.xml
@@ -281,6 +281,7 @@
+
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java b/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
index 790c1b459a..c157daf134 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
@@ -19,9 +19,11 @@ package handlers.admincommandhandlers;
import java.util.StringTokenizer;
import com.l2jmobius.gameserver.GeoData;
+import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -39,7 +41,8 @@ public class AdminGeodata implements IAdminCommandHandler
"admin_geo_can_move",
"admin_geo_can_see",
"admin_geogrid",
- "admin_geomap"
+ "admin_geomap",
+ "admin_geomap_missing_htmls"
};
@Override
@@ -137,6 +140,28 @@ public class AdminGeodata implements IAdminCommandHandler
activeChar.sendMessage("GeoMap: " + x + "_" + y + " (" + ((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + "," + ((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + " to " + ((((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1) + "," + ((((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1) + ")");
break;
}
+ case "admin_geomap_missing_htmls":
+ {
+ 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;
+ final int topLeftX = (x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE;
+ final int topLeftY = (y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE;
+ final int bottomRightX = (((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1;
+ final int bottomRightY = (((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1;
+ activeChar.sendMessage("GeoMap: " + x + "_" + y + " (" + topLeftX + "," + topLeftY + " to " + bottomRightX + "," + bottomRightY + ")");
+ for (L2Object obj : L2World.getInstance().getVisibleObjects())
+ {
+ if (obj.isNpc() && !obj.isMonster())
+ {
+ final L2Npc npc = (L2Npc) obj;
+ if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !HtmCache.getInstance().htmlNameExists("" + npc.getId()))
+ {
+ activeChar.sendMessage("NPC " + npc.getId() + " does not have an html.");
+ }
+ }
+ }
+ break;
+ }
}
return true;
}
diff --git a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/cache/HtmCache.java
index fec436d1fa..db8c974e26 100644
--- a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/cache/HtmCache.java
+++ b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/cache/HtmCache.java
@@ -180,6 +180,23 @@ public class HtmCache
return (path == null) || path.isEmpty() ? "" : _cache.get(path) == null ? loadFile(new File(Config.DATAPACK_ROOT, path)) : _cache.get(path);
}
+ /**
+ * Used by admin_geomap_missing_htmls
+ * @param search String
+ * @return if html name exists
+ */
+ public boolean htmlNameExists(String search)
+ {
+ for (String s : _cache.keySet())
+ {
+ if (s.contains(search))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
public boolean contains(String path)
{
return _cache.containsKey(path);
diff --git a/L2J_Mobius_Helios/dist/game/config/AdminCommands.xml b/L2J_Mobius_Helios/dist/game/config/AdminCommands.xml
index 2f6757243b..5f663048fb 100644
--- a/L2J_Mobius_Helios/dist/game/config/AdminCommands.xml
+++ b/L2J_Mobius_Helios/dist/game/config/AdminCommands.xml
@@ -281,6 +281,7 @@
+
diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java b/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
index 790c1b459a..c157daf134 100644
--- a/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
+++ b/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
@@ -19,9 +19,11 @@ package handlers.admincommandhandlers;
import java.util.StringTokenizer;
import com.l2jmobius.gameserver.GeoData;
+import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -39,7 +41,8 @@ public class AdminGeodata implements IAdminCommandHandler
"admin_geo_can_move",
"admin_geo_can_see",
"admin_geogrid",
- "admin_geomap"
+ "admin_geomap",
+ "admin_geomap_missing_htmls"
};
@Override
@@ -137,6 +140,28 @@ public class AdminGeodata implements IAdminCommandHandler
activeChar.sendMessage("GeoMap: " + x + "_" + y + " (" + ((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + "," + ((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + " to " + ((((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1) + "," + ((((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1) + ")");
break;
}
+ case "admin_geomap_missing_htmls":
+ {
+ 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;
+ final int topLeftX = (x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE;
+ final int topLeftY = (y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE;
+ final int bottomRightX = (((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1;
+ final int bottomRightY = (((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1;
+ activeChar.sendMessage("GeoMap: " + x + "_" + y + " (" + topLeftX + "," + topLeftY + " to " + bottomRightX + "," + bottomRightY + ")");
+ for (L2Object obj : L2World.getInstance().getVisibleObjects())
+ {
+ if (obj.isNpc() && !obj.isMonster())
+ {
+ final L2Npc npc = (L2Npc) obj;
+ if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !HtmCache.getInstance().htmlNameExists("" + npc.getId()))
+ {
+ activeChar.sendMessage("NPC " + npc.getId() + " does not have an html.");
+ }
+ }
+ }
+ break;
+ }
}
return true;
}
diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/cache/HtmCache.java
index fec436d1fa..db8c974e26 100644
--- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/cache/HtmCache.java
+++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/cache/HtmCache.java
@@ -180,6 +180,23 @@ public class HtmCache
return (path == null) || path.isEmpty() ? "" : _cache.get(path) == null ? loadFile(new File(Config.DATAPACK_ROOT, path)) : _cache.get(path);
}
+ /**
+ * Used by admin_geomap_missing_htmls
+ * @param search String
+ * @return if html name exists
+ */
+ public boolean htmlNameExists(String search)
+ {
+ for (String s : _cache.keySet())
+ {
+ if (s.contains(search))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
public boolean contains(String path)
{
return _cache.containsKey(path);
diff --git a/L2J_Mobius_Underground/dist/game/config/AdminCommands.xml b/L2J_Mobius_Underground/dist/game/config/AdminCommands.xml
index 2f6757243b..5f663048fb 100644
--- a/L2J_Mobius_Underground/dist/game/config/AdminCommands.xml
+++ b/L2J_Mobius_Underground/dist/game/config/AdminCommands.xml
@@ -281,6 +281,7 @@
+
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
index 790c1b459a..c157daf134 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java
@@ -19,9 +19,11 @@ package handlers.admincommandhandlers;
import java.util.StringTokenizer;
import com.l2jmobius.gameserver.GeoData;
+import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -39,7 +41,8 @@ public class AdminGeodata implements IAdminCommandHandler
"admin_geo_can_move",
"admin_geo_can_see",
"admin_geogrid",
- "admin_geomap"
+ "admin_geomap",
+ "admin_geomap_missing_htmls"
};
@Override
@@ -137,6 +140,28 @@ public class AdminGeodata implements IAdminCommandHandler
activeChar.sendMessage("GeoMap: " + x + "_" + y + " (" + ((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + "," + ((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + " to " + ((((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1) + "," + ((((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1) + ")");
break;
}
+ case "admin_geomap_missing_htmls":
+ {
+ 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;
+ final int topLeftX = (x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE;
+ final int topLeftY = (y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE;
+ final int bottomRightX = (((x - L2World.TILE_ZERO_COORD_X) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1;
+ final int bottomRightY = (((y - L2World.TILE_ZERO_COORD_Y) * L2World.TILE_SIZE) + L2World.TILE_SIZE) - 1;
+ activeChar.sendMessage("GeoMap: " + x + "_" + y + " (" + topLeftX + "," + topLeftY + " to " + bottomRightX + "," + bottomRightY + ")");
+ for (L2Object obj : L2World.getInstance().getVisibleObjects())
+ {
+ if (obj.isNpc() && !obj.isMonster())
+ {
+ final L2Npc npc = (L2Npc) obj;
+ if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !HtmCache.getInstance().htmlNameExists("" + npc.getId()))
+ {
+ activeChar.sendMessage("NPC " + npc.getId() + " does not have an html.");
+ }
+ }
+ }
+ break;
+ }
}
return true;
}
diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/cache/HtmCache.java
index fec436d1fa..db8c974e26 100644
--- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/cache/HtmCache.java
+++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/cache/HtmCache.java
@@ -180,6 +180,23 @@ public class HtmCache
return (path == null) || path.isEmpty() ? "" : _cache.get(path) == null ? loadFile(new File(Config.DATAPACK_ROOT, path)) : _cache.get(path);
}
+ /**
+ * Used by admin_geomap_missing_htmls
+ * @param search String
+ * @return if html name exists
+ */
+ public boolean htmlNameExists(String search)
+ {
+ for (String s : _cache.keySet())
+ {
+ if (s.contains(search))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
public boolean contains(String path)
{
return _cache.containsKey(path);