Browse Source

New L2JMod..

* Possibility to have Warehouse sorted by Item Type eg. Weapon/Armor/Recipes etc.. Requires [DP4499]
nBd 17 years ago
parent
commit
91ba111060

+ 8 - 0
L2_GameServer_T1/java/config/l2jmods.properties

@@ -150,3 +150,11 @@ BankingEnabled = false
 BankingGoldbarCount = 1
 BankingGoldbarCount = 1
 # This is the amount of Adena someone will get when they do the .withdraw command, and also the same amount they will lose when they do .deposit
 # This is the amount of Adena someone will get when they do the .withdraw command, and also the same amount they will lose when they do .deposit
 BankingAdenaCount = 500000000
 BankingAdenaCount = 500000000
+
+#----------------------------------
+# Warehouse Sorting
+# Shows Withdraw Window sorted by ItemType (Armor/Weapon/Spellbook....)
+#----------------------------------
+EnableWarehouseSortingClan = False
+EnableWarehouseSortingPrivate = False
+EnableWarehouseSortingFreight = False

+ 12 - 0
L2_GameServer_T1/java/net/sf/l2j/Config.java

@@ -570,6 +570,9 @@ public final class Config
     public static boolean	BANKING_SYSTEM_ENABLED;
     public static boolean	BANKING_SYSTEM_ENABLED;
     public static int		BANKING_SYSTEM_GOLDBARS;
     public static int		BANKING_SYSTEM_GOLDBARS;
     public static int		BANKING_SYSTEM_ADENA;
     public static int		BANKING_SYSTEM_ADENA;
+    public static boolean	L2JMOD_ENABLE_WAREHOUSESORTING_CLAN;
+    public static boolean	L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE;
+    public static boolean	L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT;
     
     
     /** ************************************************** **/
     /** ************************************************** **/
 	/** L2JMods Settings -End                              **/
 	/** L2JMods Settings -End                              **/
@@ -1612,6 +1615,10 @@ public final class Config
                 L2JMOD_WEDDING_SAMESEX                  = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False"));
                 L2JMOD_WEDDING_SAMESEX                  = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False"));
                 L2JMOD_WEDDING_FORMALWEAR               = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
                 L2JMOD_WEDDING_FORMALWEAR               = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
                 L2JMOD_WEDDING_DIVORCE_COSTS            = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));
                 L2JMOD_WEDDING_DIVORCE_COSTS            = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));
+                
+                L2JMOD_ENABLE_WAREHOUSESORTING_CLAN     = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingClan", "False"));
+                L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE  = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingPrivate", "False"));
+                L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT  = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingFreight", "False"));
 
 
                 if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
                 if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
                 {
                 {
@@ -2155,6 +2162,11 @@ public final class Config
         else if (pName.equalsIgnoreCase("TvTEventParticipationTime")) TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(pValue);
         else if (pName.equalsIgnoreCase("TvTEventParticipationTime")) TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(pValue);
         else if (pName.equalsIgnoreCase("TvTEventRunningTime")) TVT_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
         else if (pName.equalsIgnoreCase("TvTEventRunningTime")) TVT_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
         else if (pName.equalsIgnoreCase("TvTEventParticipationNpcId")) TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);
         else if (pName.equalsIgnoreCase("TvTEventParticipationNpcId")) TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);
+        
+        // L2JMOD Warehouse Sorting
+        else if (pName.equalsIgnoreCase("EnableWarehouseSortingClan")) L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("EnableWarehouseSortingPrivate")) L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("EnableWarehouseSortingFreight")) L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT = Boolean.parseBoolean(pValue);
 
 
         // PvP settings
         // PvP settings
         else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);
         else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);

+ 73 - 3
L2_GameServer_T1/java/net/sf/l2j/gameserver/model/L2ItemInstance.java

@@ -41,6 +41,7 @@ import net.sf.l2j.gameserver.skills.funcs.Func;
 import net.sf.l2j.gameserver.templates.L2Armor;
 import net.sf.l2j.gameserver.templates.L2Armor;
 import net.sf.l2j.gameserver.templates.L2EtcItem;
 import net.sf.l2j.gameserver.templates.L2EtcItem;
 import net.sf.l2j.gameserver.templates.L2Item;
 import net.sf.l2j.gameserver.templates.L2Item;
+import net.sf.l2j.gameserver.templates.L2Weapon;
 
 
 
 
 /**
 /**
@@ -158,6 +159,7 @@ public final class L2ItemInstance extends L2Object
 		_item = ItemTable.getInstance().getTemplate(itemId);
 		_item = ItemTable.getInstance().getTemplate(itemId);
 		if (_itemId == 0 || _item == null)
 		if (_itemId == 0 || _item == null)
 			throw new IllegalArgumentException();
 			throw new IllegalArgumentException();
+		super.setName(_item.getName());
 		setCount(1);
 		setCount(1);
 		_loc = ItemLocation.VOID;
 		_loc = ItemLocation.VOID;
 		_type1 = 0;
 		_type1 = 0;
@@ -179,6 +181,7 @@ public final class L2ItemInstance extends L2Object
 		_item = item;
 		_item = item;
 		if (_itemId == 0 || _item == null)
 		if (_itemId == 0 || _item == null)
 			throw new IllegalArgumentException();
 			throw new IllegalArgumentException();
+		super.setName(_item.getName());
 		setCount(1);
 		setCount(1);
 		_loc = ItemLocation.VOID;
 		_loc = ItemLocation.VOID;
 		_mana = _item.getDuration();
 		_mana = _item.getDuration();
@@ -415,10 +418,77 @@ public final class L2ItemInstance extends L2Object
 		return _itemId;
 		return _itemId;
 	}
 	}
 
 
+	/**
+	 * Returns true if item is an EtcItem
+	 * @return boolean
+	 */
+	public boolean isEtcItem()
+	{
+		return (_item instanceof L2EtcItem);
+	}
+	
+	/**
+	 * Returns true if item is a Weapon/Shield
+	 * @return boolean
+	 */
+	public boolean isWeapon()
+	{
+		return (_item instanceof L2Weapon);
+	}
+	
+	/**
+	 * Returns true if item is an Armor
+	 * @return boolean
+	 */
+	public boolean isArmor()
+	{
+		return (_item instanceof L2Armor);
+	}
+	
+	/**
+	 * Returns the characteristics of the L2EtcItem
+	 * @return L2EtcItem
+	 */
+	public L2EtcItem getEtcItem()
+	{
+		if (_item instanceof L2EtcItem)
+		{
+			return (L2EtcItem) _item;
+		}
+		return null;
+	}
+	
+	/**
+	 * Returns the characteristics of the L2Weapon
+	 * @return L2Weapon
+	 */
+	public L2Weapon getWeaponItem()
+	{
+		if (_item instanceof L2Weapon)
+		{
+			return (L2Weapon) _item;
+		}
+		return null;
+	}
+	
+	/**
+	 * Returns the characteristics of the L2Armor
+	 * @return L2Armor
+	 */
+	public L2Armor getArmorItem()
+	{
+		if (_item instanceof L2Armor)
+		{
+			return (L2Armor) _item;
+		}
+		return null;
+	}
+
     /**
     /**
-     * Returns the quantity of crystals for crystallization
-     * @return int
-     */
+	 * Returns the quantity of crystals for crystallization
+	 * 
+	 * @return int
+	 */
     public final int getCrystalCount()
     public final int getCrystalCount()
     {
     {
         return _item.getCrystalCount(_enchantLevel);
         return _item.getCrystalCount(_enchantLevel);

+ 155 - 4
L2_GameServer_T1/java/net/sf/l2j/gameserver/model/actor/instance/L2WarehouseInstance.java

@@ -17,11 +17,15 @@ package net.sf.l2j.gameserver.model.actor.instance;
 import java.util.Map;
 import java.util.Map;
 
 
 import net.sf.l2j.Config;
 import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.cache.HtmCache;
 import net.sf.l2j.gameserver.model.L2Clan;
 import net.sf.l2j.gameserver.model.L2Clan;
 import net.sf.l2j.gameserver.model.PcFreight;
 import net.sf.l2j.gameserver.model.PcFreight;
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.serverpackets.ActionFailed;
 import net.sf.l2j.gameserver.serverpackets.ActionFailed;
+import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
 import net.sf.l2j.gameserver.serverpackets.PackageToList;
 import net.sf.l2j.gameserver.serverpackets.PackageToList;
+import net.sf.l2j.gameserver.serverpackets.SortedWareHouseWithdrawalList;
+import net.sf.l2j.gameserver.serverpackets.SortedWareHouseWithdrawalList.WarehouseListType;
 import net.sf.l2j.gameserver.serverpackets.SystemMessage;
 import net.sf.l2j.gameserver.serverpackets.SystemMessage;
 import net.sf.l2j.gameserver.serverpackets.WareHouseDepositList;
 import net.sf.l2j.gameserver.serverpackets.WareHouseDepositList;
 import net.sf.l2j.gameserver.serverpackets.WareHouseWithdrawalList;
 import net.sf.l2j.gameserver.serverpackets.WareHouseWithdrawalList;
@@ -58,6 +62,23 @@ public final class L2WarehouseInstance extends L2FolkInstance
         }
         }
         return "data/html/warehouse/" + pom + ".htm";
         return "data/html/warehouse/" + pom + ".htm";
     }
     }
+    
+    private void showRetrieveWindow(L2PcInstance player, WarehouseListType itemtype, byte sortorder)
+	{
+    	player.sendPacket(ActionFailed.STATIC_PACKET);
+    	player.setActiveWarehouse(player.getWarehouse());
+
+    	if (player.getActiveWarehouse().getSize() == 0)
+    	{
+    		player.sendPacket(new SystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
+    		return;
+    	}
+
+		if (Config.DEBUG)
+			_log.fine("Showing stored items");
+		
+		player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE, itemtype, sortorder));
+	}
 
 
     private void showRetrieveWindow(L2PcInstance player)
     private void showRetrieveWindow(L2PcInstance player)
     {
     {
@@ -102,6 +123,27 @@ public final class L2WarehouseInstance extends L2FolkInstance
             }
             }
     	}
     	}
     }
     }
