diff --git a/L2J_Mobius_Classic/dist/game/config/AdminCommands.xml b/L2J_Mobius_Classic/dist/game/config/AdminCommands.xml index d355a06120..57c5dc031f 100644 --- a/L2J_Mobius_Classic/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_Classic/dist/game/config/AdminCommands.xml @@ -281,6 +281,8 @@ + + diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic/dist/game/data/scripts/handlers/MasterHandler.java index b21d09a678..56685624b8 100644 --- a/L2J_Mobius_Classic/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic/dist/game/data/scripts/handlers/MasterHandler.java @@ -99,6 +99,7 @@ import handlers.admincommandhandlers.AdminLogin; import handlers.admincommandhandlers.AdminManor; import handlers.admincommandhandlers.AdminMenu; import handlers.admincommandhandlers.AdminMessages; +import handlers.admincommandhandlers.AdminMissingHtmls; import handlers.admincommandhandlers.AdminMobGroup; import handlers.admincommandhandlers.AdminOlympiad; import handlers.admincommandhandlers.AdminPForge; @@ -428,6 +429,7 @@ public class MasterHandler AdminManor.class, AdminMenu.class, AdminMessages.class, + AdminMissingHtmls.class, AdminMobGroup.class, AdminOlympiad.class, AdminPathNode.class, 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 7f3ee36f5d..bfa36a76d5 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 @@ -16,19 +16,13 @@ */ package handlers.admincommandhandlers; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import java.util.StringTokenizer; -import com.l2jmobius.gameserver.enums.InstanceType; 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.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; -import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.GeoUtils; @@ -45,9 +39,7 @@ public class AdminGeodata implements IAdminCommandHandler "admin_geo_can_move", "admin_geo_can_see", "admin_geogrid", - "admin_geomap", - "admin_geomap_missing_htmls", - "admin_world_missing_htmls" + "admin_geomap" }; @Override @@ -145,66 +137,6 @@ 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 + ")"); - final List results = new ArrayList<>(); - for (L2Object obj : L2World.getInstance().getVisibleObjects()) - { - if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) - { - final L2Npc npc = (L2Npc) obj; - if (npc.getInstanceType() == InstanceType.L2ObservationInstance) - { - continue; - } - if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) - { - results.add(npc.getId()); - } - } - } - Collections.sort(results); - for (int id : results) - { - activeChar.sendMessage("NPC " + id + " does not have a default html."); - } - activeChar.sendMessage("Found " + results.size() + " results."); - break; - } - case "admin_world_missing_htmls": - { - activeChar.sendMessage("Missing htmls for the whole world."); - final List results = new ArrayList<>(); - for (L2Object obj : L2World.getInstance().getVisibleObjects()) - { - if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) - { - final L2Npc npc = (L2Npc) obj; - if (npc.getInstanceType() == InstanceType.L2ObservationInstance) - { - continue; - } - if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) - { - results.add(npc.getId()); - } - } - } - Collections.sort(results); - for (int id : results) - { - activeChar.sendMessage("NPC " + id + " does not have a default html."); - } - activeChar.sendMessage("Found " + results.size() + " results."); - break; - } } return true; } diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java b/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java new file mode 100644 index 0000000000..507ea42688 --- /dev/null +++ b/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java @@ -0,0 +1,119 @@ +/* + * 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 . + */ +package handlers.admincommandhandlers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.StringTokenizer; + +import com.l2jmobius.gameserver.enums.InstanceType; +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.model.events.EventType; + +/** + * @author Mobius + */ +public class AdminMissingHtmls implements IAdminCommandHandler +{ + private static final String[] ADMIN_COMMANDS = + { + "admin_geomap_missing_htmls", + "admin_world_missing_htmls" + }; + + @Override + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + final StringTokenizer st = new StringTokenizer(command, " "); + final String actualCommand = st.nextToken(); + switch (actualCommand.toLowerCase()) + { + 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 + ")"); + final List results = new ArrayList<>(); + for (L2Object obj : L2World.getInstance().getVisibleObjects()) + { + if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) + { + final L2Npc npc = (L2Npc) obj; + if (npc.getInstanceType() == InstanceType.L2ObservationInstance) + { + continue; + } + if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) + { + results.add(npc.getId()); + } + } + } + Collections.sort(results); + for (int id : results) + { + activeChar.sendMessage("NPC " + id + " does not have a default html."); + } + activeChar.sendMessage("Found " + results.size() + " results."); + break; + } + case "admin_world_missing_htmls": + { + activeChar.sendMessage("Missing htmls for the whole world."); + final List results = new ArrayList<>(); + for (L2Object obj : L2World.getInstance().getVisibleObjects()) + { + if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) + { + final L2Npc npc = (L2Npc) obj; + if (npc.getInstanceType() == InstanceType.L2ObservationInstance) + { + continue; + } + if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) + { + results.add(npc.getId()); + } + } + } + Collections.sort(results); + for (int id : results) + { + activeChar.sendMessage("NPC " + id + " does not have a default html."); + } + activeChar.sendMessage("Found " + results.size() + " results."); + break; + } + } + return true; + } + + @Override + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } +} diff --git a/L2J_Mobius_Helios/dist/game/config/AdminCommands.xml b/L2J_Mobius_Helios/dist/game/config/AdminCommands.xml index a0cf251d9d..d2ff6c880f 100644 --- a/L2J_Mobius_Helios/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_Helios/dist/game/config/AdminCommands.xml @@ -281,6 +281,8 @@ + + diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Helios/dist/game/data/scripts/handlers/MasterHandler.java index 12f4d55aac..73f55c9e81 100644 --- a/L2J_Mobius_Helios/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Helios/dist/game/data/scripts/handlers/MasterHandler.java @@ -99,6 +99,7 @@ import handlers.admincommandhandlers.AdminLogin; import handlers.admincommandhandlers.AdminManor; import handlers.admincommandhandlers.AdminMenu; import handlers.admincommandhandlers.AdminMessages; +import handlers.admincommandhandlers.AdminMissingHtmls; import handlers.admincommandhandlers.AdminMobGroup; import handlers.admincommandhandlers.AdminMonsterRace; import handlers.admincommandhandlers.AdminOlympiad; @@ -428,6 +429,7 @@ public class MasterHandler AdminManor.class, AdminMenu.class, AdminMessages.class, + AdminMissingHtmls.class, AdminMobGroup.class, AdminMonsterRace.class, AdminOlympiad.class, 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 7f3ee36f5d..bfa36a76d5 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 @@ -16,19 +16,13 @@ */ package handlers.admincommandhandlers; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import java.util.StringTokenizer; -import com.l2jmobius.gameserver.enums.InstanceType; 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.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; -import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.GeoUtils; @@ -45,9 +39,7 @@ public class AdminGeodata implements IAdminCommandHandler "admin_geo_can_move", "admin_geo_can_see", "admin_geogrid", - "admin_geomap", - "admin_geomap_missing_htmls", - "admin_world_missing_htmls" + "admin_geomap" }; @Override @@ -145,66 +137,6 @@ 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 + ")"); - final List results = new ArrayList<>(); - for (L2Object obj : L2World.getInstance().getVisibleObjects()) - { - if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) - { - final L2Npc npc = (L2Npc) obj; - if (npc.getInstanceType() == InstanceType.L2ObservationInstance) - { - continue; - } - if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) - { - results.add(npc.getId()); - } - } - } - Collections.sort(results); - for (int id : results) - { - activeChar.sendMessage("NPC " + id + " does not have a default html."); - } - activeChar.sendMessage("Found " + results.size() + " results."); - break; - } - case "admin_world_missing_htmls": - { - activeChar.sendMessage("Missing htmls for the whole world."); - final List results = new ArrayList<>(); - for (L2Object obj : L2World.getInstance().getVisibleObjects()) - { - if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) - { - final L2Npc npc = (L2Npc) obj; - if (npc.getInstanceType() == InstanceType.L2ObservationInstance) - { - continue; - } - if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) - { - results.add(npc.getId()); - } - } - } - Collections.sort(results); - for (int id : results) - { - activeChar.sendMessage("NPC " + id + " does not have a default html."); - } - activeChar.sendMessage("Found " + results.size() + " results."); - break; - } } return true; } diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java b/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java new file mode 100644 index 0000000000..507ea42688 --- /dev/null +++ b/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java @@ -0,0 +1,119 @@ +/* + * 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 . + */ +package handlers.admincommandhandlers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.StringTokenizer; + +import com.l2jmobius.gameserver.enums.InstanceType; +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.model.events.EventType; + +/** + * @author Mobius + */ +public class AdminMissingHtmls implements IAdminCommandHandler +{ + private static final String[] ADMIN_COMMANDS = + { + "admin_geomap_missing_htmls", + "admin_world_missing_htmls" + }; + + @Override + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + final StringTokenizer st = new StringTokenizer(command, " "); + final String actualCommand = st.nextToken(); + switch (actualCommand.toLowerCase()) + { + 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 + ")"); + final List results = new ArrayList<>(); + for (L2Object obj : L2World.getInstance().getVisibleObjects()) + { + if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) + { + final L2Npc npc = (L2Npc) obj; + if (npc.getInstanceType() == InstanceType.L2ObservationInstance) + { + continue; + } + if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) + { + results.add(npc.getId()); + } + } + } + Collections.sort(results); + for (int id : results) + { + activeChar.sendMessage("NPC " + id + " does not have a default html."); + } + activeChar.sendMessage("Found " + results.size() + " results."); + break; + } + case "admin_world_missing_htmls": + { + activeChar.sendMessage("Missing htmls for the whole world."); + final List results = new ArrayList<>(); + for (L2Object obj : L2World.getInstance().getVisibleObjects()) + { + if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) + { + final L2Npc npc = (L2Npc) obj; + if (npc.getInstanceType() == InstanceType.L2ObservationInstance) + { + continue; + } + if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) + { + results.add(npc.getId()); + } + } + } + Collections.sort(results); + for (int id : results) + { + activeChar.sendMessage("NPC " + id + " does not have a default html."); + } + activeChar.sendMessage("Found " + results.size() + " results."); + break; + } + } + return true; + } + + @Override + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } +} diff --git a/L2J_Mobius_Underground/dist/game/config/AdminCommands.xml b/L2J_Mobius_Underground/dist/game/config/AdminCommands.xml index a0cf251d9d..d2ff6c880f 100644 --- a/L2J_Mobius_Underground/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_Underground/dist/game/config/AdminCommands.xml @@ -281,6 +281,8 @@ + + diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/MasterHandler.java index 16746843ac..6a7c28d289 100644 --- a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/MasterHandler.java @@ -99,6 +99,7 @@ import handlers.admincommandhandlers.AdminLogin; import handlers.admincommandhandlers.AdminManor; import handlers.admincommandhandlers.AdminMenu; import handlers.admincommandhandlers.AdminMessages; +import handlers.admincommandhandlers.AdminMissingHtmls; import handlers.admincommandhandlers.AdminMobGroup; import handlers.admincommandhandlers.AdminMonsterRace; import handlers.admincommandhandlers.AdminOlympiad; @@ -427,6 +428,7 @@ public class MasterHandler AdminManor.class, AdminMenu.class, AdminMessages.class, + AdminMissingHtmls.class, AdminMobGroup.class, AdminMonsterRace.class, AdminOlympiad.class, 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 7f3ee36f5d..bfa36a76d5 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 @@ -16,19 +16,13 @@ */ package handlers.admincommandhandlers; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import java.util.StringTokenizer; -import com.l2jmobius.gameserver.enums.InstanceType; 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.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; -import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.GeoUtils; @@ -45,9 +39,7 @@ public class AdminGeodata implements IAdminCommandHandler "admin_geo_can_move", "admin_geo_can_see", "admin_geogrid", - "admin_geomap", - "admin_geomap_missing_htmls", - "admin_world_missing_htmls" + "admin_geomap" }; @Override @@ -145,66 +137,6 @@ 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 + ")"); - final List results = new ArrayList<>(); - for (L2Object obj : L2World.getInstance().getVisibleObjects()) - { - if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) - { - final L2Npc npc = (L2Npc) obj; - if (npc.getInstanceType() == InstanceType.L2ObservationInstance) - { - continue; - } - if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) - { - results.add(npc.getId()); - } - } - } - Collections.sort(results); - for (int id : results) - { - activeChar.sendMessage("NPC " + id + " does not have a default html."); - } - activeChar.sendMessage("Found " + results.size() + " results."); - break; - } - case "admin_world_missing_htmls": - { - activeChar.sendMessage("Missing htmls for the whole world."); - final List results = new ArrayList<>(); - for (L2Object obj : L2World.getInstance().getVisibleObjects()) - { - if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) - { - final L2Npc npc = (L2Npc) obj; - if (npc.getInstanceType() == InstanceType.L2ObservationInstance) - { - continue; - } - if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) - { - results.add(npc.getId()); - } - } - } - Collections.sort(results); - for (int id : results) - { - activeChar.sendMessage("NPC " + id + " does not have a default html."); - } - activeChar.sendMessage("Found " + results.size() + " results."); - break; - } } return true; } diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java new file mode 100644 index 0000000000..507ea42688 --- /dev/null +++ b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java @@ -0,0 +1,119 @@ +/* + * 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 . + */ +package handlers.admincommandhandlers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.StringTokenizer; + +import com.l2jmobius.gameserver.enums.InstanceType; +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.model.events.EventType; + +/** + * @author Mobius + */ +public class AdminMissingHtmls implements IAdminCommandHandler +{ + private static final String[] ADMIN_COMMANDS = + { + "admin_geomap_missing_htmls", + "admin_world_missing_htmls" + }; + + @Override + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + final StringTokenizer st = new StringTokenizer(command, " "); + final String actualCommand = st.nextToken(); + switch (actualCommand.toLowerCase()) + { + 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 + ")"); + final List results = new ArrayList<>(); + for (L2Object obj : L2World.getInstance().getVisibleObjects()) + { + if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) + { + final L2Npc npc = (L2Npc) obj; + if (npc.getInstanceType() == InstanceType.L2ObservationInstance) + { + continue; + } + if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) + { + results.add(npc.getId()); + } + } + } + Collections.sort(results); + for (int id : results) + { + activeChar.sendMessage("NPC " + id + " does not have a default html."); + } + activeChar.sendMessage("Found " + results.size() + " results."); + break; + } + case "admin_world_missing_htmls": + { + activeChar.sendMessage("Missing htmls for the whole world."); + final List results = new ArrayList<>(); + for (L2Object obj : L2World.getInstance().getVisibleObjects()) + { + if (obj.isNpc() && !obj.isMonster() && !results.contains(obj.getId())) + { + final L2Npc npc = (L2Npc) obj; + if (npc.getInstanceType() == InstanceType.L2ObservationInstance) + { + continue; + } + if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm")) + { + results.add(npc.getId()); + } + } + } + Collections.sort(results); + for (int id : results) + { + activeChar.sendMessage("NPC " + id + " does not have a default html."); + } + activeChar.sendMessage("Found " + results.size() + " results."); + break; + } + } + return true; + } + + @Override + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } +}