123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package com.l2jserver.gameserver.model.multisell;
- import com.l2jserver.gameserver.datatables.ItemTable;
- import com.l2jserver.gameserver.model.L2ItemInstance;
- import com.l2jserver.gameserver.templates.item.L2Armor;
- import com.l2jserver.gameserver.templates.item.L2Item;
- import com.l2jserver.gameserver.templates.item.L2Weapon;
- /**
- *
- * @author DS
- *
- */
- public class Ingredient implements Cloneable
- {
- private int _itemId;
- private long _itemCount;
- private boolean _isTaxIngredient, _maintainIngredient;
-
- private L2Item _template = null;
- private ItemInfo _itemInfo = null;
-
- public Ingredient(int itemId, long itemCount, boolean isTaxIngredient, boolean maintainIngredient)
- {
- _itemId = itemId;
- _itemCount = itemCount;
- _isTaxIngredient = isTaxIngredient;
- _maintainIngredient = maintainIngredient;
- if (_itemId > 0)
- _template = ItemTable.getInstance().getTemplate(_itemId);
- }
-
- @Override
- public final Ingredient clone()
- {
- try
- {
- return (Ingredient)super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- return null; // should not happens
- }
- }
-
- public final L2Item getTemplate()
- {
- return _template;
- }
-
- public final void setItemInfo(L2ItemInstance item)
- {
- _itemInfo = new ItemInfo(item);
- }
-
- public final void setItemInfo(ItemInfo info)
- {
- _itemInfo = info;
- }
-
- public final ItemInfo getItemInfo()
- {
- return _itemInfo;
- }
-
- public final int getEnchantLevel()
- {
- return _itemInfo != null ? _itemInfo.getEnchantLevel() : 0;
- }
-
- public final void setItemId(int itemId)
- {
- _itemId = itemId;
- }
-
- public final int getItemId()
- {
- return _itemId;
- }
-
- public final void setItemCount(long itemCount)
- {
- _itemCount = itemCount;
- }
-
- public final long getItemCount()
- {
- return _itemCount;
- }
-
- public final void setIsTaxIngredient(boolean isTaxIngredient)
- {
- _isTaxIngredient = isTaxIngredient;
- }
-
- public final boolean isTaxIngredient()
- {
- return _isTaxIngredient;
- }
-
- public final void setMaintainIngredient(boolean maintainIngredient)
- {
- _maintainIngredient = maintainIngredient;
- }
-
- public final boolean getMaintainIngredient()
- {
- return _maintainIngredient;
- }
- public final boolean isStackable()
- {
- return _template == null ? true : _template.isStackable();
- }
-
- public final boolean isArmorOrWeapon()
- {
- return _template == null ? false : _template instanceof L2Armor || _template instanceof L2Weapon;
- }
-
- public final int getWeight()
- {
- return _template == null ? 0 : _template.getWeight();
- }
- }
|