+    
+    private void showWithdrawWindowClan(L2PcInstance player, WarehouseListType itemtype, byte sortorder)
+    {
+    	player.sendPacket(ActionFailed.STATIC_PACKET);
+    	if ((player.getClanPrivileges() & L2Clan.CP_CL_VIEW_WAREHOUSE) != L2Clan.CP_CL_VIEW_WAREHOUSE)
+    	{
+    		player.sendPacket(new SystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_CLAN_WAREHOUSE));
+    		return;
+    	}
+    	else
+    	{
+    		if (player.getClan().getLevel() == 0)
+    			player.sendPacket(new SystemMessage(SystemMessageId.ONLY_LEVEL_1_CLAN_OR_HIGHER_CAN_USE_WAREHOUSE));
+    		else
+    		{
+    			player.setActiveWarehouse(player.getClan().getWarehouse());
+    			if (Config.DEBUG) _log.fine("Showing items to deposit - clan");
+    			player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN, itemtype, sortorder));
+    		}
+    	}
+	}
 
 
     private void showWithdrawWindowClan(L2PcInstance player)
     private void showWithdrawWindowClan(L2PcInstance player)
     {
     {
@@ -123,6 +165,32 @@ public final class L2WarehouseInstance extends L2FolkInstance
             }
             }
     	}
     	}
     }
     }
+    
+    private void showWithdrawWindowFreight(L2PcInstance player, WarehouseListType itemtype, byte sortorder)
+	{
+    	player.sendPacket(ActionFailed.STATIC_PACKET);
+    	if (Config.DEBUG) _log.fine("Showing freightened items");
+
+    	PcFreight freight = player.getFreight();
+
+    	if (freight != null)
+    	{
+    		if (freight.getSize() > 0)
+    		{
+    			if (Config.ALT_GAME_FREIGHTS)
+    				freight.setActiveLocation(0);
+    			else
+    				freight.setActiveLocation(getWorldRegion().hashCode());
+    			
+    			player.setActiveWarehouse(freight);
+    			player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.FREIGHT, itemtype, sortorder));
+    		}
+    		else
+    			player.sendPacket(new SystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
+    	}
+    	else
+    		if (Config.DEBUG) _log.fine("no items freightened");
+	}
 
 
     private void showWithdrawWindowFreight(L2PcInstance player)
     private void showWithdrawWindowFreight(L2PcInstance player)
     {
     {
@@ -221,18 +289,72 @@ public final class L2WarehouseInstance extends L2FolkInstance
             player.closeNetConnection();
             player.closeNetConnection();
             return;
             return;
         }
         }
+        
+        String param[] = command.split("_");
 
 
         if (command.startsWith("WithdrawP"))
         if (command.startsWith("WithdrawP"))
         {
         {
-            showRetrieveWindow(player);
+        	if (Config.L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE)
+        	{
+        		String htmFile = "data/html/mods/WhSortedP.htm";
+        		String htmContent = HtmCache.getInstance().getHtm(htmFile);
+        		if (htmContent != null)
+        		{
+        			NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
+        			npcHtmlMessage.setHtml(htmContent);
+        			npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
+        			player.sendPacket(npcHtmlMessage);
+        		}
+        		else
+        		{
+        			_log.warning("Missing htm: " + htmFile + " !");
+        		}
+        	}
+        	else
+        		showRetrieveWindow(player);
+        }
+        else if (command.startsWith("WithdrawSortedP"))
+        {
+        	if (param.length > 2)
+        		showRetrieveWindow(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2]));
+        	else if (param.length > 1)
+        		showRetrieveWindow(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
+        	else
+        		showRetrieveWindow(player, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
         }
         }
         else if (command.equals("DepositP"))
         else if (command.equals("DepositP"))
         {
         {
             showDepositWindow(player);
             showDepositWindow(player);
         }
         }
