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

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
Answer this question...

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