NPC's HTML page

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
xalis
Posts: 17
Joined: Tue Jan 29, 2008 12:00 am
Location: Toulouse (France)

NPC's HTML page

Post 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.
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: NPC's HTML page

Post by JIV »

you will need create custom Npc class - best base on L2Npc
and modify
com.l2jserver.gameserver.model.actor.L2Npc.showChatWindow(L2PcInstance)
xalis
Posts: 17
Joined: Tue Jan 29, 2008 12:00 am
Location: Toulouse (France)

Re: NPC's HTML page

Post by xalis »

Thanks a lot JIV, i'll try it when i can.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: NPC's HTML page

Post by jurchiks »

or you can use a script with onFirstTalk in it
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
xalis
Posts: 17
Joined: Tue Jan 29, 2008 12:00 am
Location: Toulouse (France)

Re: NPC's HTML page

Post 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" ?
xalis
Posts: 17
Joined: Tue Jan 29, 2008 12:00 am
Location: Toulouse (France)

Re: NPC's HTML page

Post by xalis »

no idea? :(
xalis
Posts: 17
Joined: Tue Jan 29, 2008 12:00 am
Location: Toulouse (France)

Re: NPC's HTML page

Post by xalis »

No more idea?
mochitto
Posts: 87
Joined: Fri Jul 18, 2008 2:27 pm
Location: Slovakia

Re: NPC's HTML page

Post 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);       }} 
Sorry for my bad english.
Post Reply