Jump to content
  • 0

[Request]Visual items


Question

4 answers to this question

Recommended Posts

  • 0
Posted

@inventory.java

import com.l2jserver.gameserver.model.quest.Quest;

import com.l2jserver.gameserver.instancemanager.QuestManager;

//anchor code

public L2ItemInstance getPaperdollItemByL2ItemId(int slot)
{
	int index = getPaperdollIndex(slot);
	if (index == -1)
		return null;
	return _paperdoll[index];
}

//introducing custom code

public static int getHiddenArmorAndWeapopnId(L2ItemInstance[] dolls, int slot, long setid)
  {
		int set = (int)setid;
          L2ArmorSet armorSet = ArmorSetsTable.getInstance().getSet(set);
          switch(slot)
          {
                  case Inventory.PAPERDOLL_GLOVES:
                          if(armorSet != null)
                                  return armorSet.get_gloves();
                          break;
                  case Inventory.PAPERDOLL_CHEST:
                          if(armorSet != null)
                                  return armorSet.get_chest();
                          break;
                  case Inventory.PAPERDOLL_LEGS:
                          if(armorSet != null)
                                  return armorSet.get_legs();
                          break;
                  case Inventory.PAPERDOLL_FEET:
                          if(armorSet != null)
                                  return armorSet.get_feet();
                          break;
          }

          L2ItemInstance item = dolls[slot];

          if (item != null)
                  return item.getItemId();
         
          return 0;
 }
public synchronized int getPaperdollItemId(int slot) //modified here
{
	L2ItemInstance item = _paperdoll[slot];
	if(getOwner().getActingPlayer() != null)
    {
		if(getOwner().getActingPlayer().getPvpKills() >= 500)
		{
			Quest q = QuestManager.getInstance().getQuest("PriestOfBlessing");
			String value = q.loadGlobalQuestVar(getOwner().getActingPlayer().getName()+"_set");
			long _set = value == "" ? 0 : Long.parseLong(value);
   			if(_set!=0)
   			{
   					return Inventory.getHiddenArmorAndWeapopnId(_paperdoll, slot,_set);
   			}
		}
    }
	if (item != null)
		return item.getItemId();
	return 0;
}

 

 

 

@l2armorsets.java

        /**
         * @return the _chest
         */
        public int get_chest()
        {
                return _chest;
        }

        /**
         * @return the _legs
         */
        public int get_legs()
        {
                return _legs;
        }

        /**
         * @return the _head
         */
        public int get_head()
        {
                return _head;
        }

        /**
         * @return the _gloves
         */
        public int get_gloves()
        {
                return _gloves;
        }

        /**
         * @return the _feet
         */
        public int get_feet()
        {
                return _feet;
        }

A part of the code is taken from another user's post ( anti feed at olympiad , forgot the user's name).The code just takes a quest variable that the player has selected at a npc and uses this to put the armor that corresponds with that code.

I have also encountered a problem...after 50+ players it starts to make big lags... if anyone could help me to improve the code... I'm newbie in java this is my first program...

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

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