Przeglądaj źródła

BETA: Cleanup.
* Removed WayPointNode class.
* Removed multiple duplicates of !ItemHolder class.
* Removed unused related properties.

Suggested by: UnAfraid

Zoey76 12 lat temu
rodzic
commit
a436b78856

+ 0 - 4
L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -967,10 +967,6 @@ public final class Config
 	public static String GAME_SERVER_LOGIN_HOST;
 	public static List<String> GAME_SERVER_SUBNETS;
 	public static List<String> GAME_SERVER_HOSTS;
-	public static int NEW_NODE_ID;
-	public static int SELECTED_NODE_ID;
-	public static int LINKED_NODE_ID;
-	public static String NEW_NODE_TYPE;
 	public static String SERVER_VERSION;
 	public static String SERVER_BUILD_DATE;
 	public static String DATAPACK_VERSION;

+ 17 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/ItemHolder.java

@@ -21,11 +21,20 @@ package com.l2jserver.gameserver.model.holders;
 public final class ItemHolder
 {
 	private final int _id;
+	private final int _objectId;
 	private final long _count;
 	
 	public ItemHolder(int id, long count)
 	{
 		_id = id;
+		_objectId = -1;
+		_count = count;
+	}
+	
+	public ItemHolder(int id, int objectId, long count)
+	{
+		_id = id;
+		_objectId = objectId;
 		_count = count;
 	}
 	
@@ -37,6 +46,14 @@ public final class ItemHolder
 		return _id;
 	}
 	
+	/**
+	 * @return the object Id
+	 */
+	public int getObjectId()
+	{
+		return _objectId;
+	}
+	
 	/**
 	 * @return the item count.
 	 */

+ 98 - 61
L2J_Server_BETA/java/com/l2jserver/gameserver/model/itemcontainer/ItemContainer.java

@@ -59,8 +59,7 @@ public abstract class ItemContainer
 	}
 	
 	/**
-	 * Returns the ownerID of the inventory
-	 * @return int
+	 * @return int the owner object Id
 	 */
 	public int getOwnerId()
 	{
@@ -68,8 +67,7 @@ public abstract class ItemContainer
 	}
 	
 	/**
-	 * Returns the quantity of items in the inventory
-	 * @return int
+	 * @return the quantity of items in the inventory
 	 */
 	public int getSize()
 	{
@@ -77,8 +75,7 @@ public abstract class ItemContainer
 	}
 	
 	/**
-	 * Returns the list of items in inventory
-	 * @return L2ItemInstance : items in inventory
+	 * @return the items in inventory
 	 */
 	public L2ItemInstance[] getItems()
 	{
@@ -86,79 +83,76 @@ public abstract class ItemContainer
 	}
 	
 	/**
-	 * Returns the item from inventory by using its <B>itemId</B><BR><BR>
-	 *
-	 * @param itemId : int designating the ID of the item
-	 * @return L2ItemInstance designating the item or null if not found in inventory
+	 * @param itemId the item Id
+	 * @return the item from inventory by itemId
 	 */
 	public L2ItemInstance getItemByItemId(int itemId)
 	{
 		for (L2ItemInstance item : _items)
-			if (item != null && item.getItemId() == itemId)
+		{
+			if ((item != null) && (item.getItemId() == itemId))
+			{
 				return item;
-		
+			}
+		}
 		return null;
 	}
 	
 	/**
-	 * Returns the item's list from inventory by using its <B>itemId</B><BR><BR>
-	 * 
-	 * @param itemId : int designating the ID of the item
-	 * @return List<L2ItemInstance> designating the items list (empty list if not found)
+	 * @param itemId the item Id
+	 * @return the items list from inventory by using its itemId
 	 */
 	public List<L2ItemInstance> getItemsByItemId(int itemId)
 	{
 		List<L2ItemInstance> returnList = new FastList<>();
 		for (L2ItemInstance item : _items)
 		{
-			if (item != null && item.getItemId() == itemId)
+			if ((item != null) && (item.getItemId() == itemId))
 			{
 				returnList.add(item);
 			}
 		}
-		
 		return returnList;
 	}
 	
 	/**
-	 * Returns the item from inventory by using its <B>itemId</B><BR><BR>
-	 *
-	 * @param itemId : int designating the ID of the item
-	 * @param itemToIgnore : used during a loop, to avoid returning the same item
-	 * @return L2ItemInstance designating the item or null if not found in inventory
+	 * @param itemId the item Id
+	 * @param itemToIgnore used during the loop, to avoid returning the same item
+	 * @return the item from inventory by itemId
 	 */
 	public L2ItemInstance getItemByItemId(int itemId, L2ItemInstance itemToIgnore)
 	{
 		for (L2ItemInstance item : _items)
-			if (item != null && item.getItemId() == itemId && !item.equals(itemToIgnore))
+		{
+			if ((item != null) && (item.getItemId() == itemId) && !item.equals(itemToIgnore))
+			{
 				return item;
-		
+			}
+		}
 		return null;
 	}
 	
 	/**
-	 * Returns item from inventory by using its <B>objectId</B>
-	 * @param objectId : int designating the ID of the object
-	 * @return L2ItemInstance designating the item or null if not found in inventory
+	 * @param objectId the item object Id
+	 * @return item from inventory by objectId
 	 */
 	public L2ItemInstance getItemByObjectId(int objectId)
 	{
 		for (L2ItemInstance item : _items)
 		{
-			if (item == null)
-				continue;
-			
-			if (item.getObjectId() == objectId)
+			if ((item != null) && item.getObjectId() == objectId)
+			{
 				return item;
+			}
 		}
 		return null;
 	}
 	
 	/**
-	 * @param itemId 
-	 * @param enchantLevel 
-	 * @return 
-	 * @see  com.l2jserver.gameserver.model.itemcontainer.ItemContainer#getInventoryItemCount(int, int, boolean)
+	 * Gets the inventory item count by item Id and enchant level including equipped items.
+	 * @param itemId the item Id
+	 * @param enchantLevel the item enchant level, use -1 to match any enchant level
+	 * @return the inventory item count
 	 */
 	public long getInventoryItemCount(int itemId, int enchantLevel)
 	{
@@ -166,24 +160,39 @@ public abstract class ItemContainer
 	}
 	
 	/**
-	 * Gets count of item in the inventory
-	 * @param itemId : Item to look for
-	 * @param enchantLevel : enchant level to match on, or -1 for ANY enchant level
-	 * @param includeEquipped : include equipped items
-	 * @return int corresponding to the number of items matching the above conditions.
+	 * Gets the inventory item count by item Id and enchant level, may include equipped items.
+	 * @param itemId the item Id
+	 * @param enchantLevel the item enchant level, use -1 to match any enchant level
+	 * @param includeEquipped if {@code true} includes equipped items in the result
+	 * @return the inventory item count
 	 */
 	public long getInventoryItemCount(int itemId, int enchantLevel, boolean includeEquipped)
 	{
 		long count = 0;
 		
 		for (L2ItemInstance item : _items)
-			if (item.getItemId() == itemId && ((item.getEnchantLevel() == enchantLevel) || (enchantLevel < 0)) && (includeEquipped || !item.isEquipped()))
-				//if (item.isAvailable((L2PcInstance)getOwner(), true) || item.getItem().getType2() == 3)//available or quest item
+		{
+			if ((item.getItemId() == itemId) && ((item.getEnchantLevel() == enchantLevel) || (enchantLevel < 0)) && (includeEquipped || !item.isEquipped()))
+			{
 				if (item.isStackable())
+				{
+					// FIXME: Zoey76: if there are more than one stacks of the same item Id
+					// it will return the count of the last one, if is not possible to
+					// have more than one stacks of the same item Id,
+					// it will continue iterating over all items
+					// possible fixes:
+					// count += item.getCount();
+					// or
+					// count = item.getCount();
+					// break;
 					count = item.getCount();
+				}
 				else
+				{
 					count++;
-		
+				}
+			}
+		}
 		return count;
 	}
 	
