Package net.sf.l2j.gameserver.model.L2Multisell

Examples of net.sf.l2j.gameserver.model.L2Multisell.MultiSellIngredient


          }
        }
        if(newIng)
        {
          // if it's a new ingredient, just store its info directly (item id, count, enchantment)
          _ingredientsList.add(L2Multisell.getInstance().new MultiSellIngredient(e));
        }
      }
      // now check if the player has sufficient items in the inventory to cover the ingredients' expences
      for(MultiSellIngredient e : _ingredientsList)
      {
View Full Code Here


      int totalAdenaCount = 0;

        for (MultiSellIngredient ing : templateEntry.getIngredients())
        {
          // load the ingredient from the template
          MultiSellIngredient newIngredient = L2Multisell.getInstance().new MultiSellIngredient(ing);

          if (newIngredient.getItemId() == 57 && newIngredient.isTaxIngredient())
          {
              double taxRate = 0.0;
            if (applyTaxes)
            {
                  if (merchant != null && merchant.getIsInTown())
                    taxRate = merchant.getCastle().getTaxRate();
            }

                 _transactionTax = (int)Math.round(newIngredient.getItemCount()*taxRate);
                 totalAdenaCount += _transactionTax;
            continue// do not yet add this adena amount to the list as non-taxIngredient adena might be entered later (order not guaranteed)
          }
          else if (ing.getItemId() == 57) // && !ing.isTaxIngredient()
          {
            totalAdenaCount += newIngredient.getItemCount();
            continue// do not yet add this adena amount to the list as taxIngredient adena might be entered later (order not guaranteed)
          }
          // if it is an armor/weapon, modify the enchantment level appropriately, if necessary
          else if (maintainEnchantment)
          {
              L2Item tempItem = ItemTable.getInstance().createDummyItem(newIngredient.getItemId()).getItem();
              if ((tempItem instanceof L2Armor) || (tempItem instanceof L2Weapon))
                newIngredient.setEnchantmentLevel(enchantLevel);
          }

          // finally, add this ingredient to the entry
          newEntry.addIngredient(newIngredient);
        }
        // Next add the adena amount, if any
        if (totalAdenaCount > 0)
          newEntry.addIngredient(L2Multisell.getInstance().new MultiSellIngredient(57, totalAdenaCount, 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(newIngredient.getItemId()).getItem();
              if ((tempItem instanceof L2Armor) || (tempItem instanceof L2Weapon))
                newIngredient.setEnchantmentLevel(enchantLevel);
            }
          newEntry.addProduct(newIngredient);
        }
        return newEntry;
    }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.L2Multisell.MultiSellIngredient

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.