Jump to content

[Share]An item to become hero untill restart


Vago

Recommended Posts

  • 1 month later...

The problem on this share is the item can't be disappear ...i mean if the character press at the item it give hero status.. but the item still exist...

 

On inventory ... !!

 

Btw is nice share ...with  little modify to make the item disappear from inventory it works very well :)

 

 

guys i want to add this but i dont know were to find  net.sf.l2j.gameserver.handler.itemhandlers i try to find it with the windows explorer bud can't. Plzzz say me what way to take to find it plzzzz

 

loool owned!!!

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
  • 3 weeks later...

im make some changes, im like beuty things .. so this is most beuty than old :D

 

Change Log

- Added as Effect 2025 (Firewrks)

- Changed Item ID

- Added Messages, you can see Messages in Html File

- Added (IF Char is Hero cant use the event)

 

New Code

 

package net.sf.l2j.gameserver.handler.itemhandlers;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

public class HeroItem implements IItemHandler
{
    private static final int ITEM_IDS[] =
    { 
    9172
    };

    public void useItem(L2PlayableInstance playable, L2ItemInstance item)
    {
            if(!(playable instanceof L2PcInstance))
                return;
            L2PcInstance activeChar = (L2PcInstance)playable;
            if(activeChar.isHero())
            {
            	NpcHtmlMessage HtmlMessage = new NpcHtmlMessage(1);
            	HtmlMessage.setHtml("<html><body>Sorry, You are already Hero!</html></body>");
            	activeChar.sendPacket(HtmlMessage);
            } 
            else
            {
	activeChar.broadcastPacket(new MagicSkillUse(activeChar, activeChar, 2025, 1, 1, 1));
            	activeChar.setHero(true);
            	
            	NpcHtmlMessage HtmlMessage = new NpcHtmlMessage(1);
            	HtmlMessage.setHtml("<html><body>Congratulation now you are Hero, The Status will Removed in Restart.!</html></body>");
            	activeChar.sendPacket(HtmlMessage);
            	
            	activeChar.broadcastUserInfo();
                playable.destroyItem("Destroy", item.getObjectId(), 1, null, false);
            }
        }
    }

    public int[] getItemIds()
    {
        return ITEM_IDS;
    }

}

 

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
Reply to this topic...

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