Jump to content
  • 0

npc to pc need fix inthe lates rev l2jofficial - L2jserver


Question

Posted

in this file only have error any cant help me plis ...

Index: java/net/sf/l2j/gameserver/model/actor/L2Npc.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/L2Npc.java	(revision 2939)
+++ java/net/sf/l2j/gameserver/model/actor/L2Npc.java	(working copy)
@@ -35,6 +35,7 @@
import net.sf.l2j.gameserver.datatables.SpawnTable;
import net.sf.l2j.gameserver.idfactory.IdFactory;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
+import net.sf.l2j.gameserver.instancemanager.CustomNpcInstanceManager;
import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
import net.sf.l2j.gameserver.instancemanager.FortManager;
import net.sf.l2j.gameserver.instancemanager.QuestManager;
@@ -62,6 +63,7 @@
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2TeleporterInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2WarehouseInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2CustomNpcInstance;
import net.sf.l2j.gameserver.model.actor.knownlist.NpcKnownList;
import net.sf.l2j.gameserver.model.actor.stat.NpcStat;
import net.sf.l2j.gameserver.model.actor.status.NpcStatus;
@@ -119,7 +121,10 @@

	/** The interaction distance of the L2NpcInstance(is used as offset in MovetoLocation method) */
	public static final int INTERACTION_DISTANCE = 150;
-	
+
+	/** The Polymorph object that manage this L2NpcInstance's morph to a PcInstance... I wrote this line too =P Darki699 */
+	private L2CustomNpcInstance _customNpcInstance;
+
	/** The L2Spawn object that manage this L2NpcInstance */
	private L2Spawn _spawn;

@@ -194,8 +199,10 @@
	 */
	public void onRandomAnimation()
	{
+		int min = (_customNpcInstance != null) ? 1  : 2;
+		int max = (_customNpcInstance != null) ? 13 : 3;
		// Send a packet SocialAction to all L2PcInstance in the _KnownPlayers of the L2NpcInstance
-		SocialAction sa = new SocialAction(getObjectId(), Rnd.get(2, 3));
+		SocialAction sa = new SocialAction(getObjectId(), Rnd.get(min, max));
		broadcastPacket(sa);
	}

@@ -755,6 +762,10 @@
                                     "  Seconds<br>"
                                     );
                         }
+ 			html1.append("<tr><td>Object ID</td><td>" + getObjectId() + "</td><td>NPC ID</td><td>" + getTemplate().npcId + "</td></tr>");
+ 			
+ 			html1.append("<tr><td>Object ID</td><td>"+getObjectId()+"</td></tr>");
+ 			html1.append("<tr><td>Spawn ID</td><td>"+getSpawn().getId()+"</td></tr>");

                         StringUtil.append(html1,
                                 "<table border=\"0\" width=\"100%\">" +
@@ -763,6 +774,12 @@
                                 "</td><td>NPC ID</td><td>",
                                 String.valueOf(getTemplate().npcId),
                                 "</td></tr>" +
+                        		"<tr><td>Object ID</td><td>",
+                        		String.valueOf(getObjectId()),
+                        		"</td></tr>" +
+             			        "<tr><td>Spawn ID</td><td>",
+             			        String.valueOf(getSpawn().getId()),
+             			        "</td></tr>" +
                                 "<tr><td>Castle</td><td>" +
                                 String.valueOf(getCastle().getCastleId()),
                                 "</td><td>Coords</td><td>",
@@ -2458,6 +2475,14 @@
	public void setSpawn(L2Spawn spawn)
	{
		_spawn = spawn;
+		// Does this Npc morph into a PcInstance?
+		if (_spawn != null)
+		{
+		      if (CustomNpcInstanceManager.getInstance().isThisL2CustomNpcInstance(_spawn.getId() , getNpcId()))
+		       {
+		    	new L2CustomNpcInstance(this);
+		       }
+		 }
	}

	@Override
@@ -2683,7 +2708,17 @@
			return true;
		return false;
	}
-	
+
+	public L2CustomNpcInstance getCustomNpcInstance()
+	{
+	 	return _customNpcInstance;
+    }
+ 
+	public void setCustomNpcInstance(L2CustomNpcInstance arg)
+	{
+	  _customNpcInstance = arg;
+	}
+
	@Override
	public NpcInventory getInventory()
	{

4 answers to this question

Recommended Posts

  • 0
Posted

in this file only have error any cant help me plis ...

Index: java/net/sf/l2j/gameserver/model/actor/L2Npc.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/L2Npc.java	(revision 2939)
+++ java/net/sf/l2j/gameserver/model/actor/L2Npc.java	(working copy)
@@ -35,6 +35,7 @@
import net.sf.l2j.gameserver.datatables.SpawnTable;
import net.sf.l2j.gameserver.idfactory.IdFactory;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
+import net.sf.l2j.gameserver.instancemanager.CustomNpcInstanceManager;
import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
import net.sf.l2j.gameserver.instancemanager.FortManager;
import net.sf.l2j.gameserver.instancemanager.QuestManager;
@@ -62,6 +63,7 @@
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2TeleporterInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2WarehouseInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2CustomNpcInstance;
import net.sf.l2j.gameserver.model.actor.knownlist.NpcKnownList;
import net.sf.l2j.gameserver.model.actor.stat.NpcStat;
import net.sf.l2j.gameserver.model.actor.status.NpcStatus;
@@ -119,7 +121,10 @@

	/** The interaction distance of the L2NpcInstance(is used as offset in MovetoLocation method) */
	public static final int INTERACTION_DISTANCE = 150;
-	
+
+	/** The Polymorph object that manage this L2NpcInstance's morph to a PcInstance... I wrote this line too =P Darki699 */
+	private L2CustomNpcInstance _customNpcInstance;
+
	/** The L2Spawn object that manage this L2NpcInstance */
	private L2Spawn _spawn;

@@ -194,8 +199,10 @@
	 */
	public void onRandomAnimation()
	{
+		int min = (_customNpcInstance != null) ? 1  : 2;
+		int max = (_customNpcInstance != null) ? 13 : 3;
		// Send a packet SocialAction to all L2PcInstance in the _KnownPlayers of the L2NpcInstance
-		SocialAction sa = new SocialAction(getObjectId(), Rnd.get(2, 3));
+		SocialAction sa = new SocialAction(getObjectId(), Rnd.get(min, max));
		broadcastPacket(sa);
	}

@@ -755,6 +762,10 @@
                                     "  Seconds<br>"
                                     );
                         }
+ 			html1.append("<tr><td>Object ID</td><td>" + getObjectId() + "</td><td>NPC ID</td><td>" + getTemplate().npcId + "</td></tr>");
+ 			
+ 			html1.append("<tr><td>Object ID</td><td>"+getObjectId()+"</td></tr>");
+ 			html1.append("<tr><td>Spawn ID</td><td>"+getSpawn().getId()+"</td></tr>");

                         StringUtil.append(html1,
                                 "<table border=\"0\" width=\"100%\">" +
@@ -763,6 +774,12 @@
                                 "</td><td>NPC ID</td><td>",
                                 String.valueOf(getTemplate().npcId),
                                 "</td></tr>" +
+                        		"<tr><td>Object ID</td><td>",
+                        		String.valueOf(getObjectId()),
+                        		"</td></tr>" +
+             			        "<tr><td>Spawn ID</td><td>",
+             			        String.valueOf(getSpawn().getId()),
+             			        "</td></tr>" +
                                 "<tr><td>Castle</td><td>" +
                                 String.valueOf(getCastle().getCastleId()),
                                 "</td><td>Coords</td><td>",
@@ -2458,6 +2475,14 @@
	public void setSpawn(L2Spawn spawn)
	{
		_spawn = spawn;
+		// Does this Npc morph into a PcInstance?
+		if (_spawn != null)
+		{
+		      if (CustomNpcInstanceManager.getInstance().isThisL2CustomNpcInstance(_spawn.getId() , getNpcId()))
+		       {
+		    	new L2CustomNpcInstance(this);
+		       }
+		 }
	}

	@Override
@@ -2683,7 +2708,17 @@
			return true;
		return false;
	}
-	
+
+	public L2CustomNpcInstance getCustomNpcInstance()
+	{
+	 	return _customNpcInstance;
+    }
+ 
+	public void setCustomNpcInstance(L2CustomNpcInstance arg)
+	{
+	  _customNpcInstance = arg;
+	}
+
	@Override
	public NpcInventory getInventory()
	{

 

explain what error you have

when you compiling?

you can't find lines or what?

  • 0
Posted

first : what kind of error

second: if you got a compile error tell us the error msg

third: as i know lastest rev have a npc moprhed engine allready in the source ready

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...