Jump to content
  • 0

[HELP] Item opens html


Question

Posted

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

14 answers to this question

Recommended Posts

  • 0
Posted

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)

  • 0
Posted

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);

  • 0
Posted

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

  • 0
Posted

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!

  • 0
Posted

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

  • 0
Posted

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.

  • 0
Posted

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

  • 0
Posted

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.

  • 0
Posted

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

  • 0
Posted

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

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


  • Posts

    • Buying Epics/ S Gear on Elixir Whisper me
    • Hello everyone, I am looking to purchase a Premium Lineage 2 High Five server pack. My main requirements are: Stability & Quality (Most Important): The pack must be highly stable with no system errors or major bugs. Custom Features: It must include ready-to-use custom features such as a fully functional Community Board, custom NPC Buffers, and Custom Item Sellers (GM Shops), etc. Complete Files: It is absolutely necessary that the full source code (src) and complete Geodata are included. If you are selling a pack that meets these criteria, please send me a PM or leave a reply with the following information: Brief details and key features of the pack Price Test server availability (I would like to test it before buying) Thank you!
    • L2jmobiusDevClon — Classic Interlude p110 Emulator L2jmobiusDevClon is actively developing a Lineage 2 Classic Interlude p110 emulator. Development is done in free time with a strong focus on: • Stability • Authentic Classic mechanics • Clean and optimized architecture The project is based on the L2jMobius source and is continuously evolving and improving. System Requirements: • Java 25 • MariaDB 12.0 • Client p110 Current Revision: 3.0 Development Status: Active Distribution: Free Official Website: https://www.l2jmobiusdevclon.pp.ua Discord Server: https://discord.gg/23a9S8g4Bn Contact: Telegram — @L2jmobiusDevClon Also available via private messages Project Goals: ✔ Improved stability ✔ Maximum Classic accuracy ✔ Core optimization We are currently looking for: • Testers • Server administrators Suggestions, bug reports, and ideas are always welcome. Contact us via: ✔ Discord ✔ Telegram ✔ Private Messages
    • i guess loading only the effects that are needed it will maybe work, like removing from reshade shader folder the ones that are not needed, depends on the pc also i guess, also limithing the game at 30fps can be better maybe
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..