Where it is wrong?

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
Punisher
Posts: 45
Joined: Tue Sep 01, 2009 6:59 pm

Where it is wrong?

Post by Punisher »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:
L2JDP Revision Number:
I have this code :

Code: Select all

package handlers.itemhandlers; import net.sf.l2j.gameserver.handler.IItemHandler;import net.sf.l2j.gameserver.cache.HtmCache;import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;import net.sf.l2j.gameserver.model.L2ItemInstance;import net.sf.l2j.gameserver.model.actor.L2Playable;   public class MagicGemOfLight implements IItemHandler{	private static final int[] ITEM_IDS = {8868}; 	public void useItem(L2Playable playable, L2ItemInstance item)    {	      if (!(playable instanceof L2PcInstance))	         return;	      L2PcInstance activeChar = (L2PcInstance)playable;	       int itemId = item.getItemId(); 	   if (itemId == 8868)       {		String htmFile = "data/html/menu.htm";		String htmContent = HtmCache.getInstance().getHtm(htmFile); 			NpcHtmlMessage infoHtml = new NpcHtmlMessage(1);			infoHtml.setHtml(htmContent);			activeChar.sendPacket(infoHtml);       }    }       public int[] getItemIds()    {    	return ITEM_IDS;    }}   
This is when you click on the item It apears an Html code.... But where it is wrong :S
User avatar
XavierElf
Posts: 92
Joined: Wed May 14, 2008 3:39 am
Location: Russia

Re: Where it is wrong?

Post by XavierElf »

And what's wrong? What does not work?
Sry for my bad english...
Punisher
Posts: 45
Joined: Tue Sep 01, 2009 6:59 pm

Re: Where it is wrong?

Post by Punisher »

it doesnt open html
Probe
Posts: 915
Joined: Thu Sep 03, 2009 6:36 pm
Location: Israel
Contact:

Re: Where it is wrong?

Post by Probe »

I really have no idea if this will work...
I think it won't because you need an NPC Object Id to send this packet...

Code: Select all

if (itemId == 8868){	String path = "data/html/menu.htm";	NpcHtmlMessage infoHtml = new NpcHtmlMessage(item.getObjectId(),"");	infoHtml.setFile(path);	activeChar.sendPacket(infoHtml);}

but you could also try this I guess...

Code: Select all

if (itemId == 8868){	String path = "data/html/menu.htm";	String htmContent = HtmCache.getInstance().getHtm(htmFile);	TuturialShowHtml infoHtml = new TutorialShowHtml(htmContent);	activeChar.sendPacket(infoHtml);}
Post Reply