Package com.l2jfrozen.gameserver.model.multisell

Examples of com.l2jfrozen.gameserver.model.multisell.MultiSellIngredient


                                {
                                        maintainItemFound = true;
                                }

                                // if it's a new ingredient, just store its info directly (item id, count, enchantment)
                                _ingredientsList.add(new MultiSellIngredient(e));
                        }
                }

                // If there is no maintainIngredient, then we must make sure that the enchantment is not kept from the client packet, as it may have been forged
                if (!maintainItemFound)
View Full Code Here


                boolean hasIngredient = false;

                for (MultiSellIngredient ing : templateEntry.getIngredients())
                {
                        // Load the ingredient from the template
                        MultiSellIngredient newIngredient = 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);
                                        hasIngredient = true;
                                }
                        }

                        // finally, add this ingredient to the entry
                        newEntry.addIngredient(newIngredient);
                }
                // Next add the adena amount, if any
                if (totalAdenaCount > 0)
                {
                        newEntry.addIngredient(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 = new MultiSellIngredient(ing);

                        if (maintainEnchantment && hasIngredient)
                        {
                                // 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)
                                {
                                        if (enchantLevel==0 && maintainEnchantment)
                                                enchantLevel = ing.getEnchantmentLevel();
                                        newIngredient.setEnchantmentLevel(enchantLevel);
                                }
                        }
                        newEntry.addProduct(newIngredient);
                }
                return newEntry;
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.multisell.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.