-        else if (command.equals("WithdrawC"))
+        else if (command.startsWith("WithdrawC"))
         {
         {
-            showWithdrawWindowClan(player);
+        	if (Config.L2JMOD_ENABLE_WAREHOUSESORTING_CLAN)
+        	{
+        		String htmFile = "data/html/mods/WhSortedC.htm";
+        		String htmContent = HtmCache.getInstance().getHtm(htmFile);
+        		if (htmContent != null)
+        		{
+        			NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
+        			npcHtmlMessage.setHtml(htmContent);
+        			npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
+        			player.sendPacket(npcHtmlMessage);
+        		}
+        		else
+        		{
+        			_log.warning("Missing htm: " + htmFile + " !");
+        		}
+        	}
+        	else
+        		showWithdrawWindowClan(player);
+        }
+        else if (command.startsWith("WithdrawSortedC"))
+        {
+        	if (param.length > 2)
+        		showWithdrawWindowClan(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2]));
+        	else if (param.length > 1)
+        		showWithdrawWindowClan(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
+        	else
+        		showWithdrawWindowClan(player, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
         }
         }
         else if (command.equals("DepositC"))
         else if (command.equals("DepositC"))
         {
         {
@@ -242,9 +364,38 @@ public final class L2WarehouseInstance extends L2FolkInstance
         {
         {
             if (Config.ALLOW_FREIGHT)
             if (Config.ALLOW_FREIGHT)
             {
             {
-                showWithdrawWindowFreight(player);
+            	if (Config.L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT)
+            	{
+            		String htmFile = "data/html/mods/WhSortedF.htm";
+            		String htmContent = HtmCache.getInstance().getHtm(htmFile);
+            		if (htmContent != null)
+            		{
+            			NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
+            			npcHtmlMessage.setHtml(htmContent);
+            			npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
+            			player.sendPacket(npcHtmlMessage);
+            		}
+            		else
+            		{
+            			_log.warning("Missing htm: " + htmFile + " !");
+            		}
+            	}
+            	else
+            		showWithdrawWindowFreight(player);
             }
             }
         }
         }
+        else if (command.startsWith("WithdrawSortedF"))
+        {
+        	if (Config.ALLOW_FREIGHT)
+        	{
+        		if (param.length > 2) 
+        			showWithdrawWindowFreight(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2]));
+        		else if (param.length > 1)
+        			showWithdrawWindowFreight(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
+        		else
+        			showWithdrawWindowFreight(player, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
+        	}
+        }
         else if (command.startsWith("DepositF"))
         else if (command.startsWith("DepositF"))
         {
         {
             if (Config.ALLOW_FREIGHT)
             if (Config.ALLOW_FREIGHT)

+ 736 - 0
L2_GameServer_T1/java/net/sf/l2j/gameserver/serverpackets/SortedWareHouseWithdrawalList.java

@@ -0,0 +1,736 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.sf.l2j.gameserver.serverpackets;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javolution.util.FastList;
+
+import net.sf.l2j.gameserver.RecipeController;
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.L2RecipeList;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.templates.L2EtcItemType;
+import net.sf.l2j.gameserver.templates.L2Item;
+import net.sf.l2j.gameserver.templates.L2WarehouseItem;
+
+/**
+ * 0x42 WarehouseWithdrawalList  dh (h dddhh dhhh d)
+ * 
+ * @version $Revision: 1.3.2.1.2.5 $ $Date: 2005/03/29 23:15:10 $
+ */
+
+public class SortedWareHouseWithdrawalList extends L2GameServerPacket
+{
+   public static final int PRIVATE = 1;
+   public static final int CLAN = 2;
+   public static final int CASTLE = 3; //not sure
+   public static final int FREIGHT = 4; //not sure
+   private static Logger _log = Logger.getLogger(SortedWareHouseWithdrawalList.class.getName());
+   private static final String _S__54_SORTEDWAREHOUSEWITHDRAWALLIST = "[S] 42 SortedWareHouseWithdrawalList";
+   private L2PcInstance _activeChar;
+   private int _playerAdena;
+   private List<L2WarehouseItem> _objects = new FastList<L2WarehouseItem>();
+   private int _whType;
+   private byte _sortorder;
+   private WarehouseListType _itemtype;
+   
+   public static enum WarehouseListType
+    {
+        WEAPON,
+        ARMOR,
+        ETCITEM,
+        MATERIAL,
+        RECIPE,
+        AMULETT,
+        SPELLBOOK,
+        SHOT,
+        SCROLL,
+        CONSUMABLE,
+        SEED,
+        POTION,
+        QUEST,
+        PET,
+        OTHER,
+        ALL
+    }
+   
+   /** sort order A..Z */
+    public static final byte A2Z = 1; 
+    /** sort order Z..A */
+    public static final byte Z2A = -1;
+    /** sort order Grade non..S */
+    public static final byte GRADE = 2;
+    /** sort order Recipe Level 1..9 */ 
+    public static final byte LEVEL = 3;
+    /** sort order type */
+    public static final byte TYPE = 4;
+    /** sort order body part (wearing) */
+    public static final byte WEAR = 5;
+    /** Maximum Items to put into list */
+    public static final int MAX_SORT_LIST_ITEMS = 300;
+    
+    private int ENDmarker = 0x00;
+
+    /**
+     * This will instantiate the Warehouselist the Player asked for
+     * @param player who calls for the itemlist
+     * @param type is the Warehouse Type
+     * @param itemtype is the Itemtype to sort for
+     * @param sortorder is the integer Sortorder like 1 for A..Z (use public constant)
+     */
+   public SortedWareHouseWithdrawalList(L2PcInstance player, int type, WarehouseListType itemtype, byte sortorder)
+   {
+        _activeChar = player;
+       _whType = type;
+        _itemtype = itemtype;
+        _sortorder = sortorder;
+
+        _playerAdena = _activeChar.getAdena();
+        if (_activeChar.getActiveWarehouse() == null)
+        {
+            // Something went wrong!
+            _log.warning("error while sending withdraw request to: " + _activeChar.getName());
+            return;
+        }
+
+        switch (_itemtype)
+        {
+            case WEAPON:
+                _objects = createWeaponList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case ARMOR:
+                _objects = createArmorList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case ETCITEM:
+                _objects = createEtcItemList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case MATERIAL:
+                _objects = createMatList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case RECIPE:
+                _objects = createRecipeList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case AMULETT:
+                _objects = createAmulettList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case SPELLBOOK:
+                _objects = createSpellbookList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case CONSUMABLE:
+                _objects = createConsumableList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case SHOT:
+                _objects = createShotList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case SCROLL:
+                _objects = createScrollList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case SEED:
+                _objects = createSeedList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case OTHER:
+                _objects = createOtherList(_activeChar.getActiveWarehouse().getItems());
+                break;
+            case ALL:
+                default:
+                    _objects = createAllList(_activeChar.getActiveWarehouse().getItems());
+                break;
+        }
+
+        try
+        {
+            switch (_sortorder)
+            {
+                case A2Z:
+                case Z2A:
+                    Collections.sort(_objects, new WarehouseItemNameComparator(_sortorder));
+                    break;
+                case GRADE:
+                    if (_itemtype == WarehouseListType.ARMOR || _itemtype == WarehouseListType.WEAPON)
+                    {
+                        Collections.sort(_objects, new WarehouseItemNameComparator(A2Z));
+                        Collections.sort(_objects, new WarehouseItemGradeComparator(A2Z));
+                    }
+                    break;
+                case LEVEL:
+                    if (_itemtype == WarehouseListType.RECIPE)
+                    {
+                        Collections.sort(_objects, new WarehouseItemNameComparator(A2Z));
+                        Collections.sort(_objects, new WarehouseItemRecipeComparator(A2Z));
+                    }
+                    break;
+                case TYPE:
+                    if (_itemtype==WarehouseListType.MATERIAL)
+                    {
+                        Collections.sort(_objects, new WarehouseItemNameComparator(A2Z));
+                        Collections.sort(_objects, new WarehouseItemTypeComparator(A2Z));
+                    }
+                    break;
+                case WEAR:
+                    if (_itemtype==WarehouseListType.ARMOR)
+                    {
+                        Collections.sort(_objects, new WarehouseItemNameComparator(A2Z));
+                        Collections.sort(_objects, new WarehouseItemBodypartComparator(A2Z));
+                    }
+                    break;
+            }
+        }
+        catch(Exception e) {}
+    }
+   
+   /**
+     * This public method return the integer of the Sortorder by its name.
+     * If you want to have another, add the Comparator and the Constant.
+     * @param order
+     * @return the integer of the sortorder or 1 as default value
+     */
+    public static byte getOrder(String order)
+    {
+        if (order == null)
+            return A2Z;
+        else if (order.startsWith("A2Z"))
+            return A2Z;
+        else if (order.startsWith("Z2A"))
+            return Z2A;
+        else if (order.startsWith("GRADE"))
+            return GRADE;
+        else if (order.startsWith("TYPE"))
+            return TYPE;
+        else if (order.startsWith("WEAR"))
+            return WEAR;
+        else
+        {
+            try
+            {
+                return Byte.parseByte(order);
+            }
+            catch (NumberFormatException ex) {return A2Z;}
+        }
+    }
+
+    /**
+     * This is the common Comparator to sort the items by Name
+     */
+    private static class WarehouseItemNameComparator implements Comparator<L2WarehouseItem>
+    {
+        private byte order = 0;
+        
+        protected WarehouseItemNameComparator(byte sortOrder)
+        {
+            order = sortOrder;
+        }
+        
+        public int compare(L2WarehouseItem o1, L2WarehouseItem o2)
+        {
+            if (o1.getType2() == L2Item.TYPE2_MONEY && o2.getType2() != L2Item.TYPE2_MONEY)
+                return (order == A2Z ? Z2A : A2Z);
+            if (o2.getType2() == L2Item.TYPE2_MONEY && o1.getType2() != L2Item.TYPE2_MONEY)
+                return (order == A2Z ? A2Z : Z2A);
+            String s1 = o1.getItemName();
+            String s2 = o2.getItemName();
+            return (order == A2Z ? s1.compareTo(s2) : s2.compareTo(s1));
+        }
+    }
+
+    /**
+     * This Comparator is used to sort by Recipe Level
+     */
+    private static class WarehouseItemRecipeComparator implements Comparator<L2WarehouseItem>
+    {
+        private int order = 0;
+
+        private RecipeController rc = null;
+
+        protected WarehouseItemRecipeComparator(int sortOrder)
+        {
+            order = sortOrder;
+            rc = RecipeController.getInstance();
+        }
+
+        public int compare(L2WarehouseItem o1, L2WarehouseItem o2)
+        {
+            if (o1.getType2() == L2Item.TYPE2_MONEY && o2.getType2() != L2Item.TYPE2_MONEY)
+                return (order == A2Z ? Z2A : A2Z);
+            if (o2.getType2() == L2Item.TYPE2_MONEY && o1.getType2() != L2Item.TYPE2_MONEY)
+                return (order == A2Z ? A2Z : Z2A);
+            if ((o1.isEtcItem() && o1.getItemType() == L2EtcItemType.RECEIPE) && (o2.isEtcItem() && o2.getItemType() == L2EtcItemType.RECEIPE))
+            {
+                try
+                {
+                    L2RecipeList rp1 = rc.getRecipeByItemId(o1.getItemId());
+                    L2RecipeList rp2 = rc.getRecipeByItemId(o2.getItemId());
+
+                    if (rp1 == null) return (order == A2Z ? A2Z : Z2A);
+                    if (rp2 == null) return (order == A2Z ? Z2A : A2Z);
+
+                    Integer i1 = rp1.getLevel();
+                    Integer i2 = rp2.getLevel();
+
+                    return (order == A2Z ? i1.compareTo(i2) : i2.compareTo(i1));
+                }
+                catch(Exception e) {return 0;}
+            }
+            else
+            {
+                String s1 = o1.getItemName();
+                String s2 = o2.getItemName();
+                return (order == A2Z ? s1.compareTo(s2) : s2.compareTo(s1));
+            }
+        }
+    }
+
+    /**
+     * This Comparator is used to sort the Items by BodyPart
+     */
+    private static class WarehouseItemBodypartComparator implements Comparator<L2WarehouseItem>
+    {
+        private byte order = 0;
+
+        protected WarehouseItemBodypartComparator(byte sortOrder)
+        {
+            order = sortOrder;
+        }
+
+        public int compare(L2WarehouseItem o1, L2WarehouseItem o2)
+        {
+            if (o1.getType2() == L2Item.TYPE2_MONEY && o2.getType2() != L2Item.TYPE2_MONEY)
+                return (order==A2Z ? Z2A : A2Z);
+            if (o2.getType2() == L2Item.TYPE2_MONEY && o1.getType2() != L2Item.TYPE2_MONEY)
+                return (order==A2Z ? A2Z : Z2A);
+            Integer i1 = o1.getBodyPart();
+            Integer i2 = o2.getBodyPart();
+            return (order == A2Z ? i1.compareTo(i2) : i2.compareTo(i1));
+        }
+    }
+
+    /**
+     * This Comparator is used to sort by the Item Grade (e.g. Non..S-Grade)
+     */
+    private static class WarehouseItemGradeComparator implements Comparator<L2WarehouseItem>
+    {
+        byte order = 0;
+
+        protected WarehouseItemGradeComparator(byte sortOrder)
+        {
+            order = sortOrder;
+        }
+
+        public int compare(L2WarehouseItem o1, L2WarehouseItem o2)
+        {
+            if (o1.getType2() == L2Item.TYPE2_MONEY && o2.getType2() != L2Item.TYPE2_MONEY)
+                return (order == A2Z ? Z2A : A2Z);
+            if (o2.getType2() == L2Item.TYPE2_MONEY && o1.getType2() != L2Item.TYPE2_MONEY)
+                return (order ==A2Z ? A2Z : Z2A);
+            Integer i1 = o1.getItemGrade();
+            Integer i2 = o2.getItemGrade();
+            return (order == A2Z ? i1.compareTo(i2) : i2.compareTo(i1));
+        }
+    }
+
+    /**
+     * This Comparator will sort by Item Type. Unfortunatly this will only have a
+     * good result if the Database Table for the ETCITEM.TYPE column is fixed!
+     */
+    private static class WarehouseItemTypeComparator implements Comparator<L2WarehouseItem>
+    {
+        byte order = 0;
+
+        protected WarehouseItemTypeComparator(byte sortOrder)
+        {
+            order = sortOrder;
+        }
+
+        public int compare(L2WarehouseItem o1, L2WarehouseItem o2)
+        {
+            if (o1.getType2() == L2Item.TYPE2_MONEY && o2.getType2() != L2Item.TYPE2_MONEY)
+                return (order == A2Z ? Z2A : A2Z);
+            if (o2.getType2() == L2Item.TYPE2_MONEY && o1.getType2() != L2Item.TYPE2_MONEY)
+                return (order== A2Z ? A2Z : Z2A);
+            try
+            {
+                Integer i1 = o1.getItem().getMaterialType();
+                Integer i2 = o2.getItem().getMaterialType();
+                return (order==A2Z ? i1.compareTo(i2) : i2.compareTo(i1));
+            }
+            catch(Exception e) {return 0;}
+        }
+    }
+
+    // ========================================================================
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Weapon</li>
+     * <li>Arrow</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createWeaponList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isWeapon() || item.getItem().getType2() == L2Item.TYPE2_WEAPON || (item.isEtcItem() && item.getItemType() == L2EtcItemType.ARROW) || item.getItem().getType2() == L2Item.TYPE2_MONEY )
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Armor</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createArmorList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isArmor() || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Everything which is no Weapon/Armor</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createEtcItemList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isEtcItem() || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Materials</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createMatList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if(item.isEtcItem() && item.getEtcItem().getItemType() == L2EtcItemType.MATERIAL || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Recipes</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createRecipeList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isEtcItem() && item.getEtcItem().getItemType() == L2EtcItemType.RECEIPE || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Amulett</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createAmulettList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isEtcItem() && (item.getEtcItem().getItemType() == L2EtcItemType.SPELLBOOK && item.getItemName().toUpperCase().startsWith("AMULET")) || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Spellbook & Dwarven Drafts</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createSpellbookList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isEtcItem() && (item.getEtcItem().getItemType() == L2EtcItemType.SPELLBOOK && !item.getItemName().toUpperCase().startsWith("AMULET")) || item.getItem().getType2() == L2Item.TYPE2_MONEY )
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Consumables (Potions, Shots, ...)</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createConsumableList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isEtcItem() && (item.getEtcItem().getItemType() == L2EtcItemType.SCROLL || item.getEtcItem().getItemType() == L2EtcItemType.SHOT) || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Shots</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createShotList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isEtcItem() && item.getEtcItem().getItemType()==L2EtcItemType.SHOT || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Scrolls/Potions</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createScrollList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isEtcItem() && item.getEtcItem().getItemType() == L2EtcItemType.SCROLL || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Seeds</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createSeedList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (item.isEtcItem() && item.getEtcItem().getItemType() == L2EtcItemType.SEED || item.getItem().getType2() == L2Item.TYPE2_MONEY)
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>Everything which is no Weapon/Armor, Material, Recipe, Spellbook, Scroll or Shot</li>
+     * <li>Money</li>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createOtherList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if( item.isEtcItem() && 
+                ( item.getEtcItem().getItemType() != L2EtcItemType.MATERIAL &&
+                  item.getEtcItem().getItemType() != L2EtcItemType.RECEIPE && 
+                  item.getEtcItem().getItemType() != L2EtcItemType.SPELLBOOK && 
+                  item.getEtcItem().getItemType() != L2EtcItemType.SCROLL && 
+                  item.getEtcItem().getItemType() != L2EtcItemType.SHOT
+                ) || item.getItem().getType2() == L2Item.TYPE2_MONEY )
+            {
+                if (_list.size() < MAX_SORT_LIST_ITEMS)
+                    _list.add(new L2WarehouseItem(item));
+                else
+                    continue;
+            }
+        }
+        return _list;
+    }
+
+    /**
+     * This method is used to limit the given Warehouse List to:
+     * <li>no limit</li>
+     * This may sound strange but we return the given Array as a List<L2WarehouseItem>
+     * @param _items complete Warehouse List
+     * @return limited Item List
+     */
+    private List<L2WarehouseItem> createAllList(L2ItemInstance[] _items)
+    {
+        List<L2WarehouseItem> _list = new FastList<L2WarehouseItem>();
+        for (L2ItemInstance item : _items)
+        {
+            if (_list.size() < MAX_SORT_LIST_ITEMS)
+                _list.add(new L2WarehouseItem(item));
+            else
+                continue;
+        }
+        return _list;
+    }
+
+   @Override
+   protected final void writeImpl()
+   {
+       writeC(0x42);
+       /* 0x01-Private Warehouse  
+       * 0x02-Clan Warehouse  
+       * 0x03-Castle Warehouse  
+       * 0x04-Warehouse */  
+       writeH(_whType);
+       writeD(_playerAdena);
+       writeH(_objects.size());
+
+       for (L2WarehouseItem item : _objects)
+       {
+           writeH(item.getItem().getType1()); // item type1 //unconfirmed, works
+           writeD(item.getObjectId());
+           writeD(item.getItemId()); //unconfirmed, works
+           writeD(item.getCount()); //unconfirmed, works
+           writeH(item.getItem().getType2());  // item type2 //unconfirmed, works
+           writeH(item.getCustomType1());  // ?
+           writeD(item.getItem().getBodyPart());   // ?
+           writeH(item.getEnchantLevel()); // enchant level -confirmed
+           writeH(item.getCustomType2());  // ?
+           writeH(ENDmarker);  // ?
+           writeD(item.getObjectId()); // item id - confimed       
+           if (item.isAugmented())
+           {
+               writeD(0x0000FFFF&item.getAugmentationId());
+               writeD(item.getAugmentationId()>>16);
+           }
+           else writeQ(0x00);
+           writeD(item.getMana());
+
+           writeD(item.getAttackAttrElement()); //element type 
+           writeD(item.getAttackAttrElementVal()); //element val 
+           writeD(item.getDefAttrFire()); //fire element
+           writeD(item.getDefAttrWater()); //water element
+           writeD(item.getDefAttrWind()); //wind element
+           writeD(item.getDefAttrEarth()); //earth element
+           writeD(item.getDefAttrHoly()); //holy element
+           writeD(item.getDefAttrUnholy()); //unholy element
+       }
+   }
+
+   /* (non-Javadoc)
+    * @see net.sf.l2j.gameserver.serverpackets.ServerBasePacket#getType()
+    */
+   @Override
+   public String getType()
+   {
+       return _S__54_SORTEDWAREHOUSEWITHDRAWALLIST;
+   }
+}

+ 289 - 0
L2_GameServer_T1/java/net/sf/l2j/gameserver/templates/L2WarehouseItem.java

@@ -0,0 +1,289 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.sf.l2j.gameserver.templates;
+
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+
+/**
+ * This class contains L2ItemInstance<BR>
+ * Use to sort L2ItemInstance of :
+ * <LI>L2Armor</LI>
+ * <LI>L2EtcItem</LI>
+ * <LI>L2Weapon</LI> 
+ * @version $Revision: 1.7.2.2.2.5 $ $Date: 2005/04/06 18:25:18 $
+ */
+public class L2WarehouseItem
+{
+    private L2Item _item;
+    private int _object;
+    private int _count;
+    private int _owner;
+    private int _enchant;
+    private int _grade;
+    private boolean _isAugmented;
+    private int _augmentationId;
+    private int _customType1;
+    private int _customType2;
+    private int _mana;
+    private int _attackAttrElement;
+    private int _attackAttrElementVal;
+    private int _defAttrFire;
+    private int _defAttrWater;
+    private int _defAttrWind;
+    private int _defAttrEarth;
+    private int _defAttrHoly;
+    private int _defAttrUnholy;
+
+    public L2WarehouseItem(L2ItemInstance item)
+    {
+        _item = item.getItem();
+        _object = item.getObjectId();
+        _count = item.getCount();
+        _owner = item.getOwnerId();
+        _enchant = item.getEnchantLevel();
+        _customType1 = item.getCustomType1();
+        _customType2 = item.getCustomType2();
+        _grade = item.getItem().getItemGrade();
+        if (item.isAugmented())
+        {
+            _isAugmented = true;
+            _augmentationId = item.getAugmentation().getAugmentationId();
+        }
+        else
+            _isAugmented = false;
+        _mana = item.getMana();
+        _attackAttrElement = item.getAttackAttrElement();
+        _attackAttrElementVal = item.getAttackAttrElementVal();
+        _defAttrFire = item.getDefAttrFire();
+        _defAttrWater = item.getDefAttrWater();
+        _defAttrWind = item.getDefAttrWind();
+        _defAttrEarth = item.getDefAttrEarth();
+        _defAttrHoly = item.getDefAttrHoly();
+        _defAttrUnholy = item.getDefAttrUnholy();
+    }
+
+    /**
+    * Returns the item.
+    * @return L2Item
+    */
+   public L2Item getItem()
+   {
+       return _item;
+   }
+
+   /**
+    * Returns the unique objectId
+    * @return int
+    */
+   public final int getObjectId()
+   {
+       return _object;
+   }
+
+    /**
+     * Returns the owner
+     * @return int
+     */
+    public final int getOwnerId()
+    {
+        return _owner;
+    }
+
+    /**
+     * Returns the count
+     * @return int
+     */
+    public final int getCount()
+    {
+        return _count;
+    }
+
+    /**
+     * Returns the first type
+     * @return int
+     */
+    public final int getType1()
+    {
+        return _item.getType1();
+    }
+
+    /**
+     * Returns the second type
+     * @return int
+     */
+    public final int getType2()
+    {
+        return _item.getType2();
+    }
+
+    /**
+     * Returns the second type
+     * @return int
+     */
+    public final Enum<?> getItemType()
+    {
+        return _item.getItemType();
+    }
+
+    /**
+     * Returns the ItemId
+     * @return int
+     */
+    public final int getItemId()
+    {
+        return _item.getItemId();
+    }
+
+    /**
+     * Returns the part of body used with this item
+     * @return int
+     */
+    public final int getBodyPart()
+    {
+        return _item.getBodyPart();
+    }
+
+    /**
+     * Returns the enchant level
+     * @return int
+     */
+    public final int getEnchantLevel()
+    {
+        return _enchant;
+    }
+
+    /**
+     * Returns the item grade
+     * @return int
+     */
+    public final int getItemGrade()
+    {
+        return _grade;
+    }
+
+    /**
+     * Returns true if it is a weapon
+     * @return boolean
+     */
+    public final boolean isWeapon()
+    {
+        return (_item instanceof L2Weapon);
+    }
+
+    /**
+     * Returns true if it is an armor
+     * @return boolean
+     */
+    public final boolean isArmor()
+    {
+        return (_item instanceof L2Armor);
+    }
+
+    /**
+     * Returns true if it is an EtcItem
+     * @return boolean
+     */
+    public final boolean isEtcItem()
+    {
+        return (_item instanceof L2EtcItem);
+    }
+
+    /**
+     * Returns the name of the item
+     * @return String
+     */
+    public String getItemName()
+    {
+        return _item.getName();
+    }
+
+    public boolean isAugmented()
+    {
+        return _isAugmented;
+    }
+
+    public int getAugmentationId()
+    {
+        return _augmentationId;
+    }
+
+    /**
+     * Returns the name of the item
+     * @return String
+     * @deprecated beware to use getItemName() instead because getName() is final in L2Object and could not be overriden! Allover L2Object.getName() may return null!
+     */
+    public String getName()
+    {
+        return _item.getName();
+    }
+
+    public final int getCustomType1()
+    {
+        return _customType1;
+    }
+    public final int getCustomType2()
+    {
+        return _customType2;
+    }
+    public final int getMana()
+    {
+        return _mana;
+    }
+    public final int getAttackAttrElement()
+    {
+        return _attackAttrElement;
+    }
+    public final int getAttackAttrElementVal()
+    {
+        return _attackAttrElementVal;
+    }
+    public final int getDefAttrFire()
+    {
+        return _defAttrFire;
+    }
+    public final int getDefAttrWater()
+    {
+        return _defAttrWater;
+    }
+    public final int getDefAttrWind()
+    {
+        return _defAttrWind;
+    }
+    public final int getDefAttrEarth()
+    {
+        return _defAttrEarth;
+    }
+    public final int getDefAttrHoly()
+    {
+        return _defAttrHoly;
+    }
+    public final int getDefAttrUnholy()
+    {
+        return _defAttrUnholy;
+    }
+
+    /**
+     * Returns the name of the item
+     * @return String
+     */
+   public String toString()
+   {
+       return _item.toString();
+   }
+}