@@ -200,7 +209,7 @@ public abstract class ItemContainer
 		L2ItemInstance olditem = getItemByItemId(item.getItemId());
 		
 		// If stackable item is found in inventory just add to current quantity
-		if (olditem != null && olditem.isStackable())
+		if ((olditem != null) && olditem.isStackable())
 		{
 			long count = item.getCount();
 			olditem.changeCount(process, count, actor, reference);
@@ -212,14 +221,18 @@ public abstract class ItemContainer
 			item = olditem;
 			
 			// Updates database
-			if (item.getItemId() == PcInventory.ADENA_ID && count < 10000 * Config.RATE_DROP_ITEMS_ID.get(PcInventory.ADENA_ID))
+			if ((item.getItemId() == PcInventory.ADENA_ID) && (count < (10000 * Config.RATE_DROP_ITEMS_ID.get(PcInventory.ADENA_ID))))
 			{
 				// Small adena changes won't be saved to database all the time
-				if (GameTimeController.getGameTicks() % 5 == 0)
+				if ((GameTimeController.getGameTicks() % 5) == 0)
+				{
 					item.updateDatabase();
+				}
 			}
 			else
+			{
 				item.updateDatabase();
+			}
 		}
 		// If item hasn't be found in inventory, create new one
 		else
@@ -253,21 +266,25 @@ public abstract class ItemContainer
 		L2ItemInstance item = getItemByItemId(itemId);
 		
 		// If stackable item is found in inventory just add to current quantity
-		if (item != null && item.isStackable())
+		if ((item != null) && item.isStackable())
 		{
 			item.changeCount(process, count, actor, reference);
 			item.setLastChange(L2ItemInstance.MODIFIED);
 			// Updates database
-			// If Adena drop rate is nor present it will be x1.
+			// If Adena drop rate is not present it will be x1.
 			float adenaRate = Config.RATE_DROP_ITEMS_ID.containsKey(PcInventory.ADENA_ID) ? Config.RATE_DROP_ITEMS_ID.get(PcInventory.ADENA_ID) : 1;
-			if (itemId == PcInventory.ADENA_ID && count < 10000 * adenaRate)
+			if ((itemId == PcInventory.ADENA_ID) && (count < (10000 * adenaRate)))
 			{
 				// Small adena changes won't be saved to database all the time
-				if (GameTimeController.getGameTicks() % 5 == 0)
+				if ((GameTimeController.getGameTicks() % 5) == 0)
+				{
 					item.updateDatabase();
+				}
 			}
 			else
+			{
 				item.updateDatabase();
+			}
 		}
 		// If item hasn't be found in inventory, create new one
 		else
@@ -293,7 +310,9 @@ public abstract class ItemContainer
 				
 				// If stackable, end loop as entire count is included in 1 instance of item
 				if (template.isStackable() || !Config.MULTIPLE_ITEM_DROP)
+				{
 					break;
+				}
 			}
 		}
 		
@@ -335,10 +354,12 @@ public abstract class ItemContainer
 			
 			// Check if requested quantity is available
 			if (count > sourceitem.getCount())
+			{
 				count = sourceitem.getCount();
+			}
 			
 			// If possible, move entire item object
-			if (sourceitem.getCount() == count && targetitem == null)
+			if ((sourceitem.getCount() == count) && (targetitem == null))
 			{
 				removeItem(sourceitem);
 				target.addItem(process, sourceitem, actor, reference);
@@ -351,7 +372,7 @@ public abstract class ItemContainer
 					sourceitem.changeCount(process, -count, actor, reference);
 				}
 				else
-					// Otherwise destroy old item
+				// Otherwise destroy old item
 				{
 					removeItem(sourceitem);
 					ItemTable.getInstance().destroyItem(process, sourceitem, actor, reference);
@@ -362,7 +383,7 @@ public abstract class ItemContainer
 					targetitem.changeCount(process, count, actor, reference);
 				}
 				else
-					// Otherwise add new item
+				// Otherwise add new item
 				{
 					targetitem = target.addItem(process, sourceitem.getItemId(), count, actor, reference);
 				}
@@ -370,10 +391,14 @@ public abstract class ItemContainer
 			
 			// Updates database
 			sourceitem.updateDatabase(true);
