Thread: 525 Item Dump containing main item information

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 525 Item Dump containing main item information 
    Renown Programmer

    Sean's Avatar
    Join Date
    May 2007
    Age
    29
    Posts
    2,758
    Thanks given
    264
    Thanks received
    1,089
    Rep Power
    4393
    Hi all

    Well i done this awhile ago and i thought i would release as im not working on my 525 that much.

    The dump contains

    Noteable
    NotedId
    Stackable
    Prices

    and so on

    But it does not contain bonuses and such

    Code:
    package org.hyperion.rs2.model;
    
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import java.nio.ByteBuffer;
    import java.nio.channels.FileChannel.MapMode;
    import java.util.logging.Logger;
    
    import org.hyperion.util.Buffers;
    import org.hyperion.util.SystemLogger;
    
    /**
     * The item definition manager.
     * 
     * @author Vastico
     * @author Graham Edgecombe
     * @author Sir Sean
     * 
     */
    public class ItemDefinition {
    
    	/**
    	 * Logger instance.
    	 */
    	private static final Logger logger = Logger.getLogger(ItemDefinition.class
    			.getName());
    
    	/**
    	 * The definition array.
    	 */
    	public static ItemDefinition[] definitions;
    
    	/**
    	 * Gets a definition for the specified id.
    	 * 
    	 * @param id
    	 *            The id.
    	 * @return The definition.
    	 */
    	public static ItemDefinition forId(int id) {
    		return definitions[id];
    	}
    
    	/**
    	 * Loads the item definitions.
    	 * 
    	 * @throws IOException
    	 *             if an I/O error occurs.
    	 * @throws IllegalStateException
    	 *             if the definitions have been loaded already.
    	 */
    	public static void init() throws IOException {
    		if (definitions != null) {
    			throw new IllegalStateException("Definitions already loaded.");
    		}
    		logger.info("Loading definitions...");
    		RandomAccessFile raf = new RandomAccessFile("data/itemDefinitions.dat", "r");
    		try {
    			ByteBuffer buffer = raf.getChannel().map(MapMode.READ_ONLY, 0, raf.length());
    			int count = buffer.getShort() & 0xFFFF;
    			definitions = new ItemDefinition[count];
    			for (int i = 0; i < count; i++) {
    				String name = Buffers.readString(buffer);
    				String examine = "An " + name + "";
    				boolean noted = buffer.get() == 1 ? true : false;
    				int parentId = buffer.getShort() & 0xFFFF;
    				if (parentId == 65535) {
    					parentId = -1;
    				}
    				boolean noteable = buffer.get() == 1 ? true : false;
    				int notedId = buffer.getShort() & 0xFFFF;
    				if (notedId == 65535) {
    					notedId = -1;
    				}
    				boolean stackable = buffer.get() == 1 ? true : false;
    				boolean members = buffer.get() == 1 ? true : false;
    				boolean prices = buffer.get() == 1 ? true : false;
    				int shop = -1;
    				int highAlc = -1;
    				int lowAlc = -1;
    				if (prices) {
    					shop = buffer.getInt();
    					highAlc = (int) (shop * 0.6D);
    					lowAlc = (int) (shop * 0.4D);
    				}
    				int equipmentIds = buffer.getShort() & 0xFFFF;
    				definitions[i] = new ItemDefinition(i, name, examine, noted, noteable, stackable, parentId, notedId, members, shop, highAlc, lowAlc, equipmentIds);
    			}
    			logger.info("Loaded " + definitions.length + " definitions.");
    		} finally {
    			raf.close();
    		}
    	}
    
    	/**
    	 * Id.
    	 */
    	private final int id;
    
    	/**
    	 * Name.
    	 */
    	private final String name;
    
    	/**
    	 * Description.
    	 */
    	private final String examine;
    
    	/**
    	 * Noted flag.
    	 */
    	private final boolean noted;
    
    	/**
    	 * Noteable flag.
    	 */
    	private final boolean noteable;
    
    	/**
    	 * Stackable flag.
    	 */
    	private final boolean stackable;
    
    	/**
    	 * Non-noted id.
    	 */
    	private final int parentId;
    
    	/**
    	 * Noted id.
    	 */
    	private final int notedId;
    
    	/**
    	 * Members flag.
    	 */
    	private final boolean members;
    
    	/**
    	 * Shop value.
    	 */
    	private final int shopValue;
    
    	/**
    	 * High alc value.
    	 */
    	private final int highAlcValue;
    
    	/**
    	 * Low alc value.
    	 */
    	private final int lowAlcValue;
    
    	/**
    	 * Equipment value
    	 */
    	private final int equipmentId;
    
    	/**
    	 * Creates the item definition.
    	 * 
    	 * @param id
    	 *            The id.
    	 * @param name
    	 *            The name.
    	 * @param examine
    	 *            The description.
    	 * @param noted
    	 *            The noted flag.
    	 * @param noteable
    	 *            The noteable flag.
    	 * @param stackable
    	 *            The stackable flag.
    	 * @param parentId
    	 *            The non-noted id.
    	 * @param notedId
    	 *            The noted id.
    	 * @param members
    	 *            The members flag.
    	 * @param shopValue
    	 *            The shop price.
    	 * @param highAlcValue
    	 *            The high alc value.
    	 * @param lowAlcValue
    	 *            The low alc value.
    	 * @param equipmentId
    	 *            The equipment value
    	 */
    	private ItemDefinition(int id, String name, String examine, boolean noted,
    			boolean noteable, boolean stackable, int parentId, int notedId,
    			boolean members, int shopValue, int highAlcValue, int lowAlcValue,
    			int equipmentId) {
    		this.id = id;
    		this.name = name;
    		this.examine = examine;
    		this.noted = noted;
    		this.noteable = noteable;
    		this.stackable = stackable;
    		this.parentId = parentId;
    		this.notedId = notedId;
    		this.members = members;
    		this.shopValue = shopValue;
    		this.highAlcValue = highAlcValue;
    		this.lowAlcValue = lowAlcValue;
    		this.equipmentId = equipmentId;
    	}
    
    	/**
    	 * Gets parentId
    	 * 
    	 * @return The item before it was noted
    	 */
    	public int getParentId() {
    		return parentId;
    	}
    
    	/**
    	 * Gets the id.
    	 * 
    	 * @return The id.
    	 */
    	public int getId() {
    		return id;
    	}
    
    	/**
    	 * Gets the name.
    	 * 
    	 * @return The name.
    	 */
    	public String getName() {
    		return name;
    	}
    
    	/**
    	 * Gets the description.
    	 * 
    	 * @return The description.
    	 */
    	public String getDescription() {
    		return examine;
    	}
    
    	/**
    	 * Gets the noted flag.
    	 * 
    	 * @return The noted flag.
    	 */
    	public boolean isNoted() {
    		return noted;
    	}
    
    	/**
    	 * Gets the noteable flag.
    	 * 
    	 * @return The noteable flag.
    	 */
    	public boolean isNoteable() {
    		return noteable;
    	}
    
    	/**
    	 * Gets the stackable flag.
    	 * 
    	 * @return The stackable flag.
    	 */
    	public boolean isStackable() {
    		return stackable || noted;
    	}
    
    	/**
    	 * Gets the normal id.
    	 * 
    	 * @return The normal id.
    	 */
    	public int getNormalId() {
    		return parentId;
    	}
    
    	/**
    	 * Gets the noted id.
    	 * 
    	 * @return The noted id.
    	 */
    	public int getNotedId() {
    		return notedId;
    	}
    
    	/**
    	 * Gets the members only flag.
    	 * 
    	 * @return The members only flag.
    	 */
    	public boolean isMembersOnly() {
    		return members;
    	}
    
    	/**
    	 * Gets the value.
    	 * 
    	 * @return The value.
    	 */
    	public int getValue() {
    		return shopValue;
    	}
    
    	/**
    	 * Gets the low alc value.
    	 * 
    	 * @return The low alc value.
    	 */
    	public int getLowAlcValue() {
    		return lowAlcValue;
    	}
    
    	/**
    	 * Gets the high alc value.
    	 * 
    	 * @return The high alc value.
    	 */
    	public int getHighAlcValue() {
    		return highAlcValue;
    	}
    
    	/**
    	 * Gets the equipment id
    	 * 
    	 * @return The equipment id for player updating
    	 */
    	public int getEquipmentId() {
    		return equipmentId;
    	}	
    }
    Please remember that my 525 is hyperion and that this is hyperions itemdefinitions class

    Download Link:

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
     

    Vastiko's Avatar
    Join Date
    Dec 2006
    Posts
    5,700
    Thanks given
    300
    Thanks received
    660
    Discord
    View profile
    Rep Power
    5000
    Thanks alot Sean, needed one of these haha!
    Reply With Quote  
     

  3. #3  
    Registered Member
    Serenity's Avatar
    Join Date
    Oct 2008
    Age
    32
    Posts
    2,327
    Thanks given
    43
    Thanks received
    43
    Rep Power
    389
    tyvm just what i needed.
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  4. #4  
    Apocalyptism
    Harry's Avatar
    Join Date
    Apr 2007
    Posts
    3,783
    Thanks given
    594
    Thanks received
    1,833
    Rep Power
    2934
    Yeah good job on this Sean

    I still need to add it
    ~ Harry
    Please bear this in mind when hearing the word 'soon' from a software programmer.

    As coding software generally takes thousands of years, software programmers have developed a natural adaptation to this in the form of an altered perception of the flow of time.

    Due to this, the word 'soon' when uttered by a programmer should be taken to mean 'a very, very long time from now' in the terminology used by common human specimens who have not developed such an adaptation.
    knowledge can be taught, but passion cannot.
    It's better to create something that others criticise than to create nothing and criticise others.
    Reply With Quote  
     

  5. #5  
    Renown Programmer

    Sean's Avatar
    Join Date
    May 2007
    Age
    29
    Posts
    2,758
    Thanks given
    264
    Thanks received
    1,089
    Rep Power
    4393
    well thx for the reply
    Reply With Quote  
     

  6. #6  
    Registered Member
    Serenity's Avatar
    Join Date
    Oct 2008
    Age
    32
    Posts
    2,327
    Thanks given
    43
    Thanks received
    43
    Rep Power
    389
    could you post the "Buffers.readString(buffer);" method?
    cause im not using hyporion and i still would like to use the information you gatherd.
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  7. #7  
    Renown Programmer

    Sean's Avatar
    Join Date
    May 2007
    Age
    29
    Posts
    2,758
    Thanks given
    264
    Thanks received
    1,089
    Rep Power
    4393
    just simply look at hyperions svn
    Reply With Quote  
     

  8. #8  
    Registered Member
    Serenity's Avatar
    Join Date
    Oct 2008
    Age
    32
    Posts
    2,327
    Thanks given
    43
    Thanks received
    43
    Rep Power
    389
    k will do.
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Jan 2010
    Posts
    59
    Thanks given
    1
    Thanks received
    0
    Rep Power
    1
    how you dumped these?
    tell what program u used.
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Jul 2008
    Posts
    185
    Thanks given
    1
    Thanks received
    4
    Rep Power
    12
    Awww, got my hopes up when it said prices
    Good job none the less
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •