public static MapleStorage loadStorage(int id) {
	MapleStorage ret = null;
	int storeId;
	try {
	    Connection con = DatabaseConnection.getConnection();
	    PreparedStatement ps = con.prepareStatement("SELECT * FROM storages WHERE accountid = ?");
	    ps.setInt(1, id);
	    ResultSet rs = ps.executeQuery();

	    if (rs.next()) {
		storeId = rs.getInt("storageid");
		ret = new MapleStorage(storeId, rs.getByte("slots"), rs.getInt("meso"));
		rs.close();
		ps.close();

		ps = con.prepareStatement("SELECT * FROM inventoryitems LEFT JOIN inventoryequipment USING (inventoryitemid) WHERE storageid = ?");
		ps.setInt(1, storeId);
		rs = ps.executeQuery();
		while (rs.next()) {
		    MapleInventoryType type = MapleInventoryType.getByType((byte) rs.getInt("inventorytype"));
		    if (type.equals(MapleInventoryType.EQUIP) || type.equals(MapleInventoryType.EQUIPPED)) {
			int itemid = rs.getInt("itemid");
			Equip equip = new Equip(itemid, rs.getByte("position"), rs.getInt("ringid"), rs.getByte("flag"));
			equip.setOwner(rs.getString("owner"));
			equip.setQuantity(rs.getShort("quantity"));
			equip.setAcc(rs.getShort("acc"));
			equip.setAvoid(rs.getShort("avoid"));
			equip.setDex(rs.getShort("dex"));
			equip.setHands(rs.getShort("hands"));
			equip.setHp(rs.getShort("hp"));
			equip.setInt(rs.getShort("int"));
			equip.setJump(rs.getShort("jump"));
			equip.setLuk(rs.getShort("luk"));
			equip.setMatk(rs.getShort("matk"));
			equip.setMdef(rs.getShort("mdef"));
			equip.setMp(rs.getShort("mp"));
			equip.setSpeed(rs.getShort("speed"));
			equip.setStr(rs.getShort("str"));
			equip.setWatk(rs.getShort("watk"));
			equip.setWdef(rs.getShort("wdef"));
			equip.setItemLevel(rs.getByte("itemLevel"));
			equip.setItemEXP(rs.getShort("itemEXP"));
			equip.setUpgradeSlots(rs.getByte("upgradeslots"));
			equip.setLevel(rs.getByte("level"));
			equip.setViciousHammer(rs.getByte("ViciousHammer"));
			equip.setExpiration(rs.getLong("expiredate"));
			equip.setFlag(rs.getByte("flag"));
			ret.items.add(equip);
		    } else {
			Item item = new Item(rs.getInt("itemid"), (byte) rs.getInt("position"), (short) rs.getInt("quantity"), rs.getByte("flag"));
			item.setOwner(rs.getString("owner"));
			item.setExpiration(rs.getLong("expiredate"));
			item.setFlag(rs.getByte("flag"));
			ret.items.add(item);
		    }
		}
		rs.close();
		ps.close();
	    } else {
		storeId = create(id);
		ret = new MapleStorage(storeId, (byte) 4, 0);
	    }
	} catch (SQLException ex) {
	    System.err.println("Error loading storage" + ex);
	}
	return ret;
    }