-			if (targetitem != sourceitem && targetitem != null)
+			if ((targetitem != sourceitem) && (targetitem != null))
+			{
 				targetitem.updateDatabase();
+			}
 			if (sourceitem.isAugmented())
+			{
 				sourceitem.getAugmentation().removeBonus(actor);
+			}
 			refreshWeight();
 			target.refreshWeight();
 		}
@@ -397,7 +422,7 @@ public abstract class ItemContainer
 	 * Destroy item from inventory and updates database
 	 * @param process : String Identifier of process triggering this action
 	 * @param item : L2ItemInstance to be destroyed
-	 * @param count 
+	 * @param count
 	 * @param actor : L2PcInstance Player requesting the item destroy
 	 * @param reference : Object Object referencing current action like NPC selling item or previous item in transformation
 	 * @return L2ItemInstance corresponding to the destroyed item or the updated item in inventory
@@ -413,7 +438,7 @@ public abstract class ItemContainer
 				item.setLastChange(L2ItemInstance.MODIFIED);
 				
 				// don't update often for untraced items
-				if (process != null || GameTimeController.getGameTicks() % 10 == 0)
+				if ((process != null) || ((GameTimeController.getGameTicks() % 10) == 0))
 				{
 					item.updateDatabase();
 				}
@@ -423,11 +448,15 @@ public abstract class ItemContainer
 			else
 			{
 				if (item.getCount() < count)
+				{
 					return null;
+				}
 				
-				boolean removed = this.removeItem(item);
+				boolean removed = removeItem(item);
 				if (!removed)
+				{
 					return null;
+				}
 				
 				ItemTable.getInstance().destroyItem(process, item, actor, reference);
 				
@@ -487,7 +516,9 @@ public abstract class ItemContainer
 		for (L2ItemInstance item : _items)
 		{
 			if (item != null)
+			{
 				destroyItem(process, item, actor, reference);
+			}
 		}
 	}
 	
