Page 1 of 1

NPC's HTML page

Posted: Fri Jun 11, 2010 9:08 pm
by xalis
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number: 4271
L2JDP Revision Number: 7473

First of all I make a point of excusing me for my approximate language.
After that, i've a question about the L2J core side, specifically on the instancemanager i think (?)

Well, i'm looking for a way to control the HTML page sended to a player when he clicks on a specific NPC.

Does anyone have a idea? It will be very helpfull and appreciate. Thanks.

Re: NPC's HTML page

Posted: Fri Jun 11, 2010 10:24 pm
by JIV
you will need create custom Npc class - best base on L2Npc
and modify
com.l2jserver.gameserver.model.actor.L2Npc.showChatWindow(L2PcInstance)

Re: NPC's HTML page

Posted: Sat Jun 12, 2010 12:27 pm
by xalis
Thanks a lot JIV, i'll try it when i can.

Re: NPC's HTML page

Posted: Sat Jun 12, 2010 1:38 pm
by jurchiks
or you can use a script with onFirstTalk in it

Re: NPC's HTML page

Posted: Tue Jun 22, 2010 9:26 am
by xalis
Okay, i've tried but i've failed.

I've added a "L2TestInstance" in "public static enum InstanceType" of "L2Object.java" and created the "L2TestInstance.java" like this :

Code: Select all

package com.l2jserver.gameserver.model.actor.instance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;import com.l2jserver.gameserver.templates.chars.L2NpcTemplate; public class L2TestInstance extends L2NpcInstance{	public L2TestInstance(int objectId, L2NpcTemplate template)	{		super(objectId, template);		setInstanceType(InstanceType.L2TestInstance);	} 	@Override	public void onBypassFeedback(L2PcInstance player, String command)	{		player.sendMessage(command);	} 	@Override	public void showChatWindow(L2PcInstance player)	{		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); 		StringBuilder replyMSG = new StringBuilder("<html>");		replyMSG.append("<head><title>Test</title></head><body>");		replyMSG.append("It work's!");		replyMSG.append("<br>");		replyMSG.append("<center><button value=\"Test return\" action=\"bypass -h npc_test_return $desc\" width=260 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>");		replyMSG.append("</body></html>"); 		html.setHtml(replyMSG.toString());		player.sendPacket(html);	}}
So my question is, how i can handle the "npc_test_return" bypass in my "L2TestInstance.java" ?

Re: NPC's HTML page

Posted: Sun Jul 04, 2010 1:34 pm
by xalis
no idea? :(

Re: NPC's HTML page

Posted: Wed Sep 29, 2010 3:47 pm
by xalis
No more idea?

Re: NPC's HTML page

Posted: Wed Sep 29, 2010 3:57 pm
by mochitto
If u need only html window try make custom version of
http://svn.l2jdp.com/trunk/datapack_dev ... /Link.java

Dont forget for import in MasterHandler.java.

//edit
Here is rewrited your code and maybe working ;) (type of your NPC must be L2Test)

Code: Select all

 package com.l2jserver.gameserver.model.actor.instance;     import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;     public class L2TestInstance extends L2NpcInstance    {       public L2TestInstance(int objectId, L2NpcTemplate template)       {          super(objectId, template);          setInstanceType(InstanceType.L2TestInstance);       }            @Override       public void onBypassFeedback(L2PcInstance player, String command)       {          // BypassValidation Exploit plug.          if (player == null || player.getLastFolkNPC() == null || player.getLastFolkNPC().getObjectId() !=  this.getObjectId())            return;                      if (command.startsWith("npc_test_return"))          {                showChatWindow(player);          }          else            super.onBypassFeedback(player, command);       }            @Override       public void showChatWindow(L2PcInstance player)       {          if (player == null)            return;                      NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());               StringBuilder replyMSG = new StringBuilder("<html>");          replyMSG.append("<head><title>Test</title></head><body>");          replyMSG.append("It work's!");          replyMSG.append("<br>");          replyMSG.append("<center><button value=\"Test return\" action=\"bypass -h npc_test_return $desc\" width=260 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>");          replyMSG.append("</body></html>");               html.setHtml(replyMSG.toString());          player.sendPacket(html);       }}