Separated admin missing html commands.
This commit is contained in:
		| @@ -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, | ||||
|   | ||||
| @@ -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<Integer> 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<Integer> 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; | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										119
									
								
								L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminMissingHtmls.java
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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 <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 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<Integer> 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<Integer> 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; | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDev
					MobiusDev