lorddragon2 Posted March 29, 2011 Share Posted March 29, 2011 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!!! Quote Link to comment Share on other sites More sharing options...
0 Matim Posted March 29, 2011 Share Posted March 29, 2011 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) Quote Link to comment Share on other sites More sharing options...
0 An4rchy Posted March 29, 2011 Share Posted March 29, 2011 Hmm, open a html with what options? Just a simple html, no buttons(with bypasses i mean)? Quote Link to comment Share on other sites More sharing options...
0 Matim Posted March 29, 2011 Share Posted March 29, 2011 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); Quote Link to comment Share on other sites More sharing options...
0 lorddragon2 Posted March 29, 2011 Author Share Posted March 29, 2011 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!!! Quote Link to comment Share on other sites More sharing options...
0 Matim Posted March 29, 2011 Share Posted March 29, 2011 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! Quote Link to comment Share on other sites More sharing options...
0 lorddragon2 Posted March 29, 2011 Author Share Posted March 29, 2011 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!!! Quote Link to comment Share on other sites More sharing options...
0 Matim Posted March 29, 2011 Share Posted March 29, 2011 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. Quote Link to comment Share on other sites More sharing options...
0 lorddragon2 Posted March 29, 2011 Author Share Posted March 29, 2011 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 Quote Link to comment Share on other sites More sharing options...
0 Matim Posted March 29, 2011 Share Posted March 29, 2011 I ju .. what exactly :) ? I guess there is missed part of your message. Quote Link to comment Share on other sites More sharing options...
0 lorddragon2 Posted March 29, 2011 Author Share Posted March 29, 2011 Yeah i just thought if i have to modify the item also? Quote Link to comment Share on other sites More sharing options...
0 Matim Posted March 29, 2011 Share Posted March 29, 2011 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. Quote Link to comment Share on other sites More sharing options...
0 lorddragon2 Posted March 29, 2011 Author Share Posted March 29, 2011 I did that but hell when double click nothing happens is there anything wrong with the code? Quote Link to comment Share on other sites More sharing options...
0 Matim Posted March 29, 2011 Share Posted March 29, 2011 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 Quote Link to comment Share on other sites More sharing options...
0 lorddragon2 Posted March 29, 2011 Author Share Posted March 29, 2011 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!!! Quote Link to comment Share on other sites More sharing options...
Question
lorddragon2
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
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.