Package net.sf.l2j.gameserver.templates

Examples of net.sf.l2j.gameserver.templates.L2Item


  private void createItem(L2PcInstance activeChar, int id, int num)
  {
    if (num > 20)
    {
      L2Item template = ItemTable.getInstance().getTemplate(id);
      if (!template.isStackable())
      {
        activeChar.sendMessage("This item does not stack - Creation aborted.");
        return;
      }
    }
View Full Code Here


            continue// do not adena yet, as taxIngredient adena entries might occur next (order not guaranteed)
          }
          // if it is an armor/weapon, modify the enchantment level appropriately, if necessary
          else if (maintainEnchantment)
          {
              L2Item tempItem = ItemTable.getInstance().createDummyItem(ing.getItemId()).getItem();
              if ((tempItem instanceof L2Armor) || (tempItem instanceof L2Weapon))
                newIngredient.setEnchantmentLevel(enchantLevel);
          }

          // finally, add this ingredient to the entry
          newEntry.addIngredient(newIngredient);
        }
        // now add the adena, if any.
        if (adenaAmount > 0 )
        {
          newEntry.addIngredient(L2Multisell.getInstance().new MultiSellIngredient(57,adenaAmount,0,false,false));
        }
        // Now modify the enchantment level of products, if necessary
        for (MultiSellIngredient ing : templateEntry.getProducts())
        {
          // load the ingredient from the template
          MultiSellIngredient newIngredient = L2Multisell.getInstance().new MultiSellIngredient(ing);

          if (maintainEnchantment)
            {
              // if it is an armor/weapon, modify the enchantment level appropriately
              // (note, if maintain enchantment is "false" this modification will result to a +0)
              L2Item tempItem = ItemTable.getInstance().createDummyItem(ing.getItemId()).getItem();
              if ((tempItem instanceof L2Armor) || (tempItem instanceof L2Weapon))
                newIngredient.setEnchantmentLevel(enchantLevel);
            }
          newEntry.addProduct(newIngredient);
        }
View Full Code Here

        SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
        sendPacket(sm);
        return;
      }

      L2Item template = ItemTable.getInstance().getTemplate(L2Manor.getInstance().getRewardItem(
          itemId,manor.getCastle().getCrop(itemId,CastleManorManager.PERIOD_CURRENT).getReward()));
          weight += count * template.getWeight();

      if (!template.isStackable()) slots += count;
      else if (player.getInventory().getItemByItemId(itemId) == null) slots++;
    }

    if (!player.getInventory().validateWeight(weight))
    {
View Full Code Here

      return crops;
    }

    public int getSeedBasicPrice (int seedId) {
      L2Item seedItem = ItemTable.getInstance().getTemplate(seedId);

      if (seedItem != null) {
        return seedItem.getReferencePrice();
      }
    return 0;
    }
View Full Code Here

      }
      return 0;
    }

    public int getCropBasicPrice (int cropId) {
      L2Item cropItem = ItemTable.getInstance().getTemplate(cropId);

      if (cropItem != null)
        return cropItem.getReferencePrice();
    return 0;
    }
View Full Code Here

        int custom_type1 =  rs.getInt("custom_type1");
        int custom_type2 =  rs.getInt("custom_type2");
        int price_sell = rs.getInt("price_sell");
        int price_buy = rs.getInt("price_buy");
        int manaLeft = rs.getInt("mana_left");
        L2Item item = ItemTable.getInstance().getTemplate(item_id);
        if (item == null) {
          _log.severe("Item item_id="+item_id+" not known, object_id="+objectId);
          rs.close();
          statement.close();
          return null;
View Full Code Here

    // If item hasn't be found in inventory, create new one
    else
    {
      for (int i = 0; i < count; i++)
      {
        L2Item template = ItemTable.getInstance().getTemplate(itemId);
        if (template == null)
        {
          _log.log(Level.WARNING, (actor != null ? "[" + actor.getName() + "] ": "") "Invalid ItemId requested: ", itemId);
          return null;
        }

                item = ItemTable.getInstance().createItem(process, itemId, template.isStackable() ? count : 1, actor, reference);
        item.setOwnerId(getOwnerId());
        item.setLocation(getBaseLocation());
        item.setLastChange(L2ItemInstance.ADDED);

        // Add item in inventory
        addItem(item);
        // Updates database
        item.updateDatabase();

                // If stackable, end loop as entire count is included in 1 instance of item
                if (template.isStackable() || !Config.MULTIPLE_ITEM_DROP) break;
      }
    }

    refreshWeight();
    return item;
View Full Code Here

  {
    int tradeListID = Integer.parseInt(args[1]);
    int itemID = Integer.parseInt(args[2]);
    L2TradeList tradeList = TradeController.getInstance().getBuyList(tradeListID);

    L2Item item = ItemTable.getInstance().getTemplate(itemID);
    if (tradeList.getPriceForItemId(itemID) < 0)
    {
      return;
    }

    if (args.length > 3)
    {
      int price = Integer.parseInt(args[3]);
      int order =  findOrderTradeList(itemID, tradeList.getPriceForItemId(itemID), tradeListID);

      tradeList.replaceItem(itemID, Integer.parseInt(args[3]));
      updateTradeList(itemID, price, tradeListID, order);

      activeChar.sendMessage("Updated price for "+item.getName()+" in Trade List "+tradeListID);
      showShopList(activeChar, tradeListID, 1);
      return;
    }

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

    TextBuilder replyMSG = new TextBuilder();
    replyMSG.append("<html><title>Merchant Shop Item Edit</title>");
    replyMSG.append("<body>");
    replyMSG.append("<br>Edit an entry in merchantList.");
    replyMSG.append("<br>Editing Item: "+item.getName());
    replyMSG.append("<table>");
    replyMSG.append("<tr><td width=100>Property</td><td width=100>Edit Field</td><td width=100>Old Value</td></tr>");
    replyMSG.append("<tr><td><br></td><td></td></tr>");
    replyMSG.append("<tr><td>Price</td><td><edit var=\"price\" width=80></td><td>"+tradeList.getPriceForItemId(itemID)+"</td></tr>");
    replyMSG.append("</table>");
View Full Code Here

   * @param itemId : int designating the item
   * @return L2ItemInstance designating the dummy item created
   */
  public L2ItemInstance createDummyItem(int itemId)
  {
    L2Item item = getTemplate(itemId);
    if (item == null)
      return null;
    L2ItemInstance temp = new L2ItemInstance(0, item);
    try
    {
View Full Code Here

      try
      {
        CropProcure crop = CastleManager.getInstance().getCastleById(manorId).getCrop(itemId, CastleManorManager.PERIOD_CURRENT);
        int rewardItemId = L2Manor.getInstance().getRewardItem(itemId,crop.getReward());
        L2Item template = ItemTable.getInstance().getTemplate(rewardItemId);
        weight += count * template.getWeight();

        if (!template.isStackable())
          slots += count;
        else if (player.getInventory().getItemByItemId(itemId) == null)
          slots++;
      }
      catch (NullPointerException e)
View Full Code Here

TOP

Related Classes of net.sf.l2j.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.