Package l2p.gameserver.templates

Examples of l2p.gameserver.templates.L2Item


    if(player.getInventoryLimit() >= Config.SERVICES_EXPAND_INVENTORY_MAX)
    {
      player.sendMessage("Already max count.");
      return;
    }
    L2Item item = ItemTable.getInstance().getTemplate(Config.SERVICES_EXPAND_INVENTORY_ITEM);
    L2ItemInstance pay = player.getInventory().getItemByItemId(item.getItemId());
    if(pay != null && pay.getCount() >= Config.SERVICES_EXPAND_INVENTORY_PRICE)
    {
      player.getInventory().destroyItem(pay, Config.SERVICES_EXPAND_INVENTORY_PRICE, true);
      player.setExpandInventory(player.getExpandInventory() + 1);
      player.setVar("ExpandInventory", String.valueOf(player.getExpandInventory()));
View Full Code Here


  public void get(String[] param)
  {
    L2Player player = (L2Player) getSelf();
    int i = Integer.parseInt(param[0]);
    L2Item item = ItemTable.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]);
    L2ItemInstance pay = player.getInventory().getItemByItemId(item.getItemId());
    if(pay != null && pay.getCount() >= Config.SERVICES_RATE_BONUS_PRICE[i])
    {
      player.getInventory().destroyItem(pay, Config.SERVICES_RATE_BONUS_PRICE[i], true);
      Log.add(player.getName() + "|" + player.getObjectId() + "|rate bonus|" + Config.SERVICES_RATE_BONUS_VALUE[i] + "|" + Config.SERVICES_RATE_BONUS_DAYS[i] + "|", "services");
      try
View Full Code Here

                      for(Node i = d2.getFirstChild(); i != null; i = i.getNextSibling())
                      {
                        if("item".equalsIgnoreCase(i.getNodeName()))
                        {
                          final int itemId = Integer.parseInt(i.getAttributes().getNamedItem("id").getNodeValue());
                          final L2Item template = ItemTable.getInstance().getTemplate(itemId);
                          if(template == null)
                          {
                            _log.warning("Template not found for itemId: " + itemId + " for shop " + shop_id);
                            continue;
                          }
                          if(!checkItem(template))
                          {
                            continue;
                          }
                          counterItems++;
                          final int price = i.getAttributes().getNamedItem("price") != null ? Integer.parseInt(i.getAttributes().getNamedItem("price").getNodeValue()) : Math.round(template.getReferencePrice() * markup);
                          TradeItem item = new TradeItem();
                          item.setItemId(itemId);
                          final int itemCount = i.getAttributes().getNamedItem("count") != null ? Integer.parseInt(i.getAttributes().getNamedItem("count").getNodeValue()) : 0;
                          // Время респауна задается минутах
                          final int itemRechargeTime = i.getAttributes().getNamedItem("time") != null ? Integer.parseInt(i.getAttributes().getNamedItem("time").getNodeValue()) : 0;
View Full Code Here

  {
    for(int id : ids)
    {
      if(id != 0)
      {
        L2Item i = null;
        try
        {
          i = ItemTable.getInstance().getTemplate(id);
        }
        catch(Exception e)
        {
          System.out.println("Warning: unknown item " + i + " (" + id + ") in quest drop in " + getName());
        }
        if(i == null || i.getType2() != L2Item.TYPE2_QUEST)
        {
          if(Config.DEBUG_GS_LS)
          {
            System.out.println("Warning: non-quest item " + i + " (" + id + ") in quest drop in " + getName());
          }
View Full Code Here

        break;
      }
      case L2Item.SLOT_L_HAND:
      {
        L2ItemInstance slot = getPaperdollItem(PAPERDOLL_RHAND);
        L2Item oldItem = slot == null ? null : slot.getItem();
        L2Item newItem = item.getItem();
        if(oldItem != null && newItem.getItemType() == EtcItemType.ARROW && oldItem.getItemType() == WeaponType.BOW && oldItem.getCrystalType() != newItem.getCrystalType())
        {
          return;
        }
        if(oldItem != null && newItem.getItemType() == EtcItemType.BOLT && oldItem.getItemType() == WeaponType.CROSSBOW && oldItem.getCrystalType() != newItem.getCrystalType())
        {
          return;
        }
        if(newItem.getItemType() != EtcItemType.ARROW && newItem.getItemType() != EtcItemType.BOLT && newItem.getItemType() != EtcItemType.BAIT)
        {
          if(oldItem != null && oldItem.getBodyPart() == L2Item.SLOT_LR_HAND)
          {
            setPaperdollItem(PAPERDOLL_RHAND, null);
            setPaperdollItem(PAPERDOLL_LHAND, null);
          }
          else
          {
            setPaperdollItem(PAPERDOLL_LHAND, null);
          }
          setPaperdollItem(PAPERDOLL_LHAND, item);
        }
        else if(oldItem != null && (newItem.getItemType() == EtcItemType.ARROW && oldItem.getItemType() == WeaponType.BOW || newItem.getItemType() == EtcItemType.BOLT && oldItem.getItemType() == WeaponType.CROSSBOW || newItem.getItemType() == EtcItemType.BAIT && oldItem.getItemType() == WeaponType.ROD))
        {
          setPaperdollItem(PAPERDOLL_LHAND, item);
          if(newItem.getItemType() == EtcItemType.BAIT && getOwner().isPlayer())
          {
            L2Player owner = (L2Player) getOwner();
            owner.setVar("LastLure", String.valueOf(item.getObjectId()));
          }
        }
View Full Code Here

    }
    int objectId = 0;
    try
    {
      objectId = item_rset.getInt("object_id");
      L2Item item = ItemTable.getInstance().getTemplate(item_rset.getInt("item_id"));
      if(item == null)
      {
        _log.severe("Item item_id=" + item_rset.getInt("item_id") + " not known, object_id=" + objectId);
        return null;
      }
      // TODO при старте сервера чистить такие итемы
      if(item.isTemporal() && item_rset.getInt("shadow_life_time") <= 0)
      {
        return null;
      }
      L2ItemInstance inst = new L2ItemInstance(objectId, item, putInStorage);
      inst._existsInDb = true;
View Full Code Here

      return;
    }
    L2Player player = _inv.getOwner().getPlayer();
    L2Skill[] itemSkills;
    L2Skill enchant4Skill;
    L2Item it = item.getItem();
    itemSkills = it.getAttachedSkills();
    enchant4Skill = it.getEnchant4Skill();
    if(itemSkills != null)
    {
      for(L2Skill itemSkill : itemSkills)
      {
        if(itemSkill.getId() >= 26046 && itemSkill.getId() <= 26048)
View Full Code Here

      return;
    }
    L2Player player = _inv.getOwner().getPlayer();
    L2Skill[] itemSkills;
    L2Skill enchant4Skill = null;
    L2Item it = item.getItem();
    itemSkills = it.getAttachedSkills();
    if(item.getEnchantLevel() >= 4)
    {
      enchant4Skill = it.getEnchant4Skill();
    }
    // Для оружия при несоотвествии грейда скилы не выдаем
    if(it.getType2() == L2Item.TYPE2_WEAPON && player.getWeaponPenalty() > 0)
    {
      itemSkills = null;
      enchant4Skill = null;
    }
    if(itemSkills != null && itemSkills.length > 0)
View Full Code Here

        int weaponId = getTemplate().rhand;
        if (weaponId < 1) {
            return null;
        }
        // Get the weapon item equipped in the right hand of the L2NpcInstance
        L2Item item = ItemTable.getInstance().getTemplate(getTemplate().rhand);
        if (!(item instanceof L2Weapon)) {
            return null;
        }
        return (L2Weapon) item;
    }
View Full Code Here

        int weaponId = getTemplate().lhand;
        if (weaponId < 1) {
            return null;
        }
        // Get the weapon item equipped in the right hand of the L2NpcInstance
        L2Item item = ItemTable.getInstance().getTemplate(getTemplate().lhand);
        if (!(item instanceof L2Weapon)) {
            return null;
        }
        return (L2Weapon) item;
    }
View Full Code Here

TOP

Related Classes of l2p.gameserver.templates.L2Item

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.