Thread: Missing Opcode 144 for Item 0 - 718/742

Results 1 to 4 of 4
  1. #1 Missing Opcode 144 for Item 0 - 718/742 
    Registered Member
    Join Date
    Oct 2013
    Posts
    6
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    I'm trying to run this server and I keep getting this error message. I've tried multiple tutorials and can't figure out how to fix it.

    The Error Message:
    Code:
    [Launcher] Initing Cache...
    [GrandExchange] Loading Data...
    Exception in thread "main" java.lang.RuntimeException: MISSING OPCODE 144 FOR IT
    EM 0
            at com.rs.cache.loaders.ItemDefinitions.readValues(ItemDefinitions.java:
    559)
            at com.rs.cache.loaders.ItemDefinitions.readOpcodeValues(ItemDefinitions
    .java:571)
            at com.rs.cache.loaders.ItemDefinitions.loadItemDefinitions(ItemDefiniti
    ons.java:141)
            at com.rs.cache.loaders.ItemDefinitions.<init>(ItemDefinitions.java:128)
    
            at com.rs.cache.loaders.ItemDefinitions.getItemDefinitions(ItemDefinitio
    ns.java:115)
            at com.rs.cache.loaders.ItemsEquipIds.init(ItemsEquipIds.java:14)
            at com.rs.Launcher.main(Launcher.java:69)
    Press any key to continue . . .



    ItemDefinitions.java:
    Code:
    package com.rs.cache.loaders;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    import java.util.HashMap;
    import java.util.LinkedList;
    
    import com.alex.utils.Constants;
    import com.rs.cache.Cache;
    import com.rs.game.player.Equipment;
    import com.rs.game.player.Skills;
    import com.rs.io.InputStream;
    import com.rs.utils.Utils;
    
    @SuppressWarnings("unused")
    public final class ItemDefinitions {
    
    	private static final ItemDefinitions[] itemsDefinitions;
    
    	static { // that's why this is here
    		itemsDefinitions = new ItemDefinitions[Utils.getItemDefinitionsSize()];
    	}
    
    	private int id;
    	private boolean loaded;
    
    	public int modelId;
    	private String name;
    
    	// model size information
    	private int modelZoom;
    	private int modelRotation1;
    	private int modelRotation2;
    	private int modelOffset1;
    	private int modelOffset2;
    
    	// extra information
    	private int stackable;
    	private int value;
    	private boolean membersOnly;
    
    	// wearing model information
    	private int maleEquip1;
    	private int femaleEquip1;
    	private int maleEquip2;
    	private int femaleEquip2;
    
    	// options
    	private String[] groundOptions;
    	public String[] inventoryOptions;
    
    	// model information
    	public int[] originalModelColors;
    	public int[] modifiedModelColors;
    	public short[] originalTextureColors;
    	private short[] modifiedTextureColors;
    	private byte[] unknownArray1;
    	private int[] unknownArray2;
    	// extra information, not used for newer items
    	private boolean unnoted;
    
    	private int maleEquipModelId3;
    	private int femaleEquipModelId3;
    	private int unknownInt1;
    	private int unknownInt2;
    	private int unknownInt3;
    	private int unknownInt4;
    	private int unknownInt5;
    	private int unknownInt6;
    	private int certId;
    	private int certTemplateId;
    	private int[] stackIds;
    	private int[] stackAmounts;
    	private int unknownInt7;
    	private int unknownInt8;
    	private int unknownInt9;
    	private int unknownInt10;
    	private int unknownInt11;
    	public int teamId;
    	private int lendId;
    	private int lendTemplateId;
    	private int unknownInt12;
    	private int unknownInt13;
    	private int unknownInt14;
    	private int unknownInt15;
    	private int unknownInt16;
    	private int unknownInt17;
    	private int unknownInt18;
    	private int unknownInt19;
    	private int unknownInt20;
    	private int unknownInt21;
    	private int unknownInt22;
    	private int unknownInt23;
    	private int equipSlot;
    	private int equipType;
    
    	// extra added
    	private boolean noted;
    	private boolean lended;
    
    	private HashMap<Integer, Object> clientScriptData;
    	private HashMap<Integer, Integer> itemRequiriments;
    
    	public static final ItemDefinitions getItemDefinitions(int itemId) {
    		if (itemId < 0 || itemId >= itemsDefinitions.length)
    			itemId = 0;
    		ItemDefinitions def = itemsDefinitions[itemId];
    		if (def == null)
    			itemsDefinitions[itemId] = def = new ItemDefinitions(itemId);
    		return def;
    	}
    
    	public static final void clearItemsDefinitions() {
    		for (int i = 0; i < itemsDefinitions.length; i++)
    			itemsDefinitions[i] = null;
    	}
    
    	public ItemDefinitions(int id) {
    		this.id = id;
    		setDefaultsVariableValues();
    		setDefaultOptions();
    		loadItemDefinitions();
    	}
    
    	public boolean isLoaded() {
    		return loaded;
    	}
    
    	private final void loadItemDefinitions() {
    		byte[] data = Cache.STORE.getIndexes()[Constants.ITEM_DEFINITIONS_INDEX].getFile(getArchiveId(), getFileId());
    		if (data == null) {
    			// System.out.println("Failed loading Item " + id+".");
    			return;
    		}
    		readOpcodeValues(new InputStream(data));
    		if (certTemplateId != -1)
    			toNote();
    		if (lendTemplateId != -1)
    			toLend();
    		if (unknownValue1 != -1)
    			toBind();
    		loaded = true;
    	}
    
    	private void toNote() {
    		// ItemDefinitions noteItem; //certTemplateId
    		ItemDefinitions realItem = getItemDefinitions(certId);
    		membersOnly = realItem.membersOnly;
    		value = realItem.value;
    		name = realItem.name;
    		stackable = 1;
    		noted = true;
    	}
    
    	private void toBind() {
    		// ItemDefinitions lendItem; //lendTemplateId
    		ItemDefinitions realItem = getItemDefinitions(unknownValue2);
    		originalModelColors = realItem.originalModelColors;
    		maleEquipModelId3 = realItem.maleEquipModelId3;
    		femaleEquipModelId3 = realItem.femaleEquipModelId3;
    		teamId = realItem.teamId;
    		value = 0;
    		membersOnly = realItem.membersOnly;
    		name = realItem.name;
    		inventoryOptions = new String[5];
    		groundOptions = realItem.groundOptions;
    		if (realItem.inventoryOptions != null)
    			for (int optionIndex = 0; optionIndex < 4; optionIndex++)
    				inventoryOptions[optionIndex] = realItem.inventoryOptions[optionIndex];
    		inventoryOptions[4] = "Discard";
    		maleEquip1 = realItem.maleEquip1;
    		maleEquip2 = realItem.maleEquip2;
    		femaleEquip1 = realItem.femaleEquip1;
    		femaleEquip2 = realItem.femaleEquip2;
    		clientScriptData = realItem.clientScriptData;
    		equipSlot = realItem.equipSlot;
    		equipType = realItem.equipType;
    	}
    
    	private void toLend() {
    		// ItemDefinitions lendItem; //lendTemplateId
    		ItemDefinitions realItem = getItemDefinitions(lendId);
    		originalModelColors = realItem.originalModelColors;
    		maleEquipModelId3 = realItem.maleEquipModelId3;
    		femaleEquipModelId3 = realItem.femaleEquipModelId3;
    		teamId = realItem.teamId;
    		value = 0;
    		membersOnly = realItem.membersOnly;
    		name = realItem.name;
    		inventoryOptions = new String[5];
    		groundOptions = realItem.groundOptions;
    		if (realItem.inventoryOptions != null)
    			for (int optionIndex = 0; optionIndex < 4; optionIndex++)
    				inventoryOptions[optionIndex] = realItem.inventoryOptions[optionIndex];
    		inventoryOptions[4] = "Discard";
    		maleEquip1 = realItem.maleEquip1;
    		maleEquip2 = realItem.maleEquip2;
    		femaleEquip1 = realItem.femaleEquip1;
    		femaleEquip2 = realItem.femaleEquip2;
    		clientScriptData = realItem.clientScriptData;
    		equipSlot = realItem.equipSlot;
    		equipType = realItem.equipType;
    		lended = true;
    	}
    
    	public int getArchiveId() {
    		return getId() >>> 8;
    	}
    
    	public int getFileId() {
    		return 0xff & getId();
    	}
    
    	public boolean isDestroyItem() {
    		if (inventoryOptions == null)
    			return false;
    		for (String option : inventoryOptions) {
    			if (option == null)
    				continue;
    			if (option.equalsIgnoreCase("destroy"))
    				return true;
    		}
    		return false;
    	}
    
    	public boolean containsOption(int i, String option) {
    		if (inventoryOptions == null || inventoryOptions[i] == null || inventoryOptions.length <= i)
    			return false;
    		return inventoryOptions[i].equals(option);
    	}
    
    	public boolean containsOption(String option) {
    		if (inventoryOptions == null)
    			return false;
    		for (String o : inventoryOptions) {
    			if (o == null || !o.equals(option))
    				continue;
    			return true;
    		}
    		return false;
    	}
    
    
    	public boolean isWearItem() {
    		return equipSlot != -1;
    	}
    
    	public boolean isWearItem(boolean male) {
    		if (equipSlot < Equipment.SLOT_RING && (male ? getMaleWornModelId1() == -1
    				: getFemaleWornModelId1() == -1))
    			return false;
    		return equipSlot != -1;
    	}
    
    	public boolean hasSpecialBar() {
    		if (clientScriptData == null)
    			return false;
    		Object specialBar = clientScriptData.get(686);
    		if (specialBar != null && specialBar instanceof Integer)
    			return (Integer) specialBar == 1;
    		return false;
    	}
    
    	public int getRenderAnimId() {
    		if (clientScriptData == null)
    			return 1426;
    		Object animId = clientScriptData.get(644);
    		if (animId != null && animId instanceof Integer)
    			return (Integer) animId;
    		return 1426;
    	}
    
    	public int getModelZoom() {
    		return modelZoom;
    	}
    
    	public int getModelOffset1() {
    		return modelOffset1;
    	}
    
    	public int getModelOffset2() {
    		return modelOffset2;
    	}
    
    	public int getQuestId() {
    		if (clientScriptData == null)
    			return -1;
    		Object questId = clientScriptData.get(861);
    		if (questId != null && questId instanceof Integer)
    			return (Integer) questId;
    		return -1;
    	}
    
    	public HashMap<Integer, Integer> getCreateItemRequirements() {
    		if (clientScriptData == null)
    			return null;
    		HashMap<Integer, Integer> items = new HashMap<Integer, Integer>();
    		int requiredId = -1;
    		int requiredAmount = -1;
    		for (int key : clientScriptData.keySet()) {
    			Object value = clientScriptData.get(key);
    			if (value instanceof String)
    				continue;
    			if (key >= 538 && key <= 770) {
    				if (key % 2 == 0)
    					requiredId = (Integer) value;
    				else
    					requiredAmount = (Integer) value;
    				if (requiredId != -1 && requiredAmount != -1) {
    					items.put(requiredAmount, requiredId);
    					requiredId = -1;
    					requiredAmount = -1;
    				}
    			}
    		}
    		return items;
    	}
    
    	public HashMap<Integer, Object> getClientScriptData() {
    		return clientScriptData;
    	}
    
    	public HashMap<Integer, Integer> getWearingSkillRequiriments() {
    		if (clientScriptData == null)
    			return null;
    		if (itemRequiriments == null) {
    			HashMap<Integer, Integer> skills = new HashMap<Integer, Integer>();
    			for (int i = 0; i < 10; i++) {
    				Integer skill = (Integer) clientScriptData.get(749 + (i * 2));
    				if (skill != null) {
    					Integer level = (Integer) clientScriptData
    							.get(750 + (i * 2));
    					if (level != null)
    						skills.put(skill, level);
    				}
    			}
    			Integer maxedSkill = (Integer) clientScriptData.get(277);
    			if (maxedSkill != null)
    				skills.put(maxedSkill, getId() == 19709 ? 120 : 99);
    			itemRequiriments = skills;
    			if (getId() == 7462)
    				itemRequiriments.put(Skills.DEFENCE, 40);
    			else if (name.equals("Dragon defender")) {
    				itemRequiriments.put(Skills.ATTACK, 60);
    				itemRequiriments.put(Skills.DEFENCE, 60);
    			}
    		}
    
    		return itemRequiriments;
    	}
    
    	/*
    	 * public HashMap<Integer, Integer> getWearingSkillRequiriments() { if
    	 * (clientScriptData == null) return null; HashMap<Integer, Integer> skills
    	 * = new HashMap<Integer, Integer>(); int nextLevel = -1; int nextSkill =
    	 * -1; for (int key : clientScriptData.keySet()) { Object value =
    	 * clientScriptData.get(key); if (value instanceof String) continue; if(key
    	 * == 277) { skills.put((Integer) value, id == 19709 ? 120 : 99); }else if
    	 * (key == 23 && id == 15241) { skills.put(4, (Integer) value);
    	 * skills.put(11, 61); } else if (key >= 749 && key < 797) { if (key % 2 ==
    	 * 0) nextLevel = (Integer) value; else nextSkill = (Integer) value; if
    	 * (nextLevel != -1 && nextSkill != -1) { skills.put(nextSkill, nextLevel);
    	 * nextLevel = -1; nextSkill = -1; } }
    	 * 
    	 * } return skills; }
    	 */
    
    	private void setDefaultOptions() {
    		groundOptions = new String[] { null, null, "take", null, null };
    		inventoryOptions = new String[] { null, null, null, null, "drop" };
    	}
    
    	private void setDefaultsVariableValues() {
    		name = "null";
    		maleEquip1 = -1;
    		maleEquip2 = -1;
    		femaleEquip1 = -1;
    		femaleEquip2 = -1;
    		modelZoom = 2000;
    		lendId = -1;
    		lendTemplateId = -1;
    		certId = -1;
    		certTemplateId = -1;
    		unknownInt9 = 128;
    		value = 1;
    		maleEquipModelId3 = -1;
    		femaleEquipModelId3 = -1;
    		unknownValue1 = -1;
    		unknownValue2 = -1;
    		teamId = -1;
    		equipSlot = -1;
    		equipType = -1;
    	}
    
    	private final void readValues(InputStream stream, int opcode) {
    		if (opcode == 1)
    			modelId = stream.readBigSmart();
    		else if (opcode == 2)
    			name = stream.readString();
    		else if (opcode == 4)
    			modelZoom = stream.readUnsignedShort();
    		else if (opcode == 5)
    			modelRotation1 = stream.readUnsignedShort();
    		else if (opcode == 6)
    			modelRotation2 = stream.readUnsignedShort();
    		else if (opcode == 7) {
    			modelOffset1 = stream.readUnsignedShort();
    			if (modelOffset1 > 32767)
    				modelOffset1 -= 65536;
    			modelOffset1 <<= 0;
    		} else if (opcode == 8) {
    			modelOffset2 = stream.readUnsignedShort();
    			if (modelOffset2 > 32767)
    				modelOffset2 -= 65536;
    			modelOffset2 <<= 0;
    		} else if (opcode == 11)
    			stackable = 1;
    		else if (opcode == 12)
    			value = stream.readInt();
    		else if (opcode == 13)  {
    			equipSlot = stream.readUnsignedByte();
    		}else if (opcode == 14) {
    			equipType = stream.readUnsignedByte();
    		}else if (opcode == 16)
    			membersOnly = true;
    		else if (opcode == 18) { // added
    			stream.readUnsignedShort();
    		}else if (opcode == 23)
    			maleEquip1 = stream.readBigSmart();
    		else if (opcode == 24)
    			maleEquip2 = stream.readBigSmart();
    		else if (opcode == 25)
    			femaleEquip1 = stream.readBigSmart();
    		else if (opcode == 26)
    			femaleEquip2 = stream.readBigSmart();
    		else if (opcode == 27)
    			stream.readUnsignedByte();
    		else if (opcode >= 30 && opcode < 35)
    			groundOptions[opcode - 30] = stream.readString();
    		else if (opcode >= 35 && opcode < 40)
    			inventoryOptions[opcode - 35] = stream.readString();
    		else if (opcode == 40) {
    			int length = stream.readUnsignedByte();
    			originalModelColors = new int[length];
    			modifiedModelColors = new int[length];
    			for (int index = 0; index < length; index++) {
    				originalModelColors[index] = stream.readUnsignedShort();
    				modifiedModelColors[index] = stream.readUnsignedShort();
    			}
    		} else if (opcode == 41) {
    			int length = stream.readUnsignedByte();
    			originalTextureColors = new short[length];
    			modifiedTextureColors = new short[length];
    			for (int index = 0; index < length; index++) {
    				originalTextureColors[index] = (short) stream
    						.readUnsignedShort();
    				modifiedTextureColors[index] = (short) stream
    						.readUnsignedShort();
    			}
    		} else if (opcode == 42) {
    			int length = stream.readUnsignedByte();
    			unknownArray1 = new byte[length];
    			for (int index = 0; index < length; index++)
    				unknownArray1[index] = (byte) stream.readByte();
    		} else if (opcode == 65)
    			unnoted = true;
    		else if (opcode == 78)
    			maleEquipModelId3 = stream.readBigSmart();
    		else if (opcode == 79)
    			femaleEquipModelId3 = stream.readBigSmart();
    		else if (opcode == 90)
    			unknownInt1 = stream.readBigSmart();
    		else if (opcode == 91)
    			unknownInt2 = stream.readBigSmart();
    		else if (opcode == 92)
    			unknownInt3 = stream.readBigSmart();
    		else if (opcode == 93)
    			unknownInt4 = stream.readBigSmart();
    		else if (opcode == 95) 
    			unknownInt5 = stream.readUnsignedShort();
    		else if (opcode == 96)
    			unknownInt6 = stream.readUnsignedByte();
    		else if (opcode == 97)
    			certId = stream.readUnsignedShort();
    		else if (opcode == 98)
    			certTemplateId = stream.readUnsignedShort();
    		else if (opcode >= 100 && opcode < 110) {
    			if (stackIds == null) {
    				stackIds = new int[10];
    				stackAmounts = new int[10];
    			}
    			stackIds[opcode - 100] = stream.readUnsignedShort();
    			stackAmounts[opcode - 100] = stream.readUnsignedShort();
    		} else if (opcode == 110)
    			unknownInt7 = stream.readUnsignedShort();
    		else if (opcode == 111)
    			unknownInt8 = stream.readUnsignedShort();
    		else if (opcode == 112)
    			unknownInt9 = stream.readUnsignedShort();
    		else if (opcode == 113)
    			unknownInt10 = stream.readByte();
    		else if (opcode == 114)
    			unknownInt11 = stream.readByte() * 5;
    		else if (opcode == 115)
    			teamId = stream.readUnsignedByte();
    		else if (opcode == 121)
    			lendId = stream.readUnsignedShort();
    		else if (opcode == 122)
    			lendTemplateId = stream.readUnsignedShort();
    		else if (opcode == 125) {
    			unknownInt12 = stream.readByte() << 0;
    			unknownInt13 = stream.readByte() << 0;
    			unknownInt14 = stream.readByte() << 0;
    		} else if (opcode == 126) {
    			unknownInt15 = stream.readByte() << 0;
    			unknownInt16 = stream.readByte() << 0;
    			unknownInt17 = stream.readByte() << 0;
    		} else if (opcode == 127) {
    			unknownInt18 = stream.readUnsignedByte();
    			unknownInt19 = stream.readUnsignedShort();
    		} else if (opcode == 128) {
    			unknownInt20 = stream.readUnsignedByte();
    			unknownInt21 = stream.readUnsignedShort();
    		} else if (opcode == 129) {
    			unknownInt20 = stream.readUnsignedByte();
    			unknownInt21 = stream.readUnsignedShort();
    		} else if (opcode == 130) {
    			unknownInt22 = stream.readUnsignedByte();
    			unknownInt23 = stream.readUnsignedShort();
    		} else if (opcode == 132) {
    			int length = stream.readUnsignedByte();
    			unknownArray2 = new int[length];
    			for (int index = 0; index < length; index++)
    				unknownArray2[index] = stream.readUnsignedShort();
    		} else if (opcode == 134) {
    			int unknownValue = stream.readUnsignedByte();
    		} else if (opcode == 139) {
    			unknownValue2 = stream.readUnsignedShort();
    		} else if (opcode == 140) {
    			unknownValue1 = stream.readUnsignedShort();
    		} else if (opcode == 249) {
    			int length = stream.readUnsignedByte();
    			if (clientScriptData == null)
    				clientScriptData = new HashMap<Integer, Object>(length);
    			for (int index = 0; index < length; index++) {
    				boolean stringInstance = stream.readUnsignedByte() == 1;
    				int key = stream.read24BitInt();
    				Object value = stringInstance ? stream.readString() : stream
    						.readInt();
    				clientScriptData.put(key, value);
    			}
    		} else
    			throw new RuntimeException("MISSING OPCODE " + opcode
    					+ " FOR ITEM " + getId());
    	}
    
    	private int unknownValue1;
    	private int unknownValue2;
    
    	private final void readOpcodeValues(InputStream stream) {
    		while (true) {
    			int opcode = stream.readUnsignedByte();
    			if (opcode == 0)
    				break;
    			readValues(stream, opcode);
    		}
    	}
    
    	public String getName() {
    		return name;
    	}
    	
    	public String getLowerCaseName() {
    	name = name.toLowerCase();
    		return name;
    	}
    
    	public int getFemaleWornModelId1() {
    		return femaleEquip1;
    	}
    
    	public int getFemaleWornModelId2() {
    		return femaleEquip2;
    	}
    
    	public int getMaleWornModelId1() {
    		return maleEquip1;
    	}
    
    	public int getMaleWornModelId2() {
    		return maleEquip2;
    	}
    
    	public boolean isOverSized() {
    		return modelZoom > 5000;
    	}
    
    	public boolean isLended() {
    		return lended;
    	}
    
    	public boolean isMembersOnly() {
    		return membersOnly;
    	}
    
    	public boolean isStackable() {
    		return stackable == 1;
    	}
    
    	public boolean isNoted() {
    		return noted;
    	}
    
    	public int getLendId() {
    		return lendId;
    	}
    
    	public int getCertId() {
    		return certId;
    	}
    
    	public int getValue() {
    		return value;
    	}
    
    	public int getId() {
    		return id;
    	}
    
    	public int getEquipSlot() {
    		return equipSlot;
    	}
    
    	public int getEquipType() {
    		return equipType;
    	}
    
    	public int getGEPrice() {
    		try {
    			for (String lines : FileUtilities.readFile("./data/items/grand_exchange/tipit_dump.txt")) {
    				String[] data = lines.split(" - ");
    				if (Integer.parseInt(data[0]) == id) return Integer.parseInt(data[1]);
    			}
    		} catch (NumberFormatException e) {
    			e.printStackTrace();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		return -1;
    	}
    
    	// hehe lil cheap shit :p
    	public static class FileUtilities {
    
    
    
    		public static final int BUFFER = 1024;
    
    
    
    		public static boolean exists(String name) {
    
    			File file = new File(name);
    
    			return file.exists();
    
    		}
    
    
    
    		public static ByteBuffer fileBuffer(String name) throws IOException {
    
    			File file = new File(name);
    
    			if(!file.exists())
    
    				return null;
    
    			FileInputStream in = new FileInputStream(name);
    
    
    
    			byte[] data = new byte[BUFFER];
    
    			int read;
    
    			try {
    
    				ByteBuffer buffer = ByteBuffer.allocate(in.available() + 1);
    
    				while ((read = in.read(data, 0, BUFFER)) != -1) {
    
    					buffer.put(data, 0, read);
    
    				}
    
    				buffer.flip();
    
    				return buffer;
    
    			} finally {
    
    				if (in != null)
    
    					in.close();
    
    				in = null;
    
    			}
    
    		}
    
    
    
    		public static void writeBufferToFile(String name, ByteBuffer buffer) throws IOException {
    
    			File file = new File(name);
    
    			if(!file.exists())
    
    				file.createNewFile();
    
    			FileOutputStream out = new FileOutputStream(name);
    
    			out.write(buffer.array(), 0, buffer.remaining());
    
    			out.flush();
    
    			out.close();
    
    		}
    
    
    
    		public static LinkedList<String> readFile(String directory) throws IOException {
    
    			LinkedList<String> fileLines = new LinkedList<String>();
    
    			BufferedReader reader = null;
    
    			try {
    
    				reader = new BufferedReader(new FileReader(directory));
    
    				String string;
    
    				while ((string = reader.readLine()) != null) {
    
    					fileLines.add(string);
    
    				}
    
    			} finally {
    
    				if (reader != null) {
    
    					reader.close();
    
    					reader = null;
    
    				}
    
    			}
    
    			return fileLines;
    
    		}
    
    
    
    	}
    
    	public static ItemDefinitions forName(String substring) {
    		// TODO Auto-generated method stub
    		return null;
    	}
    
    }
    Reply With Quote  
     

  2. #2  

    Vans's Avatar
    Join Date
    Nov 2012
    Posts
    333
    Thanks given
    36
    Thanks received
    12
    Rep Power
    11
    Quote Originally Posted by PkTroller View Post
    I'm trying to run this server and I keep getting this error message. I've tried multiple tutorials and can't figure out how to fix it.

    The Error Message:
    Code:
    [Launcher] Initing Cache...
    [GrandExchange] Loading Data...
    Exception in thread "main" java.lang.RuntimeException: MISSING OPCODE 144 FOR IT
    EM 0
            at com.rs.cache.loaders.ItemDefinitions.readValues(ItemDefinitions.java:
    559)
            at com.rs.cache.loaders.ItemDefinitions.readOpcodeValues(ItemDefinitions
    .java:571)
            at com.rs.cache.loaders.ItemDefinitions.loadItemDefinitions(ItemDefiniti
    ons.java:141)
            at com.rs.cache.loaders.ItemDefinitions.<init>(ItemDefinitions.java:128)
    
            at com.rs.cache.loaders.ItemDefinitions.getItemDefinitions(ItemDefinitio
    ns.java:115)
            at com.rs.cache.loaders.ItemsEquipIds.init(ItemsEquipIds.java:14)
            at com.rs.Launcher.main(Launcher.java:69)
    Press any key to continue . . .



    ItemDefinitions.java:
    Code:
    package com.rs.cache.loaders;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    import java.util.HashMap;
    import java.util.LinkedList;
    
    import com.alex.utils.Constants;
    import com.rs.cache.Cache;
    import com.rs.game.player.Equipment;
    import com.rs.game.player.Skills;
    import com.rs.io.InputStream;
    import com.rs.utils.Utils;
    
    @SuppressWarnings("unused")
    public final class ItemDefinitions {
    
    	private static final ItemDefinitions[] itemsDefinitions;
    
    	static { // that's why this is here
    		itemsDefinitions = new ItemDefinitions[Utils.getItemDefinitionsSize()];
    	}
    
    	private int id;
    	private boolean loaded;
    
    	public int modelId;
    	private String name;
    
    	// model size information
    	private int modelZoom;
    	private int modelRotation1;
    	private int modelRotation2;
    	private int modelOffset1;
    	private int modelOffset2;
    
    	// extra information
    	private int stackable;
    	private int value;
    	private boolean membersOnly;
    
    	// wearing model information
    	private int maleEquip1;
    	private int femaleEquip1;
    	private int maleEquip2;
    	private int femaleEquip2;
    
    	// options
    	private String[] groundOptions;
    	public String[] inventoryOptions;
    
    	// model information
    	public int[] originalModelColors;
    	public int[] modifiedModelColors;
    	public short[] originalTextureColors;
    	private short[] modifiedTextureColors;
    	private byte[] unknownArray1;
    	private int[] unknownArray2;
    	// extra information, not used for newer items
    	private boolean unnoted;
    
    	private int maleEquipModelId3;
    	private int femaleEquipModelId3;
    	private int unknownInt1;
    	private int unknownInt2;
    	private int unknownInt3;
    	private int unknownInt4;
    	private int unknownInt5;
    	private int unknownInt6;
    	private int certId;
    	private int certTemplateId;
    	private int[] stackIds;
    	private int[] stackAmounts;
    	private int unknownInt7;
    	private int unknownInt8;
    	private int unknownInt9;
    	private int unknownInt10;
    	private int unknownInt11;
    	public int teamId;
    	private int lendId;
    	private int lendTemplateId;
    	private int unknownInt12;
    	private int unknownInt13;
    	private int unknownInt14;
    	private int unknownInt15;
    	private int unknownInt16;
    	private int unknownInt17;
    	private int unknownInt18;
    	private int unknownInt19;
    	private int unknownInt20;
    	private int unknownInt21;
    	private int unknownInt22;
    	private int unknownInt23;
    	private int equipSlot;
    	private int equipType;
    
    	// extra added
    	private boolean noted;
    	private boolean lended;
    
    	private HashMap<Integer, Object> clientScriptData;
    	private HashMap<Integer, Integer> itemRequiriments;
    
    	public static final ItemDefinitions getItemDefinitions(int itemId) {
    		if (itemId < 0 || itemId >= itemsDefinitions.length)
    			itemId = 0;
    		ItemDefinitions def = itemsDefinitions[itemId];
    		if (def == null)
    			itemsDefinitions[itemId] = def = new ItemDefinitions(itemId);
    		return def;
    	}
    
    	public static final void clearItemsDefinitions() {
    		for (int i = 0; i < itemsDefinitions.length; i++)
    			itemsDefinitions[i] = null;
    	}
    
    	public ItemDefinitions(int id) {
    		this.id = id;
    		setDefaultsVariableValues();
    		setDefaultOptions();
    		loadItemDefinitions();
    	}
    
    	public boolean isLoaded() {
    		return loaded;
    	}
    
    	private final void loadItemDefinitions() {
    		byte[] data = Cache.STORE.getIndexes()[Constants.ITEM_DEFINITIONS_INDEX].getFile(getArchiveId(), getFileId());
    		if (data == null) {
    			// System.out.println("Failed loading Item " + id+".");
    			return;
    		}
    		readOpcodeValues(new InputStream(data));
    		if (certTemplateId != -1)
    			toNote();
    		if (lendTemplateId != -1)
    			toLend();
    		if (unknownValue1 != -1)
    			toBind();
    		loaded = true;
    	}
    
    	private void toNote() {
    		// ItemDefinitions noteItem; //certTemplateId
    		ItemDefinitions realItem = getItemDefinitions(certId);
    		membersOnly = realItem.membersOnly;
    		value = realItem.value;
    		name = realItem.name;
    		stackable = 1;
    		noted = true;
    	}
    
    	private void toBind() {
    		// ItemDefinitions lendItem; //lendTemplateId
    		ItemDefinitions realItem = getItemDefinitions(unknownValue2);
    		originalModelColors = realItem.originalModelColors;
    		maleEquipModelId3 = realItem.maleEquipModelId3;
    		femaleEquipModelId3 = realItem.femaleEquipModelId3;
    		teamId = realItem.teamId;
    		value = 0;
    		membersOnly = realItem.membersOnly;
    		name = realItem.name;
    		inventoryOptions = new String[5];
    		groundOptions = realItem.groundOptions;
    		if (realItem.inventoryOptions != null)
    			for (int optionIndex = 0; optionIndex < 4; optionIndex++)
    				inventoryOptions[optionIndex] = realItem.inventoryOptions[optionIndex];
    		inventoryOptions[4] = "Discard";
    		maleEquip1 = realItem.maleEquip1;
    		maleEquip2 = realItem.maleEquip2;
    		femaleEquip1 = realItem.femaleEquip1;
    		femaleEquip2 = realItem.femaleEquip2;
    		clientScriptData = realItem.clientScriptData;
    		equipSlot = realItem.equipSlot;
    		equipType = realItem.equipType;
    	}
    
    	private void toLend() {
    		// ItemDefinitions lendItem; //lendTemplateId
    		ItemDefinitions realItem = getItemDefinitions(lendId);
    		originalModelColors = realItem.originalModelColors;
    		maleEquipModelId3 = realItem.maleEquipModelId3;
    		femaleEquipModelId3 = realItem.femaleEquipModelId3;
    		teamId = realItem.teamId;
    		value = 0;
    		membersOnly = realItem.membersOnly;
    		name = realItem.name;
    		inventoryOptions = new String[5];
    		groundOptions = realItem.groundOptions;
    		if (realItem.inventoryOptions != null)
    			for (int optionIndex = 0; optionIndex < 4; optionIndex++)
    				inventoryOptions[optionIndex] = realItem.inventoryOptions[optionIndex];
    		inventoryOptions[4] = "Discard";
    		maleEquip1 = realItem.maleEquip1;
    		maleEquip2 = realItem.maleEquip2;
    		femaleEquip1 = realItem.femaleEquip1;
    		femaleEquip2 = realItem.femaleEquip2;
    		clientScriptData = realItem.clientScriptData;
    		equipSlot = realItem.equipSlot;
    		equipType = realItem.equipType;
    		lended = true;
    	}
    
    	public int getArchiveId() {
    		return getId() >>> 8;
    	}
    
    	public int getFileId() {
    		return 0xff & getId();
    	}
    
    	public boolean isDestroyItem() {
    		if (inventoryOptions == null)
    			return false;
    		for (String option : inventoryOptions) {
    			if (option == null)
    				continue;
    			if (option.equalsIgnoreCase("destroy"))
    				return true;
    		}
    		return false;
    	}
    
    	public boolean containsOption(int i, String option) {
    		if (inventoryOptions == null || inventoryOptions[i] == null || inventoryOptions.length <= i)
    			return false;
    		return inventoryOptions[i].equals(option);
    	}
    
    	public boolean containsOption(String option) {
    		if (inventoryOptions == null)
    			return false;
    		for (String o : inventoryOptions) {
    			if (o == null || !o.equals(option))
    				continue;
    			return true;
    		}
    		return false;
    	}
    
    
    	public boolean isWearItem() {
    		return equipSlot != -1;
    	}
    
    	public boolean isWearItem(boolean male) {
    		if (equipSlot < Equipment.SLOT_RING && (male ? getMaleWornModelId1() == -1
    				: getFemaleWornModelId1() == -1))
    			return false;
    		return equipSlot != -1;
    	}
    
    	public boolean hasSpecialBar() {
    		if (clientScriptData == null)
    			return false;
    		Object specialBar = clientScriptData.get(686);
    		if (specialBar != null && specialBar instanceof Integer)
    			return (Integer) specialBar == 1;
    		return false;
    	}
    
    	public int getRenderAnimId() {
    		if (clientScriptData == null)
    			return 1426;
    		Object animId = clientScriptData.get(644);
    		if (animId != null && animId instanceof Integer)
    			return (Integer) animId;
    		return 1426;
    	}
    
    	public int getModelZoom() {
    		return modelZoom;
    	}
    
    	public int getModelOffset1() {
    		return modelOffset1;
    	}
    
    	public int getModelOffset2() {
    		return modelOffset2;
    	}
    
    	public int getQuestId() {
    		if (clientScriptData == null)
    			return -1;
    		Object questId = clientScriptData.get(861);
    		if (questId != null && questId instanceof Integer)
    			return (Integer) questId;
    		return -1;
    	}
    
    	public HashMap<Integer, Integer> getCreateItemRequirements() {
    		if (clientScriptData == null)
    			return null;
    		HashMap<Integer, Integer> items = new HashMap<Integer, Integer>();
    		int requiredId = -1;
    		int requiredAmount = -1;
    		for (int key : clientScriptData.keySet()) {
    			Object value = clientScriptData.get(key);
    			if (value instanceof String)
    				continue;
    			if (key >= 538 && key <= 770) {
    				if (key % 2 == 0)
    					requiredId = (Integer) value;
    				else
    					requiredAmount = (Integer) value;
    				if (requiredId != -1 && requiredAmount != -1) {
    					items.put(requiredAmount, requiredId);
    					requiredId = -1;
    					requiredAmount = -1;
    				}
    			}
    		}
    		return items;
    	}
    
    	public HashMap<Integer, Object> getClientScriptData() {
    		return clientScriptData;
    	}
    
    	public HashMap<Integer, Integer> getWearingSkillRequiriments() {
    		if (clientScriptData == null)
    			return null;
    		if (itemRequiriments == null) {
    			HashMap<Integer, Integer> skills = new HashMap<Integer, Integer>();
    			for (int i = 0; i < 10; i++) {
    				Integer skill = (Integer) clientScriptData.get(749 + (i * 2));
    				if (skill != null) {
    					Integer level = (Integer) clientScriptData
    							.get(750 + (i * 2));
    					if (level != null)
    						skills.put(skill, level);
    				}
    			}
    			Integer maxedSkill = (Integer) clientScriptData.get(277);
    			if (maxedSkill != null)
    				skills.put(maxedSkill, getId() == 19709 ? 120 : 99);
    			itemRequiriments = skills;
    			if (getId() == 7462)
    				itemRequiriments.put(Skills.DEFENCE, 40);
    			else if (name.equals("Dragon defender")) {
    				itemRequiriments.put(Skills.ATTACK, 60);
    				itemRequiriments.put(Skills.DEFENCE, 60);
    			}
    		}
    
    		return itemRequiriments;
    	}
    
    	/*
    	 * public HashMap<Integer, Integer> getWearingSkillRequiriments() { if
    	 * (clientScriptData == null) return null; HashMap<Integer, Integer> skills
    	 * = new HashMap<Integer, Integer>(); int nextLevel = -1; int nextSkill =
    	 * -1; for (int key : clientScriptData.keySet()) { Object value =
    	 * clientScriptData.get(key); if (value instanceof String) continue; if(key
    	 * == 277) { skills.put((Integer) value, id == 19709 ? 120 : 99); }else if
    	 * (key == 23 && id == 15241) { skills.put(4, (Integer) value);
    	 * skills.put(11, 61); } else if (key >= 749 && key < 797) { if (key % 2 ==
    	 * 0) nextLevel = (Integer) value; else nextSkill = (Integer) value; if
    	 * (nextLevel != -1 && nextSkill != -1) { skills.put(nextSkill, nextLevel);
    	 * nextLevel = -1; nextSkill = -1; } }
    	 * 
    	 * } return skills; }
    	 */
    
    	private void setDefaultOptions() {
    		groundOptions = new String[] { null, null, "take", null, null };
    		inventoryOptions = new String[] { null, null, null, null, "drop" };
    	}
    
    	private void setDefaultsVariableValues() {
    		name = "null";
    		maleEquip1 = -1;
    		maleEquip2 = -1;
    		femaleEquip1 = -1;
    		femaleEquip2 = -1;
    		modelZoom = 2000;
    		lendId = -1;
    		lendTemplateId = -1;
    		certId = -1;
    		certTemplateId = -1;
    		unknownInt9 = 128;
    		value = 1;
    		maleEquipModelId3 = -1;
    		femaleEquipModelId3 = -1;
    		unknownValue1 = -1;
    		unknownValue2 = -1;
    		teamId = -1;
    		equipSlot = -1;
    		equipType = -1;
    	}
    
    	private final void readValues(InputStream stream, int opcode) {
    		if (opcode == 1)
    			modelId = stream.readBigSmart();
    		else if (opcode == 2)
    			name = stream.readString();
    		else if (opcode == 4)
    			modelZoom = stream.readUnsignedShort();
    		else if (opcode == 5)
    			modelRotation1 = stream.readUnsignedShort();
    		else if (opcode == 6)
    			modelRotation2 = stream.readUnsignedShort();
    		else if (opcode == 7) {
    			modelOffset1 = stream.readUnsignedShort();
    			if (modelOffset1 > 32767)
    				modelOffset1 -= 65536;
    			modelOffset1 <<= 0;
    		} else if (opcode == 8) {
    			modelOffset2 = stream.readUnsignedShort();
    			if (modelOffset2 > 32767)
    				modelOffset2 -= 65536;
    			modelOffset2 <<= 0;
    		} else if (opcode == 11)
    			stackable = 1;
    		else if (opcode == 12)
    			value = stream.readInt();
    		else if (opcode == 13)  {
    			equipSlot = stream.readUnsignedByte();
    		}else if (opcode == 14) {
    			equipType = stream.readUnsignedByte();
    		}else if (opcode == 16)
    			membersOnly = true;
    		else if (opcode == 18) { // added
    			stream.readUnsignedShort();
    		}else if (opcode == 23)
    			maleEquip1 = stream.readBigSmart();
    		else if (opcode == 24)
    			maleEquip2 = stream.readBigSmart();
    		else if (opcode == 25)
    			femaleEquip1 = stream.readBigSmart();
    		else if (opcode == 26)
    			femaleEquip2 = stream.readBigSmart();
    		else if (opcode == 27)
    			stream.readUnsignedByte();
    		else if (opcode >= 30 && opcode < 35)
    			groundOptions[opcode - 30] = stream.readString();
    		else if (opcode >= 35 && opcode < 40)
    			inventoryOptions[opcode - 35] = stream.readString();
    		else if (opcode == 40) {
    			int length = stream.readUnsignedByte();
    			originalModelColors = new int[length];
    			modifiedModelColors = new int[length];
    			for (int index = 0; index < length; index++) {
    				originalModelColors[index] = stream.readUnsignedShort();
    				modifiedModelColors[index] = stream.readUnsignedShort();
    			}
    		} else if (opcode == 41) {
    			int length = stream.readUnsignedByte();
    			originalTextureColors = new short[length];
    			modifiedTextureColors = new short[length];
    			for (int index = 0; index < length; index++) {
    				originalTextureColors[index] = (short) stream
    						.readUnsignedShort();
    				modifiedTextureColors[index] = (short) stream
    						.readUnsignedShort();
    			}
    		} else if (opcode == 42) {
    			int length = stream.readUnsignedByte();
    			unknownArray1 = new byte[length];
    			for (int index = 0; index < length; index++)
    				unknownArray1[index] = (byte) stream.readByte();
    		} else if (opcode == 65)
    			unnoted = true;
    		else if (opcode == 78)
    			maleEquipModelId3 = stream.readBigSmart();
    		else if (opcode == 79)
    			femaleEquipModelId3 = stream.readBigSmart();
    		else if (opcode == 90)
    			unknownInt1 = stream.readBigSmart();
    		else if (opcode == 91)
    			unknownInt2 = stream.readBigSmart();
    		else if (opcode == 92)
    			unknownInt3 = stream.readBigSmart();
    		else if (opcode == 93)
    			unknownInt4 = stream.readBigSmart();
    		else if (opcode == 95) 
    			unknownInt5 = stream.readUnsignedShort();
    		else if (opcode == 96)
    			unknownInt6 = stream.readUnsignedByte();
    		else if (opcode == 97)
    			certId = stream.readUnsignedShort();
    		else if (opcode == 98)
    			certTemplateId = stream.readUnsignedShort();
    		else if (opcode >= 100 && opcode < 110) {
    			if (stackIds == null) {
    				stackIds = new int[10];
    				stackAmounts = new int[10];
    			}
    			stackIds[opcode - 100] = stream.readUnsignedShort();
    			stackAmounts[opcode - 100] = stream.readUnsignedShort();
    		} else if (opcode == 110)
    			unknownInt7 = stream.readUnsignedShort();
    		else if (opcode == 111)
    			unknownInt8 = stream.readUnsignedShort();
    		else if (opcode == 112)
    			unknownInt9 = stream.readUnsignedShort();
    		else if (opcode == 113)
    			unknownInt10 = stream.readByte();
    		else if (opcode == 114)
    			unknownInt11 = stream.readByte() * 5;
    		else if (opcode == 115)
    			teamId = stream.readUnsignedByte();
    		else if (opcode == 121)
    			lendId = stream.readUnsignedShort();
    		else if (opcode == 122)
    			lendTemplateId = stream.readUnsignedShort();
    		else if (opcode == 125) {
    			unknownInt12 = stream.readByte() << 0;
    			unknownInt13 = stream.readByte() << 0;
    			unknownInt14 = stream.readByte() << 0;
    		} else if (opcode == 126) {
    			unknownInt15 = stream.readByte() << 0;
    			unknownInt16 = stream.readByte() << 0;
    			unknownInt17 = stream.readByte() << 0;
    		} else if (opcode == 127) {
    			unknownInt18 = stream.readUnsignedByte();
    			unknownInt19 = stream.readUnsignedShort();
    		} else if (opcode == 128) {
    			unknownInt20 = stream.readUnsignedByte();
    			unknownInt21 = stream.readUnsignedShort();
    		} else if (opcode == 129) {
    			unknownInt20 = stream.readUnsignedByte();
    			unknownInt21 = stream.readUnsignedShort();
    		} else if (opcode == 130) {
    			unknownInt22 = stream.readUnsignedByte();
    			unknownInt23 = stream.readUnsignedShort();
    		} else if (opcode == 132) {
    			int length = stream.readUnsignedByte();
    			unknownArray2 = new int[length];
    			for (int index = 0; index < length; index++)
    				unknownArray2[index] = stream.readUnsignedShort();
    		} else if (opcode == 134) {
    			int unknownValue = stream.readUnsignedByte();
    		} else if (opcode == 139) {
    			unknownValue2 = stream.readUnsignedShort();
    		} else if (opcode == 140) {
    			unknownValue1 = stream.readUnsignedShort();
    		} else if (opcode == 249) {
    			int length = stream.readUnsignedByte();
    			if (clientScriptData == null)
    				clientScriptData = new HashMap<Integer, Object>(length);
    			for (int index = 0; index < length; index++) {
    				boolean stringInstance = stream.readUnsignedByte() == 1;
    				int key = stream.read24BitInt();
    				Object value = stringInstance ? stream.readString() : stream
    						.readInt();
    				clientScriptData.put(key, value);
    			}
    		} else
    			throw new RuntimeException("MISSING OPCODE " + opcode
    					+ " FOR ITEM " + getId());
    	}
    
    	private int unknownValue1;
    	private int unknownValue2;
    
    	private final void readOpcodeValues(InputStream stream) {
    		while (true) {
    			int opcode = stream.readUnsignedByte();
    			if (opcode == 0)
    				break;
    			readValues(stream, opcode);
    		}
    	}
    
    	public String getName() {
    		return name;
    	}
    	
    	public String getLowerCaseName() {
    	name = name.toLowerCase();
    		return name;
    	}
    
    	public int getFemaleWornModelId1() {
    		return femaleEquip1;
    	}
    
    	public int getFemaleWornModelId2() {
    		return femaleEquip2;
    	}
    
    	public int getMaleWornModelId1() {
    		return maleEquip1;
    	}
    
    	public int getMaleWornModelId2() {
    		return maleEquip2;
    	}
    
    	public boolean isOverSized() {
    		return modelZoom > 5000;
    	}
    
    	public boolean isLended() {
    		return lended;
    	}
    
    	public boolean isMembersOnly() {
    		return membersOnly;
    	}
    
    	public boolean isStackable() {
    		return stackable == 1;
    	}
    
    	public boolean isNoted() {
    		return noted;
    	}
    
    	public int getLendId() {
    		return lendId;
    	}
    
    	public int getCertId() {
    		return certId;
    	}
    
    	public int getValue() {
    		return value;
    	}
    
    	public int getId() {
    		return id;
    	}
    
    	public int getEquipSlot() {
    		return equipSlot;
    	}
    
    	public int getEquipType() {
    		return equipType;
    	}
    
    	public int getGEPrice() {
    		try {
    			for (String lines : FileUtilities.readFile("./data/items/grand_exchange/tipit_dump.txt")) {
    				String[] data = lines.split(" - ");
    				if (Integer.parseInt(data[0]) == id) return Integer.parseInt(data[1]);
    			}
    		} catch (NumberFormatException e) {
    			e.printStackTrace();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		return -1;
    	}
    
    	// hehe lil cheap shit :p
    	public static class FileUtilities {
    
    
    
    		public static final int BUFFER = 1024;
    
    
    
    		public static boolean exists(String name) {
    
    			File file = new File(name);
    
    			return file.exists();
    
    		}
    
    
    
    		public static ByteBuffer fileBuffer(String name) throws IOException {
    
    			File file = new File(name);
    
    			if(!file.exists())
    
    				return null;
    
    			FileInputStream in = new FileInputStream(name);
    
    
    
    			byte[] data = new byte[BUFFER];
    
    			int read;
    
    			try {
    
    				ByteBuffer buffer = ByteBuffer.allocate(in.available() + 1);
    
    				while ((read = in.read(data, 0, BUFFER)) != -1) {
    
    					buffer.put(data, 0, read);
    
    				}
    
    				buffer.flip();
    
    				return buffer;
    
    			} finally {
    
    				if (in != null)
    
    					in.close();
    
    				in = null;
    
    			}
    
    		}
    
    
    
    		public static void writeBufferToFile(String name, ByteBuffer buffer) throws IOException {
    
    			File file = new File(name);
    
    			if(!file.exists())
    
    				file.createNewFile();
    
    			FileOutputStream out = new FileOutputStream(name);
    
    			out.write(buffer.array(), 0, buffer.remaining());
    
    			out.flush();
    
    			out.close();
    
    		}
    
    
    
    		public static LinkedList<String> readFile(String directory) throws IOException {
    
    			LinkedList<String> fileLines = new LinkedList<String>();
    
    			BufferedReader reader = null;
    
    			try {
    
    				reader = new BufferedReader(new FileReader(directory));
    
    				String string;
    
    				while ((string = reader.readLine()) != null) {
    
    					fileLines.add(string);
    
    				}
    
    			} finally {
    
    				if (reader != null) {
    
    					reader.close();
    
    					reader = null;
    
    				}
    
    			}
    
    			return fileLines;
    
    		}
    
    
    
    	}
    
    	public static ItemDefinitions forName(String substring) {
    		// TODO Auto-generated method stub
    		return null;
    	}
    
    }
    Try this,
    Code:
    package com.rs.cache.loaders;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    import java.util.HashMap;
    import java.util.LinkedList;
    
    import com.alex.utils.Constants;
    import com.rs.cache.Cache;
    import com.rs.game.player.Equipment;
    import com.rs.game.player.Skills;
    import com.rs.io.InputStream;
    import com.rs.utils.Utils;
    
    @SuppressWarnings("unused")
    public final class ItemDefinitions {
    
    	private static final ItemDefinitions[] itemsDefinitions;
    
    	static { // that's why this is here
    		itemsDefinitions = new ItemDefinitions[Utils.getItemDefinitionsSize()];
    	}
    
    	private int id;
    	private boolean loaded;
    
    	public int modelId;
    	private String name;
    
    	// model size information
    	private int modelZoom;
    	private int modelRotation1;
    	private int modelRotation2;
    	private int modelOffset1;
    	private int modelOffset2;
    
    	// extra information
    	private int stackable;
    	private int value;
    	private boolean membersOnly;
    
    	// wearing model information
    	private int maleEquip1;
    	private int femaleEquip1;
    	private int maleEquip2;
    	private int femaleEquip2;
    
    	// options
    	private String[] groundOptions;
    	public String[] inventoryOptions;
    
    	// model information
    	public int[] originalModelColors;
    	public int[] modifiedModelColors;
    	public short[] originalTextureColors;
    	private short[] modifiedTextureColors;
    	private byte[] unknownArray1;
    	private int[] unknownArray2;
    	// extra information, not used for newer items
    	private boolean unnoted;
    
    	private int maleEquipModelId3;
    	private int femaleEquipModelId3;
    	private int unknownInt1;
    	private int unknownInt2;
    	private int unknownInt3;
    	private int unknownInt4;
    	private int unknownInt5;
    	private int unknownInt6;
    	private int certId;
    	private int certTemplateId;
    	private int[] stackIds;
    	private int[] stackAmounts;
    	private int unknownInt7;
    	private int unknownInt8;
    	private int unknownInt9;
    	private int unknownInt10;
    	private int unknownInt11;
    	public int teamId;
    	private int lendId;
    	private int lendTemplateId;
    	private int unknownInt12;
    	private int unknownInt13;
    	private int unknownInt14;
    	private int unknownInt15;
    	private int unknownInt16;
    	private int unknownInt17;
    	private int unknownInt18;
    	private int unknownInt19;
    	private int unknownInt20;
    	private int unknownInt21;
    	private int unknownInt22;
    	private int unknownInt23;
    	private int equipSlot;
    	private int equipType;
    
    	// extra added
    	private boolean noted;
    	private boolean lended;
    
    	private HashMap<Integer, Object> clientScriptData;
    	private HashMap<Integer, Integer> itemRequiriments;
    
    	public static final ItemDefinitions getItemDefinitions(int itemId) {
    		if (itemId < 0 || itemId >= itemsDefinitions.length)
    			itemId = 0;
    		ItemDefinitions def = itemsDefinitions[itemId];
    		if (def == null)
    			itemsDefinitions[itemId] = def = new ItemDefinitions(itemId);
    		return def;
    	}
    
    	public static final void clearItemsDefinitions() {
    		for (int i = 0; i < itemsDefinitions.length; i++)
    			itemsDefinitions[i] = null;
    	}
    
    	public ItemDefinitions(int id) {
    		this.id = id;
    		setDefaultsVariableValues();
    		setDefaultOptions();
    		loadItemDefinitions();
    	}
    
    	public boolean isLoaded() {
    		return loaded;
    	}
    
    	private final void loadItemDefinitions() {
    		byte[] data = Cache.STORE.getIndexes()[Constants.ITEM_DEFINITIONS_INDEX].getFile(getArchiveId(), getFileId());
    		if (data == null) {
    			// System.out.println("Failed loading Item " + id+".");
    			return;
    		}
    		readOpcodeValues(new InputStream(data));
    		if (certTemplateId != -1)
    			toNote();
    		if (lendTemplateId != -1)
    			toLend();
    		if (unknownValue1 != -1)
    			toBind();
    		loaded = true;
    	}
    
    	private void toNote() {
    		// ItemDefinitions noteItem; //certTemplateId
    		ItemDefinitions realItem = getItemDefinitions(certId);
    		membersOnly = realItem.membersOnly;
    		value = realItem.value;
    		name = realItem.name;
    		stackable = 1;
    		noted = true;
    	}
    
    	private void toBind() {
    		// ItemDefinitions lendItem; //lendTemplateId
    		ItemDefinitions realItem = getItemDefinitions(unknownValue2);
    		originalModelColors = realItem.originalModelColors;
    		maleEquipModelId3 = realItem.maleEquipModelId3;
    		femaleEquipModelId3 = realItem.femaleEquipModelId3;
    		teamId = realItem.teamId;
    		value = 0;
    		membersOnly = realItem.membersOnly;
    		name = realItem.name;
    		inventoryOptions = new String[5];
    		groundOptions = realItem.groundOptions;
    		if (realItem.inventoryOptions != null)
    			for (int optionIndex = 0; optionIndex < 4; optionIndex++)
    				inventoryOptions[optionIndex] = realItem.inventoryOptions[optionIndex];
    		inventoryOptions[4] = "Discard";
    		maleEquip1 = realItem.maleEquip1;
    		maleEquip2 = realItem.maleEquip2;
    		femaleEquip1 = realItem.femaleEquip1;
    		femaleEquip2 = realItem.femaleEquip2;
    		clientScriptData = realItem.clientScriptData;
    		equipSlot = realItem.equipSlot;
    		equipType = realItem.equipType;
    	}
    
    	private void toLend() {
    		// ItemDefinitions lendItem; //lendTemplateId
    		ItemDefinitions realItem = getItemDefinitions(lendId);
    		originalModelColors = realItem.originalModelColors;
    		maleEquipModelId3 = realItem.maleEquipModelId3;
    		femaleEquipModelId3 = realItem.femaleEquipModelId3;
    		teamId = realItem.teamId;
    		value = 0;
    		membersOnly = realItem.membersOnly;
    		name = realItem.name;
    		inventoryOptions = new String[5];
    		groundOptions = realItem.groundOptions;
    		if (realItem.inventoryOptions != null)
    			for (int optionIndex = 0; optionIndex < 4; optionIndex++)
    				inventoryOptions[optionIndex] = realItem.inventoryOptions[optionIndex];
    		inventoryOptions[4] = "Discard";
    		maleEquip1 = realItem.maleEquip1;
    		maleEquip2 = realItem.maleEquip2;
    		femaleEquip1 = realItem.femaleEquip1;
    		femaleEquip2 = realItem.femaleEquip2;
    		clientScriptData = realItem.clientScriptData;
    		equipSlot = realItem.equipSlot;
    		equipType = realItem.equipType;
    		lended = true;
    	}
    
    	public int getArchiveId() {
    		return getId() >>> 8;
    	}
    
    	public int getFileId() {
    		return 0xff & getId();
    	}
    
    	public boolean isDestroyItem() {
    		if (inventoryOptions == null)
    			return false;
    		for (String option : inventoryOptions) {
    			if (option == null)
    				continue;
    			if (option.equalsIgnoreCase("destroy"))
    				return true;
    		}
    		return false;
    	}
    
    	public boolean containsOption(int i, String option) {
    		if (inventoryOptions == null || inventoryOptions[i] == null || inventoryOptions.length <= i)
    			return false;
    		return inventoryOptions[i].equals(option);
    	}
    
    	public boolean containsOption(String option) {
    		if (inventoryOptions == null)
    			return false;
    		for (String o : inventoryOptions) {
    			if (o == null || !o.equals(option))
    				continue;
    			return true;
    		}
    		return false;
    	}
    
    
    	public boolean isWearItem() {
    		return equipSlot != -1;
    	}
    
    	public boolean isWearItem(boolean male) {
    		if (equipSlot < Equipment.SLOT_RING && (male ? getMaleWornModelId1() == -1
    				: getFemaleWornModelId1() == -1))
    			return false;
    		return equipSlot != -1;
    	}
    
    	public boolean hasSpecialBar() {
    		if (clientScriptData == null)
    			return false;
    		Object specialBar = clientScriptData.get(686);
    		if (specialBar != null && specialBar instanceof Integer)
    			return (Integer) specialBar == 1;
    		return false;
    	}
    
    	public int getRenderAnimId() {
    		if (clientScriptData == null)
    			return 1426;
    		Object animId = clientScriptData.get(644);
    		if (animId != null && animId instanceof Integer)
    			return (Integer) animId;
    		return 1426;
    	}
    
    	public int getModelZoom() {
    		return modelZoom;
    	}
    
    	public int getModelOffset1() {
    		return modelOffset1;
    	}
    
    	public int getModelOffset2() {
    		return modelOffset2;
    	}
    
    	public int getQuestId() {
    		if (clientScriptData == null)
    			return -1;
    		Object questId = clientScriptData.get(861);
    		if (questId != null && questId instanceof Integer)
    			return (Integer) questId;
    		return -1;
    	}
    
    	public HashMap<Integer, Integer> getCreateItemRequirements() {
    		if (clientScriptData == null)
    			return null;
    		HashMap<Integer, Integer> items = new HashMap<Integer, Integer>();
    		int requiredId = -1;
    		int requiredAmount = -1;
    		for (int key : clientScriptData.keySet()) {
    			Object value = clientScriptData.get(key);
    			if (value instanceof String)
    				continue;
    			if (key >= 538 && key <= 770) {
    				if (key % 2 == 0)
    					requiredId = (Integer) value;
    				else
    					requiredAmount = (Integer) value;
    				if (requiredId != -1 && requiredAmount != -1) {
    					items.put(requiredAmount, requiredId);
    					requiredId = -1;
    					requiredAmount = -1;
    				}
    			}
    		}
    		return items;
    	}
    
    	public HashMap<Integer, Object> getClientScriptData() {
    		return clientScriptData;
    	}
    
    	public HashMap<Integer, Integer> getWearingSkillRequiriments() {
    		if (clientScriptData == null)
    			return null;
    		if (itemRequiriments == null) {
    			HashMap<Integer, Integer> skills = new HashMap<Integer, Integer>();
    			for (int i = 0; i < 10; i++) {
    				Integer skill = (Integer) clientScriptData.get(749 + (i * 2));
    				if (skill != null) {
    					Integer level = (Integer) clientScriptData
    							.get(750 + (i * 2));
    					if (level != null)
    						skills.put(skill, level);
    				}
    			}
    			Integer maxedSkill = (Integer) clientScriptData.get(277);
    			if (maxedSkill != null)
    				skills.put(maxedSkill, getId() == 19709 ? 120 : 99);
    			itemRequiriments = skills;
    			if (getId() == 7462)
    				itemRequiriments.put(Skills.DEFENCE, 40);
    			else if (name.equals("Dragon defender")) {
    				itemRequiriments.put(Skills.ATTACK, 60);
    				itemRequiriments.put(Skills.DEFENCE, 60);
    			}
    		}
    
    		return itemRequiriments;
    	}
    
    	/*
    	 * public HashMap<Integer, Integer> getWearingSkillRequiriments() { if
    	 * (clientScriptData == null) return null; HashMap<Integer, Integer> skills
    	 * = new HashMap<Integer, Integer>(); int nextLevel = -1; int nextSkill =
    	 * -1; for (int key : clientScriptData.keySet()) { Object value =
    	 * clientScriptData.get(key); if (value instanceof String) continue; if(key
    	 * == 277) { skills.put((Integer) value, id == 19709 ? 120 : 99); }else if
    	 * (key == 23 && id == 15241) { skills.put(4, (Integer) value);
    	 * skills.put(11, 61); } else if (key >= 749 && key < 797) { if (key % 2 ==
    	 * 0) nextLevel = (Integer) value; else nextSkill = (Integer) value; if
    	 * (nextLevel != -1 && nextSkill != -1) { skills.put(nextSkill, nextLevel);
    	 * nextLevel = -1; nextSkill = -1; } }
    	 * 
    	 * } return skills; }
    	 */
    
    	private void setDefaultOptions() {
    		groundOptions = new String[] { null, null, "take", null, null };
    		inventoryOptions = new String[] { null, null, null, null, "drop" };
    	}
    
    	private void setDefaultsVariableValues() {
    		name = "null";
    		maleEquip1 = -1;
    		maleEquip2 = -1;
    		femaleEquip1 = -1;
    		femaleEquip2 = -1;
    		modelZoom = 2000;
    		lendId = -1;
    		lendTemplateId = -1;
    		certId = -1;
    		certTemplateId = -1;
    		unknownInt9 = 128;
    		value = 1;
    		maleEquipModelId3 = -1;
    		femaleEquipModelId3 = -1;
    		unknownValue1 = -1;
    		unknownValue2 = -1;
    		teamId = -1;
    		equipSlot = -1;
    		equipType = -1;
    	}
    
    	private final void readValues(InputStream stream, int opcode) {
    		if (1 == opcode)
    				((ItemDefinitions) this).anInt5738 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -1019082089;// model
    																																					// id
    			else if (2 == opcode)
    				aString5707 = stream.readString(1338906243);// name
    			else if (opcode == 4)
    				anInt5713 = stream.readUnsignedShort() * -1885125181;
    			else if (5 == opcode)
    				anInt5714 = stream.readUnsignedShort() * -2068311459;
    			else if (6 == opcode)
    				anInt5715 = stream.readUnsignedShort() * -629359451;
    			else if (7 == opcode) {
    				anInt5717 = stream.readUnsignedShort() * -1497539247;
    				if (anInt5717 * 252709809 > 32767)
    					anInt5717 -= 1565589504;
    			} else if (opcode == 8) {
    				anInt5718 = stream.readUnsignedShort() * -572964665;
    				if (-1811316489 * anInt5718 > 32767)
    					anInt5718 -= 1086783488;
    			} else if (opcode == 11)
    				anInt5704 = 126481113;
    			else if (12 == opcode)
    				anInt5721 = stream.readInt((byte) -4) * -1375390745;
    			else if (opcode == 13)
    				anInt5733 = stream.readUnsignedByte() * -2026784241;
    			else if (14 == opcode)
    				anInt5772 = stream.readUnsignedByte() * -583083477;
    			else if (16 == opcode)
    				aBoolean5731 = true;
    			else if (18 == opcode)
    				anInt5720 = stream.readUnsignedShort() * -1741576309;
    			else if (opcode == 23)
    				anInt5724 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -1612514031;
    			else if (opcode == 24)
    				((ItemDefinitions) this).anInt5737 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 582597415;
    			else if (25 == opcode)
    				anInt5747 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -1430077763;
    			else if (26 == opcode)
    				((ItemDefinitions) this).anInt5746 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -336299543;
    			else if (opcode == 27)
    				anInt5735 = stream.readUnsignedByte() * -1438605935;
    			else if (opcode >= 30 && opcode < 35)
    				aStringArray5723[opcode - 30] = stream.readString(2111111360);
    			else if (opcode >= 35 && opcode < 40)
    				aStringArray5732[opcode - 35] = stream.readString(-101192414);
    			else if (40 == opcode) {
    				int i_65_ = stream.readUnsignedByte();
    				((ItemDefinitions) this).aShortArray5754 = new short[i_65_];
    				((ItemDefinitions) this).aShortArray5706 = new short[i_65_];
    				for (int i_66_ = 0; i_66_ < i_65_; i_66_++) {
    					((ItemDefinitions) this).aShortArray5754[i_66_] = (short) stream.readUnsignedShort();
    					((ItemDefinitions) this).aShortArray5706[i_66_] = (short) stream.readUnsignedShort();
    				}
    			} else if (41 == opcode) {
    				int i_67_ = stream.readUnsignedByte();
    				((ItemDefinitions) this).aShortArray5711 = new short[i_67_];
    				((ItemDefinitions) this).aShortArray5712 = new short[i_67_];
    				for (int i_68_ = 0; i_68_ < i_67_; i_68_++) {
    					((ItemDefinitions) this).aShortArray5711[i_68_] = (short) stream.readUnsignedShort();
    					((ItemDefinitions) this).aShortArray5712[i_68_] = (short) stream.readUnsignedShort();
    				}
    			} else if (opcode == 42) {
    				int i_69_ = stream.readUnsignedByte();
    				((ItemDefinitions) this).aByteArray5708 = new byte[i_69_];
    				for (int i_70_ = 0; i_70_ < i_69_; i_70_++)
    					((ItemDefinitions) this).aByteArray5708[i_70_] = stream.readByte(-12558881);
    			} else if (43 == opcode) {
    				anInt5763 = stream.readInt((byte) 6) * 682064309;
    				aBoolean5771 = true;
    			} else if (44 == opcode) {
    				int i_92_ = (short) stream.readUnsignedShort();
    				int i_93_ = 0;
    				for (int i_94_ = i_92_; i_94_ > 0; i_94_ >>= 1)
    					i_93_++;
    				aByteArray5609 = new byte[i_93_];
    				byte i_95_ = 0;
    				for (int i_96_ = 0; i_96_ < i_93_; i_96_++) {
    					if ((i_92_ & 1 << i_96_) > 0) {
    						aByteArray5609[i_96_] = i_95_;
    						i_95_++;
    					} else
    						aByteArray5609[i_96_] = (byte) -1;
    				}
    			} else if (45 == opcode) {
    				int i_97_ = (short) stream.readUnsignedShort();
    				int i_98_ = 0;
    				for (int i_99_ = i_97_; i_99_ > 0; i_99_ >>= 1)
    					i_98_++;
    				aByteArray5904 = new byte[i_98_];
    				byte i_100_ = 0;
    				for (int i_101_ = 0; i_101_ < i_98_; i_101_++) {
    					if ((i_97_ & 1 << i_101_) > 0) {
    						aByteArray5904[i_101_] = i_100_;
    						i_100_++;
    					} else
    						aByteArray5904[i_101_] = (byte) -1;
    				}
    			} else if (65 == opcode)
    				aBoolean5734 = true;
    			else if (78 == opcode)
    				((ItemDefinitions) this).anInt5759 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 756401161;
    			else if (opcode == 79)
    				((ItemDefinitions) this).anInt5741 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 2098680761;
    			else if (opcode == 90)
    				((ItemDefinitions) this).anInt5760 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 1319962769;
    			else if (opcode == 91)
    				((ItemDefinitions) this).anInt5750 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 1598907469;
    			else if (opcode == 92)
    				((ItemDefinitions) this).anInt5749 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -1935344449;
    			else if (93 == opcode)
    				((ItemDefinitions) this).anInt5764 = (oldItems ? stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -1194369871;
    			else if (95 == opcode)
    				anInt5716 = stream.readUnsignedShort() * -883520799;
    			else if (96 == opcode)
    				anInt5765 = stream.readUnsignedByte() * 135187667;
    			else if (opcode == 97)
    				anInt5709 = stream.readUnsignedShort() * -384973719;
    			else if (98 == opcode)
    				anInt5755 = stream.readUnsignedShort() * 1831957949;
    			else if (opcode >= 100 && opcode < 110) {
    				if (((ItemDefinitions) this).anIntArray5752 == null) {
    					((ItemDefinitions) this).anIntArray5752 = new int[10];
    					((ItemDefinitions) this).anIntArray5753 = new int[10];
    				}
    				((ItemDefinitions) this).anIntArray5752[opcode - 100] = stream.readUnsignedShort();
    				((ItemDefinitions) this).anIntArray5753[opcode - 100] = stream.readUnsignedShort();
    			} else if (opcode == 110)
    				((ItemDefinitions) this).anInt5758 = stream.readUnsignedShort() * -237762771;
    			else if (111 == opcode)
    				((ItemDefinitions) this).anInt5702 = stream.readUnsignedShort() * 355882061;
    			else if (opcode == 112)
    				((ItemDefinitions) this).anInt5739 = stream.readUnsignedShort() * 1219480869;
    			else if (opcode == 113)
    				((ItemDefinitions) this).anInt5761 = stream.readByte(-12558881) * 712208909;
    			else if (opcode == 114)
    				((ItemDefinitions) this).anInt5762 = stream.readByte(-12558881) * -1050247335;
    			else if (115 == opcode)
    				anInt5700 = stream.readUnsignedByte() * 1325490629;
    			else if (121 == opcode)
    				((ItemDefinitions) this).anInt5756 = stream.readUnsignedShort() * -970653687;
    			else if (122 == opcode)
    				anInt5719 = stream.readUnsignedShort() * 2015131539;
    			else if (opcode == 125) {
    				((ItemDefinitions) this).anInt5742 = ((stream.readByte(-12558881) << 2) * -1833538443);
    				((ItemDefinitions) this).anInt5744 = (stream.readByte(-12558881) << 2) * -25983505;
    				((ItemDefinitions) this).anInt5748 = (stream.readByte(-12558881) << 2) * 1243416501;
    			} else if (opcode == 126) {
    				((ItemDefinitions) this).anInt5743 = ((stream.readByte(-12558881) << 2) * -1039520547);
    				((ItemDefinitions) this).anInt5745 = (stream.readByte(-12558881) << 2) * 1803423949;
    				((ItemDefinitions) this).anInt5710 = (stream.readByte(-12558881) << 2) * 519268429;
    			} else if (opcode == 127) {
    				anInt5729 = stream.readUnsignedByte() * 947829311;
    				anInt5725 = stream.readUnsignedShort() * 300082645;
    			} else if (128 == opcode) {
    				anInt5730 = stream.readUnsignedByte() * -1036837039;
    				anInt5703 = stream.readUnsignedShort() * 1829509431;
    			} else if (129 == opcode) {
    				anInt5736 = stream.readUnsignedByte() * -2098727417;
    				anInt5727 = stream.readUnsignedShort() * -48114927;
    			} else if (opcode == 130) {
    				anInt5722 = stream.readUnsignedByte() * -969618575;
    				anInt5728 = stream.readUnsignedShort() * -1531140281;
    			} else if (132 == opcode) {
    				int i_71_ = stream.readUnsignedByte();
    				anIntArray5767 = new int[i_71_];
    				for (int i_72_ = 0; i_72_ < i_71_; i_72_++)
    					anIntArray5767[i_72_] = stream.readUnsignedShort();
    			} else if (134 == opcode)
    				anInt5768 = stream.readUnsignedByte() * 1394978643;
    			else if (139 == opcode)
    				((ItemDefinitions) this).anInt5769 = stream.readUnsignedShort() * 257950023;
    			else if (opcode == 140)
    				anInt5770 = stream.readUnsignedShort() * 78716625;
    			else if (opcode >= 142 && opcode < 147) {
    				if (aByteIntArray5869 == null) {
    					aByteIntArray5869 = new int[6];
    					Arrays.fill(aByteIntArray5869, -1);
    				}
    				aByteIntArray5869[opcode - 142] = (short) stream.readUnsignedShort();
    			} else if (opcode >= 150 && opcode < 155) {
    				if (null == anIntArray5960) {
    					anIntArray5960 = new int[5];
    					Arrays.fill(anIntArray5960, -1);
    				}
    				anIntArray5960[opcode - 150] = (short) stream.readUnsignedShort();
    			} else if (249 == opcode) {
    				int i_73_ = stream.readUnsignedByte();
    				if (null == ((ItemDefinitions) this).aClass437_5766) {
    					int i_74_ = Class416.method5590(i_73_, (byte) 16);
    					((ItemDefinitions) this).aClass437_5766 = new LinkedList(i_74_);
    				}
    				for (int i_75_ = 0; i_75_ < i_73_; i_75_++) {// client script
    																// map
    					boolean bool = stream.readUnsignedByte() == 1;
    					int i_76_ = stream.read24BitUnsignedInteger((byte) 15);
    					Class298 class298;
    					if (bool)
    						class298 = new Class298_Sub29(stream.readString(-1208778402));
    					else
    						class298 = new Class298_Sub35(stream.readInt((byte) 69));
    					((ItemDefinitions) this).aClass437_5766.method5817(class298, (long) i_76_);
    			}
    		} else
    			throw new RuntimeException("MISSING OPCODE " + opcode
    					+ " FOR ITEM " + getId());
    	}
    
    	private int unknownValue1;
    	private int unknownValue2;
    
    	private final void readOpcodeValues(InputStream stream) {
    		while (true) {
    			int opcode = stream.readUnsignedByte();
    			if (opcode == 0)
    				break;
    			readValues(stream, opcode);
    		}
    	}
    
    	public String getName() {
    		return name;
    	}
    	
    	public String getLowerCaseName() {
    	name = name.toLowerCase();
    		return name;
    	}
    
    	public int getFemaleWornModelId1() {
    		return femaleEquip1;
    	}
    
    	public int getFemaleWornModelId2() {
    		return femaleEquip2;
    	}
    
    	public int getMaleWornModelId1() {
    		return maleEquip1;
    	}
    
    	public int getMaleWornModelId2() {
    		return maleEquip2;
    	}
    
    	public boolean isOverSized() {
    		return modelZoom > 5000;
    	}
    
    	public boolean isLended() {
    		return lended;
    	}
    
    	public boolean isMembersOnly() {
    		return membersOnly;
    	}
    
    	public boolean isStackable() {
    		return stackable == 1;
    	}
    
    	public boolean isNoted() {
    		return noted;
    	}
    
    	public int getLendId() {
    		return lendId;
    	}
    
    	public int getCertId() {
    		return certId;
    	}
    
    	public int getValue() {
    		return value;
    	}
    
    	public int getId() {
    		return id;
    	}
    
    	public int getEquipSlot() {
    		return equipSlot;
    	}
    
    	public int getEquipType() {
    		return equipType;
    	}
    
    	public int getGEPrice() {
    		try {
    			for (String lines : FileUtilities.readFile("./data/items/grand_exchange/tipit_dump.txt")) {
    				String[] data = lines.split(" - ");
    				if (Integer.parseInt(data[0]) == id) return Integer.parseInt(data[1]);
    			}
    		} catch (NumberFormatException e) {
    			e.printStackTrace();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		return -1;
    	}
    
    	// hehe lil cheap shit :p
    	public static class FileUtilities {
    
    
    
    		public static final int BUFFER = 1024;
    
    
    
    		public static boolean exists(String name) {
    
    			File file = new File(name);
    
    			return file.exists();
    
    		}
    
    
    
    		public static ByteBuffer fileBuffer(String name) throws IOException {
    
    			File file = new File(name);
    
    			if(!file.exists())
    
    				return null;
    
    			FileInputStream in = new FileInputStream(name);
    
    
    
    			byte[] data = new byte[BUFFER];
    
    			int read;
    
    			try {
    
    				ByteBuffer buffer = ByteBuffer.allocate(in.available() + 1);
    
    				while ((read = in.read(data, 0, BUFFER)) != -1) {
    
    					buffer.put(data, 0, read);
    
    				}
    
    				buffer.flip();
    
    				return buffer;
    
    			} finally {
    
    				if (in != null)
    
    					in.close();
    
    				in = null;
    
    			}
    
    		}
    
    
    
    		public static void writeBufferToFile(String name, ByteBuffer buffer) throws IOException {
    
    			File file = new File(name);
    
    			if(!file.exists())
    
    				file.createNewFile();
    
    			FileOutputStream out = new FileOutputStream(name);
    
    			out.write(buffer.array(), 0, buffer.remaining());
    
    			out.flush();
    
    			out.close();
    
    		}
    
    
    
    		public static LinkedList<String> readFile(String directory) throws IOException {
    
    			LinkedList<String> fileLines = new LinkedList<String>();
    
    			BufferedReader reader = null;
    
    			try {
    
    				reader = new BufferedReader(new FileReader(directory));
    
    				String string;
    
    				while ((string = reader.readLine()) != null) {
    
    					fileLines.add(string);
    
    				}
    
    			} finally {
    
    				if (reader != null) {
    
    					reader.close();
    
    					reader = null;
    
    				}
    
    			}
    
    			return fileLines;
    
    		}
    
    
    
    	}
    
    	public static ItemDefinitions forName(String substring) {
    		// TODO Auto-generated method stub
    		return null;
    	}
    
    }
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2013
    Posts
    6
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    I replaced my ItemDefinitions.java with the code you gave me, and once I compiled I got this error:

    Code:
    src\com\rs\cache\loaders\ItemDefinitions.java:478: error: cannot find symbol
                                                    aByteArray5609[i_96_] = i_95_;
                                                    ^
      symbol:   variable aByteArray5609
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:481: error: cannot find symbol
                                                    aByteArray5609[i_96_] = (byte) -
    1;
                                                    ^
      symbol:   variable aByteArray5609
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:488: error: cannot find symbol
                                    aByteArray5904 = new byte[i_98_];
                                    ^
      symbol:   variable aByteArray5904
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:492: error: cannot find symbol
                                                    aByteArray5904[i_101_] = i_100_;
    
                                                    ^
      symbol:   variable aByteArray5904
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:495: error: cannot find symbol
                                                    aByteArray5904[i_101_] = (byte)
    -1;
                                                    ^
      symbol:   variable aByteArray5904
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:498: error: cannot find symbol
                                    aBoolean5734 = true;
                                    ^
      symbol:   variable aBoolean5734
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:500: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5759 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 756401161
    ;
                                                            ^
      symbol:   variable anInt5759
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:500: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5759 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 756401161
    ;
                                                                          ^
      symbol:   variable oldItems
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:500: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5759 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 756401161
    ;
    
           ^
      symbol:   method readCustomUnsignedShort()
      location: variable stream of type InputStream
    src\com\rs\cache\loaders\ItemDefinitions.java:500: error: method readBigSmart in
     class InputStream cannot be applied to given types;
                                    ((ItemDefinitions) this).anInt5759 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 756401161
    ;
    
                                              ^
      required: no arguments
      found: int
      reason: actual and formal argument lists differ in length
    src\com\rs\cache\loaders\ItemDefinitions.java:502: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5741 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 209868076
    1;
                                                            ^
      symbol:   variable anInt5741
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:502: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5741 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 209868076
    1;
                                                                          ^
      symbol:   variable oldItems
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:502: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5741 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 209868076
    1;
    
           ^
      symbol:   method readCustomUnsignedShort()
      location: variable stream of type InputStream
    src\com\rs\cache\loaders\ItemDefinitions.java:502: error: method readBigSmart in
     class InputStream cannot be applied to given types;
                                    ((ItemDefinitions) this).anInt5741 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 209868076
    1;
    
                                              ^
      required: no arguments
      found: int
      reason: actual and formal argument lists differ in length
    src\com\rs\cache\loaders\ItemDefinitions.java:504: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5760 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 131996276
    9;
                                                            ^
      symbol:   variable anInt5760
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:504: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5760 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 131996276
    9;
                                                                          ^
      symbol:   variable oldItems
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:504: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5760 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 131996276
    9;
    
           ^
      symbol:   method readCustomUnsignedShort()
      location: variable stream of type InputStream
    src\com\rs\cache\loaders\ItemDefinitions.java:504: error: method readBigSmart in
     class InputStream cannot be applied to given types;
                                    ((ItemDefinitions) this).anInt5760 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 131996276
    9;
    
                                              ^
      required: no arguments
      found: int
      reason: actual and formal argument lists differ in length
    src\com\rs\cache\loaders\ItemDefinitions.java:506: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5750 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 159890746
    9;
                                                            ^
      symbol:   variable anInt5750
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:506: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5750 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 159890746
    9;
                                                                          ^
      symbol:   variable oldItems
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:506: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5750 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 159890746
    9;
    
           ^
      symbol:   method readCustomUnsignedShort()
      location: variable stream of type InputStream
    src\com\rs\cache\loaders\ItemDefinitions.java:506: error: method readBigSmart in
     class InputStream cannot be applied to given types;
                                    ((ItemDefinitions) this).anInt5750 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * 159890746
    9;
    
                                              ^
      required: no arguments
      found: int
      reason: actual and formal argument lists differ in length
    src\com\rs\cache\loaders\ItemDefinitions.java:508: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5749 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -19353444
    49;
                                                            ^
      symbol:   variable anInt5749
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:508: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5749 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -19353444
    49;
                                                                          ^
      symbol:   variable oldItems
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:508: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5749 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -19353444
    49;
    
           ^
      symbol:   method readCustomUnsignedShort()
      location: variable stream of type InputStream
    src\com\rs\cache\loaders\ItemDefinitions.java:508: error: method readBigSmart in
     class InputStream cannot be applied to given types;
                                    ((ItemDefinitions) this).anInt5749 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -19353444
    49;
    
                                              ^
      required: no arguments
      found: int
      reason: actual and formal argument lists differ in length
    src\com\rs\cache\loaders\ItemDefinitions.java:510: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5764 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -11943698
    71;
                                                            ^
      symbol:   variable anInt5764
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:510: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5764 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -11943698
    71;
                                                                          ^
      symbol:   variable oldItems
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:510: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5764 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -11943698
    71;
    
           ^
      symbol:   method readCustomUnsignedShort()
      location: variable stream of type InputStream
    src\com\rs\cache\loaders\ItemDefinitions.java:510: error: method readBigSmart in
     class InputStream cannot be applied to given types;
                                    ((ItemDefinitions) this).anInt5764 = (oldItems ?
     stream.readCustomUnsignedShort() : stream.readBigSmart(1235052657)) * -11943698
    71;
    
                                              ^
      required: no arguments
      found: int
      reason: actual and formal argument lists differ in length
    src\com\rs\cache\loaders\ItemDefinitions.java:512: error: cannot find symbol
                                    anInt5716 = stream.readUnsignedShort() * -883520
    799;
                                    ^
      symbol:   variable anInt5716
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:514: error: cannot find symbol
                                    anInt5765 = stream.readUnsignedByte() * 13518766
    7;
                                    ^
      symbol:   variable anInt5765
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:516: error: cannot find symbol
                                    anInt5709 = stream.readUnsignedShort() * -384973
    719;
                                    ^
      symbol:   variable anInt5709
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:518: error: cannot find symbol
                                    anInt5755 = stream.readUnsignedShort() * 1831957
    949;
                                    ^
      symbol:   variable anInt5755
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:520: error: cannot find symbol
                                    if (((ItemDefinitions) this).anIntArray5752 == n
    ull) {
                                                                ^
      symbol:   variable anIntArray5752
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:521: error: cannot find symbol
                                            ((ItemDefinitions) this).anIntArray5752
    = new int[10];
                                                                    ^
      symbol:   variable anIntArray5752
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:522: error: cannot find symbol
                                            ((ItemDefinitions) this).anIntArray5753
    = new int[10];
                                                                    ^
      symbol:   variable anIntArray5753
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:524: error: cannot find symbol
                                    ((ItemDefinitions) this).anIntArray5752[opcode -
     100] = stream.readUnsignedShort();
                                                            ^
      symbol:   variable anIntArray5752
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:525: error: cannot find symbol
                                    ((ItemDefinitions) this).anIntArray5753[opcode -
     100] = stream.readUnsignedShort();
                                                            ^
      symbol:   variable anIntArray5753
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:527: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5758 = stream.read
    UnsignedShort() * -237762771;
                                                            ^
      symbol:   variable anInt5758
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:529: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5702 = stream.read
    UnsignedShort() * 355882061;
                                                            ^
      symbol:   variable anInt5702
      location: class ItemDefinitions
    src\com\rs\cache\loaders\ItemDefinitions.java:531: error: cannot find symbol
                                    ((ItemDefinitions) this).anInt5739 = stream.read
    UnsignedShort() * 1219480869;
                                                            ^
      symbol:   variable anInt5739
      location: class ItemDefinitions
    100 errors
    Complete
    Press any key to continue . . .
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Oct 2013
    Posts
    6
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Gave up.

    /req close
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. missing opcode 94 for item 6
    By Master V in forum Help
    Replies: 2
    Last Post: 03-12-2018, 02:05 AM
  2. Buying Automatic Donating For My 718/742
    By Aust1n in forum Buying
    Replies: 8
    Last Post: 07-07-2013, 07:21 PM
  3. Looking for developers for my 718/742
    By Yunaikz in forum Requests
    Replies: 1
    Last Post: 06-14-2013, 06:06 PM
  4. Looking for Private 718/742 Willing to pay
    By Juicy J 0 in forum Requests
    Replies: 3
    Last Post: 04-28-2013, 09:38 AM
  5. Setting the value of an item [718/742]
    By mage pwns in forum Help
    Replies: 8
    Last Post: 04-12-2013, 04:19 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •