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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock