Jump to content
  • 0

[HELP] Item opens html


lorddragon2

Question

Hello again MxC thanks for your attention...

 

I want your help once more if someone can make a specifique item that opens an html...

 

More detailed I want a usable once item that can't be used on oly, tvt, dead, karma, flagged, fake death,

to open an html...

 

I have found some posts like this one: http://maxcheaters.com/forum/index.php?topic=47545.0

 

But steal not what i want!!! If someone can improve it work for latest l2jserver rev

 

It would be awsome!!!

 

Thanks in advance for reading it!!!

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

Its really easy to do.

 

Simply create new item handler for it.

 

You can even c/p restrictions from other item handler or custom share.

 

And few lines of code to open new htm window  (also may be taken from different shares, if u don't know this code)

Link to comment
Share on other sites

  • 0

Simply to open htm window, use this:

 

String html = null;

html = HtmCache.getInstance().getHtm(null, "data/html/filename" + htm);

 

NpcHtmlMessage msg = new NpcHtmlMessage(getObjectId());

msg.setHtml(html);

msg.replace("%objectId%", String.valueOf(getObjectId()));

player.sendPacket(msg);

Link to comment
Share on other sites

  • 0

Open an html with the above as i said... i want just the java thing i can create all the other files...

 

Thanks for your help guys!!!

Link to comment
Share on other sites

  • 0

Oh right, u expect ready code without any own effort?

 

Wrong section, its not martketplace where you can request ready things.

 

Its request dev help, we can post some advices, some tips etc.

 

I gave you code to open html, told you to create item handler.

 

Nothing more to do, just use your brain and put some own effort to do it, and.. done!

Link to comment
Share on other sites

  • 0

Sorry i didn't request the hole code just a little help

 

This code you gave me goes to HtmCache i think sorry i'm kind of newbie in java yet

 

I already created the item handler but the item still not working...

 

I registered it on masterhandler also...

 

and still nothing what else can i do?

 

Does anybody knows the code for the restriction or a part of it i can continue it from there!!!

 

Hmm, open a html with what options? Just a simple html, no buttons(with bypasses i mean)?

 

Nothing just open the html!!! with the restrictions!!!

Link to comment
Share on other sites

  • 0

Show us your code, we will check it and we will provide support for it.

 

About those check, they are really simple, sample:

 

if (player.getKarma > 0)

{

    player.sendMessage("Players with karma are not allowed to use this command!"

    return false;

}

 

Should be simple for everyone, even beginers.

Link to comment
Share on other sites

  • 0

package handlers.itemhandlers;

import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;



public class item implements IItemHandler
{
private static final int[] ITEM_IDS = { 10639 };

public void useItem(L2Playable playable, L2ItemInstance item,boolean forceUse)
    {
      if (!(playable instanceof L2PcInstance))
         return;
      L2PcInstance activeChar = (L2PcInstance)playable;
       int itemId = item.getItemId();
      
   if (itemId == 10639)
       {
	String htmFile = "data/html/merchant/658.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 the code i used...I dont get any problems on gameserver...

I ju

Link to comment
Share on other sites

  • 0

What do you mean? You don't have to modify anything with item, simply register item handler for item and thats all.

 

Item handlers means only action after double click.

Link to comment
Share on other sites

  • 0

Any error/info logs available at gameserver while loading handlers or trying to double click this item?

 

Make sure item id is correct etc.

 

About name of the class, type name is discouraged. By convention, Java type names usually start with an uppercase letter

Link to comment
Share on other sites

  • 0

Absolutely no errors...Yeah i saw that with the name and fixed it on my code i just forgot to fix it here also...

 

When i just dooble click the item nothing happens and the item id is ok!!!

 

Anyway i will keep trying fixing it if i find the solution will post it here!!!

Link to comment
Share on other sites

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...

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