Jump to content

Question

Posted

So I tried to create an item that when you click it, it gives you an armor part and then it disappears.

It doesn't give me any compile errors and it is clear at the gameserver window as well.

It still doesn't seem to work though,when i press it nothing happens.(although i have registered it)

I'm using the latest rev of l2j.Any help?

 

/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package handlers.itemhandlers;

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

public class Equipment implements IItemHandler
{
private static final int[] ITEM_IDS = { 3472 };

public void useItem(L2Playable playable, L2ItemInstance item)
    {
      if (!(playable instanceof L2PcInstance))
         return;
      L2PcInstance activeChar = (L2PcInstance)playable;
       int itemId = item.getItemId();
      
   if (itemId == 3472)
       {
   		    playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
			activeChar.sendMessage("(1) No-grade equipment item disappeared. You have received your no-grade equipment.");
                activeChar.getInventory().addItem("Wooden Helmet", 43, 1, activeChar, null);
       }
    }



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

1 answer to this question

Recommended Posts

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


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