@@ -499,7 +530,7 @@ public abstract class ItemContainer
 		long count = 0;
 		for (L2ItemInstance item : _items)
 		{
-			if (item != null && item.getItemId() == PcInventory.ADENA_ID)
+			if ((item != null) && (item.getItemId() == PcInventory.ADENA_ID))
 			{
 				count = item.getCount();
 				return count;
@@ -520,7 +551,7 @@ public abstract class ItemContainer
 	/**
 	 * Removes item from inventory for further adjustments.
 	 * @param item : L2ItemInstance to be removed from inventory
-	 * @return 
+	 * @return
 	 */
 	protected boolean removeItem(L2ItemInstance item)
 	{
@@ -587,17 +618,23 @@ public abstract class ItemContainer
 				{
 					item = L2ItemInstance.restoreFromDb(getOwnerId(), inv);
 					if (item == null)
+					{
 						continue;
+					}
 					
 					L2World.getInstance().storeObject(item);
 					
 					L2PcInstance owner = getOwner() == null ? null : getOwner().getActingPlayer();
 					
 					// If stackable item is found in inventory just add to current quantity
-					if (item.isStackable() && getItemByItemId(item.getItemId()) != null)
+					if (item.isStackable() && (getItemByItemId(item.getItemId()) != null))
+					{
 						addItem("Restore", item, owner, null);
+					}
 					else
+					{
 						addItem(item);
+					}
 				}
 			}
 			refreshWeight();

+ 0 - 263
L2J_Server_BETA/java/com/l2jserver/gameserver/model/waypoint/WayPointNode.java

@@ -1,263 +0,0 @@
-/*
- * 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.waypoint;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import javolution.util.FastList;
-
-import com.l2jserver.Config;
-import com.l2jserver.gameserver.idfactory.IdFactory;
-import com.l2jserver.gameserver.model.L2Object;
-import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.network.serverpackets.MyTargetSelected;
-import com.l2jserver.gameserver.util.Point3D;
-
-/**
- * This class ...
- *
- * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
- */
-public class WayPointNode extends L2Object
-{
-	private int _id;
-	private String _title, _type;
-	private static final String NORMAL = "Node", SELECTED = "Selected", LINKED = "Linked";
-	private static int _lineId = 5560;
-	private static final String LINE_TYPE = "item";
-	private Map<WayPointNode, List<WayPointNode>> _linkLists;
-	
-	/**
-	 * @param objectId
-	 */
-	public WayPointNode(int objectId)
-	{
-		super(objectId);
-		_linkLists = Collections.synchronizedMap(new WeakHashMap<WayPointNode, List<WayPointNode>>());
-	}
-	
-	@Override
-	public boolean isAutoAttackable(L2Character attacker)
-	{
-		return false;
-	}
-	
-	public static WayPointNode spawn(String type, int id, int x, int y, int z)
-	{
-		WayPointNode newNode = new WayPointNode(IdFactory.getInstance().getNextId());
-		newNode.getPoly().setPolyInfo(type, id + "");
-		newNode.spawnMe(x, y, z);
-		return newNode;
-	}
-	
-	public static WayPointNode spawn(boolean isItemId, int id, L2PcInstance player)
-	{
-		return spawn(isItemId ? "item" : "npc", id, player.getX(), player.getY(), player.getZ());
-	}
-	
-	public static WayPointNode spawn(boolean isItemId, int id, Point3D point)
-	{
-		return spawn(isItemId ? "item" : "npc", id, point.getX(), point.getY(), point.getZ());
-	}
-	
-	public static WayPointNode spawn(Point3D point)
-	{
-		return spawn(Config.NEW_NODE_TYPE, Config.NEW_NODE_ID, point.getX(), point.getY(), point.getZ());
-	}
-	
-	public static WayPointNode spawn(L2PcInstance player)
-	{
-		return spawn(Config.NEW_NODE_TYPE, Config.NEW_NODE_ID, player.getX(), player.getY(), player.getZ());
-	}
-	
-	@Override
-	public void onAction(L2PcInstance player, boolean interact)
-	{
-		if (player.getTarget() != this)
-		{
-			player.setTarget(this);
-			MyTargetSelected my = new MyTargetSelected(getObjectId(), 0);
-			player.sendPacket(my);
-		}
-	}
-	
-	public void setNormalInfo(String type, int id, String title)
-	{
-		_type = type;
-		changeID(id, title);
-	}
-	
-	public void setNormalInfo(String type, int id)
-	{
-		_type = type;
-		changeID(id);
-	}
-	
-	private void changeID(int id)
-	{
-		_id = id;
-		toggleVisible();
-		toggleVisible();
-	}
-	
-	private void changeID(int id, String title)
-	{
-		setName(title);
-		setTitle(title);
-		changeID(id);
-	}
-	
-	public void setLinked()
-	{
-		changeID(Config.LINKED_NODE_ID, LINKED);
-	}
-	
-	public void setNormal()
-	{
-		changeID(Config.NEW_NODE_ID, NORMAL);
-	}
-	
-	public void setSelected()
-	{
-		changeID(Config.SELECTED_NODE_ID, SELECTED);
-	}
-	
-	@Override
-	public boolean isMarker()
-	{
-		return true;
-	}
-	
-	public final String getTitle()
-	{
-		return _title;
-	}
-	
-	public final void setTitle(String title)
-	{
-		_title = title;
-	}
-	
-	public int getId()
-	{
-		return _id;
-	}
-	
-	public String getType()
-	{
-		return _type;
-	}
-	
-	public void setType(String type)
-	{
-		_type = type;
-	}
-	
-	/**
-	 * @param nodeA
-	 * @param nodeB
-	 */
-	public static void drawLine(WayPointNode nodeA, WayPointNode nodeB)
-	{
-		int x1 = nodeA.getX(), y1 = nodeA.getY(), z1 = nodeA.getZ();
-		int x2 = nodeB.getX(), y2 = nodeB.getY(), z2 = nodeB.getZ();
-		int modX = x1 - x2 > 0 ? -1 : 1;
-		int modY = y1 - y2 > 0 ? -1 : 1;
-		int modZ = z1 - z2 > 0 ? -1 : 1;
-		
-		int diffX = Math.abs(x1 - x2);
-		int diffY = Math.abs(y1 - y2);
-		int diffZ = Math.abs(z1 - z2);
-		
-		int distance = (int) Math.sqrt(diffX * diffX + diffY * diffY + diffZ * diffZ);
-		
-		int steps = distance / 40;
-		
-		List<WayPointNode> lineNodes = new FastList<>();
-		
-		for (int i = 0; i < steps; i++)
-		{
-			x1 = x1 + (modX * diffX / steps);
-			y1 = y1 + (modY * diffY / steps);
-			z1 = z1 + (modZ * diffZ / steps);
-			
-			lineNodes.add(WayPointNode.spawn(LINE_TYPE, _lineId, x1, y1, z1));
-		}
-		
-		nodeA.addLineInfo(nodeB, lineNodes);
-		nodeB.addLineInfo(nodeA, lineNodes);
-	}
-	
-	public void addLineInfo(WayPointNode node, List<WayPointNode> line)
-	{
-		_linkLists.put(node, line);
-	}
-	
-	/**
-	 * @param target
-	 * @param selectedNode
-	 */
-	public static void eraseLine(WayPointNode target, WayPointNode selectedNode)
-	{
-		List<WayPointNode> lineNodes = target.getLineInfo(selectedNode);
-		if (lineNodes == null)
-			return;
-		for (WayPointNode node : lineNodes)
-		{
-			node.decayMe();
-		}
-		target.eraseLine(selectedNode);
-		selectedNode.eraseLine(target);
-	}
-	
-	/**
-	 * @param target
-	 */
-	public void eraseLine(WayPointNode target)
-	{
-		_linkLists.remove(target);
-	}
-	
-	/**
-	 * @param selectedNode
-	 * @return
-	 */
-	private List<WayPointNode> getLineInfo(WayPointNode selectedNode)
-	{
-		return _linkLists.get(selectedNode);
-	}
-	
-	public static void setLineId(int line_id)
-	{
-		_lineId = line_id;
-	}
-	
-	public List<WayPointNode> getLineNodes()
-	{
-		List<WayPointNode> list = new FastList<>();
-		
-		for (List<WayPointNode> points : _linkLists.values())
-		{
-			list.addAll(points);
-		}
-		
-		return list;
-	}
-	
-}

+ 58 - 54
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestBuyItem.java

@@ -17,6 +17,7 @@ package com.l2jserver.gameserver.network.clientpackets;
 import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
 import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import com.l2jserver.Config;
@@ -29,6 +30,7 @@ import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.holders.ItemHolder;
 import com.l2jserver.gameserver.model.items.L2Item;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
@@ -44,32 +46,31 @@ public final class RequestBuyItem extends L2GameClientPacket
 {
 	private static final String _C__40_REQUESTBUYITEM = "[C] 40 RequestBuyItem";
 	
-	private static final int BATCH_LENGTH = 12; // length of the one item
-	
+	private static final int BATCH_LENGTH = 12;
 	private int _listId;
-	private Item[] _items = null;
+	private List<ItemHolder> _items = null;
 	
 	@Override
 	protected void readImpl()
 	{
 		_listId = readD();
-		int count = readD();
-		if (count <= 0 || count > Config.MAX_ITEM_IN_PACKET || count * BATCH_LENGTH != _buf.remaining())
+		int size = readD();
+		if ((size <= 0) || (size > Config.MAX_ITEM_IN_PACKET) || ((size * BATCH_LENGTH) != _buf.remaining()))
 		{
 			return;
 		}
 		
-		_items = new Item[count];
-		for (int i = 0; i < count; i++)
+		_items = new ArrayList<>(size);
+		for (int i = 0; i < size; i++)
 		{
 			int itemId = readD();
-			long cnt = readQ();
-			if (itemId < 1 || cnt < 1)
+			long count = readQ();
+			if ((itemId < 1) || (count < 1))
 			{
 				_items = null;
 				return;
 			}
-			_items[i] = new Item(itemId, cnt);
+			_items.add(new ItemHolder(itemId, count));
 		}
 	}
 	
@@ -78,7 +79,9 @@ public final class RequestBuyItem extends L2GameClientPacket
 	{
 		L2PcInstance player = getClient().getActiveChar();
 		if (player == null)
+		{
 			return;
+		}
 		
 		if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("buy"))
 		{
@@ -93,7 +96,7 @@ public final class RequestBuyItem extends L2GameClientPacket
 		}
 		
 		// Alt game - Karma punishment
-		if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
+		if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (player.getKarma() > 0))
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
@@ -103,15 +106,16 @@ public final class RequestBuyItem extends L2GameClientPacket
 		L2Character merchant = null;
 		if (!player.isGM())
 		{
-			if(target == null 
-					|| (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) // Distance is too far)
-					|| (player.getInstanceId() != target.getInstanceId()))
+			if ((target == null) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) // Distance is too far)
+				|| (player.getInstanceId() != target.getInstanceId()))
 			{
 				sendPacket(ActionFailed.STATIC_PACKET);
 				return;
 			}
-			if((target instanceof L2MerchantInstance) || (target instanceof L2MerchantSummonInstance))
-				merchant = (L2Character)target;
+			if ((target instanceof L2MerchantInstance) || (target instanceof L2MerchantSummonInstance))
+			{
+				merchant = (L2Character) target;
+			}
 			else
 			{
 				sendPacket(ActionFailed.STATIC_PACKET);
@@ -149,14 +153,20 @@ public final class RequestBuyItem extends L2GameClientPacket
 				for (L2TradeList tradeList : lists)
 				{
 					if (tradeList.getListId() == _listId)
+					{
 						list = tradeList;
+					}
 				}
 			}
 			else
+			{
 				list = TradeController.getInstance().getBuyList(_listId);
+			}
 		}
 		else
+		{
 			list = TradeController.getInstance().getBuyList(_listId);
+		}
 		
 		if (list == null)
 		{
@@ -171,22 +181,24 @@ public final class RequestBuyItem extends L2GameClientPacket
 		// Check for buylist validity and calculates summary values
 		long slots = 0;
 		long weight = 0;
-		for (Item i : _items)
+		for (ItemHolder i : _items)
 		{
 			long price = -1;
 			
-			L2TradeItem tradeItem = list.getItemById(i.getItemId());
+			L2TradeItem tradeItem = list.getItemById(i.getId());
 			if (tradeItem == null)
 			{
-				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getItemId(), Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getId(), Config.DEFAULT_PUNISH);
 				return;
 			}
 			
-			L2Item template = ItemTable.getInstance().getTemplate(i.getItemId());
+			L2Item template = ItemTable.getInstance().getTemplate(i.getId());
 			if (template == null)
+			{
 				continue;
+			}
 			
-			if (!template.isStackable() && i.getCount() > 1)
+			if (!template.isStackable() && (i.getCount() > 1))
 			{
 				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase invalid quantity of items at the same time.", Config.DEFAULT_PUNISH);
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
@@ -195,9 +207,11 @@ public final class RequestBuyItem extends L2GameClientPacket
 				return;
 			}
 			
-			price = list.getPriceForItemId(i.getItemId());
-			if (i.getItemId() >= 3960 && i.getItemId() <= 4026)
+			price = list.getPriceForItemId(i.getId());
+			if ((i.getId() >= 3960) && (i.getId() <= 4026))
+			{
 				price *= Config.RATE_SIEGE_GUARDS_PRICE;
+			}
 			
 			if (price < 0)
 			{
@@ -206,7 +220,7 @@ public final class RequestBuyItem extends L2GameClientPacket
 				return;
 			}
 			
-			if (price == 0 && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
+			if ((price == 0) && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
 			{
 				player.sendMessage("Ohh Cheat dont work? You have a problem now!");
 				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried buy item for 0 adena.", Config.DEFAULT_PUNISH);
@@ -217,7 +231,9 @@ public final class RequestBuyItem extends L2GameClientPacket
 			{
 				// trying to buy more then available
 				if (i.getCount() > tradeItem.getCurrentCount())
+				{
 					return;
+				}
 			}
 			
 			if ((MAX_ADENA / i.getCount()) < price)
@@ -236,19 +252,23 @@ public final class RequestBuyItem extends L2GameClientPacket
 			
 			weight += i.getCount() * template.getWeight();
 			if (!template.isStackable())
+			{
 				slots += i.getCount();
-			else if (player.getInventory().getItemByItemId(i.getItemId()) == null)
+			}
+			else if (player.getInventory().getItemByItemId(i.getId()) == null)
+			{
 				slots++;
+			}
 		}
 		
-		if (!player.isGM() && (weight > Integer.MAX_VALUE || weight < 0 || !player.getInventory().validateWeight((int) weight)))
+		if (!player.isGM() && ((weight > Integer.MAX_VALUE) || (weight < 0) || !player.getInventory().validateWeight((int) weight)))
 		{
 			player.sendPacket(SystemMessageId.WEIGHT_LIMIT_EXCEEDED);
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
 		
-		if (!player.isGM() && (slots > Integer.MAX_VALUE || slots < 0 || !player.getInventory().validateCapacity((int) slots)))
+		if (!player.isGM() && ((slots > Integer.MAX_VALUE) || (slots < 0) || !player.getInventory().validateCapacity((int) slots)))
 		{
 			player.sendPacket(SystemMessageId.SLOTS_FULL);
 			sendPacket(ActionFailed.STATIC_PACKET);
@@ -264,27 +284,33 @@ public final class RequestBuyItem extends L2GameClientPacket
 		}
 		
 		// Proceed the purchase
-		for (Item i : _items)
+		for (ItemHolder i : _items)
 		{
-			L2TradeItem tradeItem = list.getItemById(i.getItemId());
+			L2TradeItem tradeItem = list.getItemById(i.getId());
 			if (tradeItem == null)
 			{
-				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getItemId(), Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getId(), Config.DEFAULT_PUNISH);
 				continue;
 			}
 			
 			if (tradeItem.hasLimitedStock())
 			{
 				if (tradeItem.decreaseCount(i.getCount()))
-					player.getInventory().addItem("Buy", i.getItemId(), i.getCount(), player, merchant);
+				{
+					player.getInventory().addItem("Buy", i.getId(), i.getCount(), player, merchant);
+				}
 			}
 			else
-				player.getInventory().addItem("Buy", i.getItemId(), i.getCount(), player, merchant);
+			{
+				player.getInventory().addItem("Buy", i.getId(), i.getCount(), player, merchant);
+			}
 		}
 		
 		// add to castle treasury
 		if (merchant instanceof L2MerchantInstance)
+		{
 			((L2MerchantInstance) merchant).getCastle().addToTreasury((long) (subTotal * castleTaxRate));
+		}
 		
 		StatusUpdate su = new StatusUpdate(player);
 		su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
@@ -292,28 +318,6 @@ public final class RequestBuyItem extends L2GameClientPacket
 		player.sendPacket(new ExBuySellListPacket(player, list, castleTaxRate + baseTaxRate, true));
 	}
 	
-	private static class Item
-	{
-		private final int _itemId;
-		private final long _count;
-		
-		public Item(int id, long num)
-		{
-			_itemId = id;
-			_count = num;
-		}
-		
-		public int getItemId()
-		{
-			return _itemId;
-		}
-		
-		public long getCount()
-		{
-			return _count;
-		}
-	}
-	
 	@Override
 	public String getType()
 	{

+ 10 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestRecipeShopListSet.java

@@ -33,15 +33,13 @@ import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
 import com.l2jserver.gameserver.util.Util;
 
 /**
- * This class ...
- * cd(dd)
- * @version $Revision: 1.1.2.3.2.3 $ $Date: 2005/03/27 15:29:30 $
+ * RequestRecipeShopListSet client packet class.
  */
 public final class RequestRecipeShopListSet extends L2GameClientPacket
 {
 	private static final String _C__BB_RequestRecipeShopListSet = "[C] BB RequestRecipeShopListSet";
 	
-	private static final int BATCH_LENGTH = 12; // length of the one item
+	private static final int BATCH_LENGTH = 12;
 	
 	private Recipe[] _items = null;
 	
@@ -49,15 +47,13 @@ public final class RequestRecipeShopListSet extends L2GameClientPacket
 	protected void readImpl()
 	{
 		int count = readD();
-		if (count <= 0
-				|| count > Config.MAX_ITEM_IN_PACKET
-				|| count * BATCH_LENGTH != _buf.remaining())
+		if ((count <= 0) || (count > Config.MAX_ITEM_IN_PACKET) || ((count * BATCH_LENGTH) != _buf.remaining()))
 		{
 			return;
 		}
 		
 		_items = new Recipe[count];
-		for (int i = 0; i < count ; i++)
+		for (int i = 0; i < count; i++)
 		{
 			int id = readD();
 			long cost = readQ();
@@ -75,7 +71,9 @@ public final class RequestRecipeShopListSet extends L2GameClientPacket
 	{
 		L2PcInstance player = getClient().getActiveChar();
 		if (player == null)
+		{
 			return;
+		}
 		
 		if (_items == null)
 		{
@@ -108,18 +106,13 @@ public final class RequestRecipeShopListSet extends L2GameClientPacket
 			L2RecipeList list = rd.getRecipeList(i.getRecipeId());
 			if (!dwarfRecipes.contains(list) && !commonRecipes.contains(list))
 			{
-				Util.handleIllegalPlayerAction(player, "Warning!! Player " + player.getName() + " of account " + player.getAccountName()
-						+ " tried to set recipe which he dont have.", Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Player " + player.getName() + " of account " + player.getAccountName() + " tried to set recipe which he dont have.", Config.DEFAULT_PUNISH);
 				return;
 			}
 			
 			if (!i.addToList(createList))
 			{
-				Util.handleIllegalPlayerAction(player, "Warning!! Character "
-						+ player.getName() + " of account "
-						+ player.getAccountName() + " tried to set price more than "
-						+ MAX_ADENA + " adena in Private Manufacture.",
-						Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to set price more than " + MAX_ADENA + " adena in Private Manufacture.", Config.DEFAULT_PUNISH);
 				return;
 			}
 		}
@@ -148,7 +141,9 @@ public final class RequestRecipeShopListSet extends L2GameClientPacket
 		public boolean addToList(L2ManufactureList list)
 		{
 			if (_cost > MAX_ADENA)
+			{
 				return false;
+			}
 			
 			list.add(new L2ManufactureItem(_recipeId, _cost));
 			return true;

+ 36 - 58
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestSellItem.java

@@ -17,6 +17,7 @@ package com.l2jserver.gameserver.network.clientpackets;
 import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
 import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import com.l2jserver.Config;
@@ -27,6 +28,7 @@ import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.holders.ItemHolder;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.ExBuySellListPacket;
@@ -34,63 +36,46 @@ import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
 import com.l2jserver.gameserver.util.Util;
 
 /**
- * packet type id 0x1e
- *
- * sample
- *
- * 1e
- * 00 00 00 00		// list id
- * 02 00 00 00		// number of items
- *
- * 71 72 00 10		// object id
- * ea 05 00 00		// item id
- * 01 00 00 00		// item count
- *
- * 76 4b 00 10		// object id
- * 2e 0a 00 00		// item id
- * 01 00 00 00		// item count
- *
- * format:		cdd (ddd)
  * RequestSellItem client packet class.
  */
 public final class RequestSellItem extends L2GameClientPacket
 {
 	private static final String _C__37_REQUESTSELLITEM = "[C] 37 RequestSellItem";
 	
-	private static final int BATCH_LENGTH = 16; // length of the one item
+	private static final int BATCH_LENGTH = 16;
 	
 	private int _listId;
-	private Item[] _items = null;
+	private List<ItemHolder> _items = null;
 	
 	@Override
 	protected void readImpl()
 	{
 		_listId = readD();
-		int count = readD();
-		if (count <= 0 || count > Config.MAX_ITEM_IN_PACKET || count * BATCH_LENGTH != _buf.remaining())
+		int size = readD();
+		if ((size <= 0) || (size > Config.MAX_ITEM_IN_PACKET) || ((size * BATCH_LENGTH) != _buf.remaining()))
 		{
 			return;
 		}
 		
-		_items = new Item[count];
-		for (int i = 0; i < count; i++)
+		_items = new ArrayList<>(size);
+		for (int i = 0; i < size; i++)
 		{
 			int objectId = readD();
 			int itemId = readD();
-			long cnt = readQ();
-			if (objectId < 1 || itemId < 1 || cnt < 1)
+			long count = readQ();
+			if ((objectId < 1) || (itemId < 1) || (count < 1))
 			{
 				_items = null;
 				return;
 			}
-			_items[i] = new Item(objectId, itemId, cnt);
+			_items.add(new ItemHolder(itemId, objectId, count));
 		}
 	}
 	
 	@Override
 	protected void runImpl()
 	{
-		this.processSell();
+		processSell();
 	}
 	
 	protected void processSell()
@@ -98,7 +83,9 @@ public final class RequestSellItem extends L2GameClientPacket
 		L2PcInstance player = getClient().getActiveChar();
 		
 		if (player == null)
+		{
 			return;
+		}
 		
 		if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("buy"))
 		{
@@ -113,7 +100,7 @@ public final class RequestSellItem extends L2GameClientPacket
 		}
 		
 		// Alt game - Karma punishment
-		if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
+		if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (player.getKarma() > 0))
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
@@ -123,15 +110,16 @@ public final class RequestSellItem extends L2GameClientPacket
 		L2Character merchant = null;
 		if (!player.isGM())
 		{
-			if(target == null 
-					|| (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) // Distance is too far)
-					|| (player.getInstanceId() != target.getInstanceId()))
+			if ((target == null) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) // Distance is too far)
+				|| (player.getInstanceId() != target.getInstanceId()))
 			{
 				sendPacket(ActionFailed.STATIC_PACKET);
 				return;
 			}
-			if((target instanceof L2MerchantInstance) || (target instanceof L2MerchantSummonInstance))
-				merchant = (L2Character)target;
+			if ((target instanceof L2MerchantInstance) || (target instanceof L2MerchantSummonInstance))
+			{
+				merchant = (L2Character) target;
+			}
 			else
 			{
 				sendPacket(ActionFailed.STATIC_PACKET);
@@ -166,14 +154,20 @@ public final class RequestSellItem extends L2GameClientPacket
 				for (L2TradeList tradeList : lists)
 				{
 					if (tradeList.getListId() == _listId)
+					{
 						list = tradeList;
+					}
 				}
 			}
 			else
+			{
 				list = TradeController.getInstance().getBuyList(_listId);
+			}
 		}
 		else
+		{
 			list = TradeController.getInstance().getBuyList(_listId);
+		}
 		
 		if (list == null)
 		{
@@ -183,24 +177,30 @@ public final class RequestSellItem extends L2GameClientPacket
 		
 		long totalPrice = 0;
 		// Proceed the sell
-		for (Item i : _items)
+		for (ItemHolder i : _items)
 		{
 			L2ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell");
-			if (item == null || (!item.isSellable()))
+			if ((item == null) || (!item.isSellable()))
+			{
 				continue;
+			}
 			
 			long price = item.getReferencePrice() / 2;
 			totalPrice += price * i.getCount();
-			if ((MAX_ADENA / i.getCount()) < price || totalPrice > MAX_ADENA)
+			if (((MAX_ADENA / i.getCount()) < price) || (totalPrice > MAX_ADENA))
 			{
 				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
 				return;
 			}
 			
 			if (Config.ALLOW_REFUND)
+			{
 				item = player.getInventory().transferItem("Sell", i.getObjectId(), i.getCount(), player.getRefund(), player, merchant);
+			}
 			else
+			{
 				item = player.getInventory().destroyItem("Sell", i.getObjectId(), i.getCount(), player, merchant);
+			}
 		}
 		player.addAdena("Sell", totalPrice, merchant, false);
 		
@@ -211,28 +211,6 @@ public final class RequestSellItem extends L2GameClientPacket
 		player.sendPacket(new ExBuySellListPacket(player, list, taxRate, true));
 	}
 	
-	private static class Item
-	{
-		private final int _objectId;
-		private final long _count;
-		
-		public Item(int objId, int id, long num)
-		{
-			_objectId = objId;
-			_count = num;
-		}
-		
-		public int getObjectId()
-		{
-			return _objectId;
-		}
-		
-		public long getCount()
-		{
-			return _count;
-		}
-	}
-	
 	@Override
 	public String getType()
 	{

+ 56 - 54
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/SendWareHouseDepositList.java

@@ -16,9 +16,13 @@ package com.l2jserver.gameserver.network.clientpackets;
 
 import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.ADENA_ID;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.holders.ItemHolder;
 import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
 import com.l2jserver.gameserver.model.itemcontainer.PcWarehouse;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -29,42 +33,36 @@ import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
 import com.l2jserver.gameserver.util.Util;
 
 /**
- * This class ...
- *
- * 31  SendWareHouseDepositList  cd (dd)
- *
- * @version $Revision: 1.3.4.5 $ $Date: 2005/04/11 10:06:09 $
+ * SendWareHouseDepositList client packet class.
  */
 public final class SendWareHouseDepositList extends L2GameClientPacket
 {
 	private static final String _C__3B_SENDWAREHOUSEDEPOSITLIST = "[C] 3B SendWareHouseDepositList";
 	
-	private static final int BATCH_LENGTH = 12; // length of the one item
+	private static final int BATCH_LENGTH = 12;
 	
-	private WarehouseItem _items[] = null;
+	private List<ItemHolder> _items = null;
 	
 	@Override
 	protected void readImpl()
 	{
-		final int count = readD();
-		if (count <= 0
-				|| count > Config.MAX_ITEM_IN_PACKET
-				|| count * BATCH_LENGTH != _buf.remaining())
+		final int size = readD();
+		if ((size <= 0) || (size > Config.MAX_ITEM_IN_PACKET) || ((size * BATCH_LENGTH) != _buf.remaining()))
 		{
 			return;
 		}
 		
-		_items = new WarehouseItem[count];
-		for (int i=0; i < count; i++)
+		_items = new ArrayList<>(size);
+		for (int i = 0; i < size; i++)
 		{
 			int objId = readD();
-			long cnt = readQ();
-			if (objId < 1 || cnt < 0)
+			long count = readQ();
+			if ((objId < 1) || (count < 0))
 			{
 				_items = null;
 				return;
 			}
-			_items[i] = new WarehouseItem(objId, cnt);
+			_items.add(new ItemHolder(objId, count));
 		}
 	}
 	
@@ -72,11 +70,15 @@ public final class SendWareHouseDepositList extends L2GameClientPacket
 	protected void runImpl()
 	{
 		if (_items == null)
+		{
 			return;
+		}
 		
 		final L2PcInstance player = getClient().getActiveChar();
 		if (player == null)
+		{
 			return;
+		}
 		
 		if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("deposit"))
 		{
@@ -86,14 +88,16 @@ public final class SendWareHouseDepositList extends L2GameClientPacket
 		
 		final ItemContainer warehouse = player.getActiveWarehouse();
 		if (warehouse == null)
+		{
 			return;
+		}
 		final boolean isPrivate = warehouse instanceof PcWarehouse;
 		
 		final L2Npc manager = player.getLastFolkNPC();
-		if ((manager == null
-				|| !manager.isWarehouse()
-				|| !manager.canInteract(player)) && !player.isGM())
+		if (((manager == null) || !manager.isWarehouse() || !manager.canInteract(player)) && !player.isGM())
+		{
 			return;
+		}
 		
 		if (!isPrivate && !player.getAccessLevel().allowTransaction())
 		{
@@ -103,35 +107,43 @@ public final class SendWareHouseDepositList extends L2GameClientPacket
 		
 		if (player.getActiveEnchantItem() != null)
 		{
-			Util.handleIllegalPlayerAction(player,"Player "+player.getName()+" tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
+			Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
 			return;
 		}
 		
 		// Alt game - Karma punishment
-		if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && player.getKarma() > 0)
+		if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && (player.getKarma() > 0))
+		{
 			return;
+		}
 		
 		// Freight price from config or normal price per item slot (30)
-		final long fee = _items.length * 30;
+		final long fee = _items.size() * 30;
 		long currentAdena = player.getAdena();
 		int slots = 0;
 		
-		for (WarehouseItem i : _items)
+		for (ItemHolder i : _items)
 		{
-			L2ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "deposit");
+			L2ItemInstance item = player.checkItemManipulation(i.getId(), i.getCount(), "deposit");
 			if (item == null)
 			{
-				_log.warning("Error depositing a warehouse object for char "+player.getName()+" (validity check)");
+				_log.warning("Error depositing a warehouse object for char " + player.getName() + " (validity check)");
 				return;
 			}
 			
 			// Calculate needed adena and slots
 			if (item.getItemId() == ADENA_ID)
+			{
 				currentAdena -= i.getCount();
+			}
 			if (!item.isStackable())
+			{
 				slots += i.getCount();
+			}
 			else if (warehouse.getItemByItemId(item.getItemId()) == null)
+			{
 				slots++;
+			}
 		}
 		
 		// Item Max Limit Check
@@ -142,7 +154,7 @@ public final class SendWareHouseDepositList extends L2GameClientPacket
 		}
 		
 		// Check if enough adena and charge the fee
-		if (currentAdena < fee || !player.reduceAdena(warehouse.getName(), fee, manager, false))
+		if ((currentAdena < fee) || !player.reduceAdena(warehouse.getName(), fee, manager, false))
 		{
 			player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
 			return;
@@ -150,44 +162,56 @@ public final class SendWareHouseDepositList extends L2GameClientPacket
 		
 		// get current tradelist if any
 		if (player.getActiveTradeList() != null)
+		{
 			return;
+		}
 		
 		// Proceed to the transfer
 		InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
-		for (WarehouseItem i : _items)
+		for (ItemHolder i : _items)
 		{
 			// Check validity of requested item
-			L2ItemInstance oldItem = player.checkItemManipulation(i.getObjectId(), i.getCount(), "deposit");
+			L2ItemInstance oldItem = player.checkItemManipulation(i.getId(), i.getCount(), "deposit");
 			if (oldItem == null)
 			{
-				_log.warning("Error depositing a warehouse object for char "+player.getName()+" (olditem == null)");
+				_log.warning("Error depositing a warehouse object for char " + player.getName() + " (olditem == null)");
 				return;
 			}
 			
 			if (!oldItem.isDepositable(isPrivate) || !oldItem.isAvailable(player, true, isPrivate))
+			{
 				continue;
+			}
 			
-			final L2ItemInstance newItem = player.getInventory().transferItem(warehouse.getName(), i.getObjectId(), i.getCount(), warehouse, player, manager);
+			final L2ItemInstance newItem = player.getInventory().transferItem(warehouse.getName(), i.getId(), i.getCount(), warehouse, player, manager);
 			if (newItem == null)
 			{
-				_log.warning("Error depositing a warehouse object for char "+player.getName()+" (newitem == null)");
+				_log.warning("Error depositing a warehouse object for char " + player.getName() + " (newitem == null)");
 				continue;
 			}
 			
 			if (playerIU != null)
 			{
-				if (oldItem.getCount() > 0 && oldItem != newItem)
+				if ((oldItem.getCount() > 0) && (oldItem != newItem))
+				{
 					playerIU.addModifiedItem(oldItem);
+				}
 				else
+				{
 					playerIU.addRemovedItem(oldItem);
+				}
 			}
 		}
 		
 		// Send updated item list to the player
 		if (playerIU != null)
+		{
 			player.sendPacket(playerIU);
+		}
 		else
+		{
 			player.sendPacket(new ItemList(player, false));
+		}
 		
 		// Update current load status on player
 		StatusUpdate su = new StatusUpdate(player);
@@ -195,28 +219,6 @@ public final class SendWareHouseDepositList extends L2GameClientPacket
 		player.sendPacket(su);
 	}
 	
-	private static class WarehouseItem
-	{
-		private final int _objectId;
-		private final long _count;
-		
-		public WarehouseItem(int id, long num)
-		{
-			_objectId = id;
-			_count = num;
-		}
-		
-		public int getObjectId()
-		{
-			return _objectId;
-		}
-		
-		public long getCount()
-		{
-			return _count;
-		}
-	}
-	
 	@Override
 	public String getType()
 	{