All pastes #759602 Raw Edit

Untitled

public text v1 · immutable
·published 2007-11-03 09:39 UTC
rendered paste body
Index: D:/projectl2j/L2_GameServer_It_1283/java/net/sf/l2j/gameserver/datatables/SpawnTable.java
===================================================================
--- D:/projectl2j/L2_GameServer_It_1283/java/net/sf/l2j/gameserver/datatables/SpawnTable.java	(revision 1283)
+++ D:/projectl2j/L2_GameServer_It_1283/java/net/sf/l2j/gameserver/datatables/SpawnTable.java	(working copy)
@@ -29,6 +29,7 @@
 import net.sf.l2j.gameserver.instancemanager.DayNightSpawnManager;
 import net.sf.l2j.gameserver.model.L2Spawn;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.serverpackets.RadarControl;
 import net.sf.l2j.gameserver.templates.L2NpcTemplate;
 
 /**
@@ -247,8 +248,27 @@
     { 
         fillSpawnTable();
     }
-
+    
     /**
+     * Find NPC and show his location on map<BR><BR>
+     * 
+     * @param npcId : ID of the NPC to find.
+     * @return
+     */
+    public L2Spawn findNpcId(L2PcInstance activeChar, int npcId)
+    {
+    	for (L2Spawn spawn : _spawntable.values())
+        {
+            if (npcId == spawn.getNpcid())
+            {
+            	activeChar.sendPacket(new RadarControl(0,1,spawn.getLocx(),spawn.getLocy(),spawn.getLocz()));
+            }
+            else
+            	activeChar.sendMessage("No current spawns found.");
+        }
+		return null;
+    }
+    /**
      * Get all the spawn of a NPC<BR><BR>
      * 
      * @param npcId : ID of the NPC to find.

Index: D:/projectl2j/L2_GameServer_It_1283/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java
===================================================================
--- D:/projectl2j/L2_GameServer_It_1283/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java	(revision 1283)
+++ D:/projectl2j/L2_GameServer_It_1283/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java	(working copy)
@@ -991,16 +991,7 @@
             }
             else if (command.startsWith("npcfind_byid"))
             {
-                try
-                {
-                    L2Spawn spawn = SpawnTable.getInstance().getTemplate(Integer.parseInt(command.substring(12).trim()));
-                    
-                    if(spawn!=null) 
-                        player.sendPacket(new RadarControl(0,1,spawn.getLocx(),spawn.getLocy(),spawn.getLocz()));
-                } catch (NumberFormatException nfe)
-                { 
-                    player.sendMessage("Wrong command parameters");
-                }
+            	SpawnTable.getInstance().findNpcId(player, Integer.parseInt(command.substring(12).trim()));
             }
             else if (command.startsWith("EnterRift"))
             {