Thread: [Unknown Revision] 20,694 Item Definitions

Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1 [Unknown Revision] 20,694 Item Definitions 
    Retired. Stop PMing me.


    Galkon's Avatar
    Join Date
    Nov 2007
    Age
    17
    Posts
    7,526
    Thanks given
    1,805
    Thanks received
    2,830
    Rep Power
    5000
    Okay so I built a tool for my server (Server Suite) and part of it is an Item Definitions reader/writer/editor. It has the ability to grab the item's information from RuneWiki, I released some snippets for it awhile ago.

    Anyways, I finally perfected the item grabbing/dumping so there are no errors thrown during grabbing them, and dumped all the item definitions for my server. These include:

    • Grabbed from RuneWiki
      • All item bonuses for the 317 revision
      • Item price (market price on RS)
      • Low alch value
      • High alch value
      • Weight
      • Examine information
    • Other
      • Stackable (dumped from the client's definitions)
      • Noteable (dumped from the client's definitions)
    • Still to do (can't be grabbed from RuneWiki)
      • Animations (attack, block, stand, walk, run, etc)


    Here is the download for the file:
    Download itemdef.gsu @ UppIT
    itemdef.gsu

    This file should go in Data/data/itemdef.gsu for emulous/riot/PI servers. You can change it if you need to.

    Here is the reader for your server. Simply call "ItemDefinitions.read();" upon startup to read the items. I made the package for default emulous/riot/PI since that's the most commonly used.
    Spoiler for ItemDefinitions.java:
    Code:
    package server.model.items;
    
    import java.io.DataInputStream;
    import java.io.FileInputStream;
    import java.io.IOException;
    
    public class ItemDefinitions {
    
    	/**
    	 * Creates the default item definition.
    	 */
    	public ItemDefinitions() {
    		name = null;
    		description = null;
    		price = 0;
    		low = 0;
    		high = 0;
    		stackable = false;
    		noteable = false;
    		weight = 0;
    		bonuses = null;
    		stand = -1;
    		walk = -1;
    		run = -1;
    		turn90left = -1;
    		turn90right = -1;
    		turn180 = -1;
    		attack = -1;
    		block = -1;
    	}
    
    	/**
    	 * Reads the definitions from the file.
    	 */
    	public static void read() {
    		try {
    			DataInputStream in = new DataInputStream(new FileInputStream("./Data/data/itemdef.gsu"));
    			total = in.readShort();
    			if(items == null)
    				items = new ItemDefinitions[total];
    			for(int j = 0; j < total; j++) {
    				if(items[j] == null) {
    					items[j] = new ItemDefinitions();
    				}
    				items[j].getValues(in);
    			}
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    
    	/**
    	 * Reads the stream values.
    	 * @param in
    	 */
    	private void getValues(DataInputStream in) {
    		try {
    			do {
    				int opcode = in.readByte();
    				if(opcode == 0)
    					return;
    				if(opcode == 1) {
    					name = in.readUTF();
    				} else if(opcode == 2) {
    					description = in.readUTF();
    				} else if(opcode == 3) {
    					price = in.readInt();
    				} else if(opcode == 4) {
    					low = in.readInt();
    				} else if(opcode == 5) {
    					high = in.readInt();
    				} else if(opcode == 6) {
    					stackable = true;
    				} else if(opcode == 7) {
    					noteable = true;
    				} else if(opcode == 8) {
    					weight = in.readDouble();
    				} else if(opcode == 9) {
    					int length = in.readShort();
    					bonuses = new double[length];
    					for (int index = 0; index < length; index++) {
    						bonuses[index] = in.readDouble();
    					}
    				} else if(opcode == 10) {
    					stand = in.readShort();
    				} else if(opcode == 11) {
    					walk = in.readShort();
    				} else if(opcode == 12) {
    					run = in.readShort();
    				} else if(opcode == 13) {
    					turn90left = in.readShort();
    				} else if(opcode == 14) {
    					turn90right = in.readShort();
    				} else if(opcode == 15) {
    					turn180 = in.readShort();
    				} else if(opcode == 16) {
    					attack = in.readShort();
    				} else if(opcode == 17) {
    					block = in.readShort();
    				} else {
    					System.out.println("Unrecognized opcode: " + opcode);
    				}
    			} while(true);
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    
    	/**
    	 * The item definition cache.
    	 */
    	public static ItemDefinitions items[];
    
    	/**
    	 * The total items read from the definitions.
    	 */
    	public static int total;
    
    	/**
    	 * Returns the total item number.
    	 */
    	public static int getTotal() {
    		return total;
    	}
    
    	/**
    	 * The item name.
    	 */
    	public String name;
    
    	/**
    	 * Returns the name of the item.
    	 * @return
    	 */
    	public static String getName(int id) {
    		return items[id].name;
    	}
    
    	/**
    	 * The item description.
    	 */
    	public String description;
    
    	/**
    	 * Returns the description of an item.
    	 */
    	public static String getDescription(int id) {
    		return items[id].description;
    	}
    
    	/**
    	 * The item price.
    	 */
    	public int price;
    
    	/**
    	 * Returns the price of an item.
    	 */
    	public static int getPrice(int id) {
    		return items[id].price;
    	}
    
    	/**
    	 * The low alch value.
    	 */
    	public int low;
    
    	/**
    	 * Returns the low alch value of an item.
    	 */
    	public static int getLow(int id) {
    		return items[id].low;
    	}
    
    	/**
    	 * The high alch value.
    	 */
    	public int high;
    
    	/**
    	 * Returns the high alch value of an item.
    	 */
    	public static int getHigh(int id) {
    		return items[id].high;
    	}
    
    	/**
    	 * Can the item be stacked?
    	 */
    	public boolean stackable;
    
    	/**
    	 * Returns whether or not the item can be stacked.
    	 */
    	public static boolean canStack(int id) {
    		return items[id].stackable;
    	}
    
    	/**
    	 * Can the item be noted?
    	 */
    	public boolean noteable;
    	
    	/**
    	 * Returns whether or not the item can be noted.
    	 */
    	public static boolean canNote(int id) {
    		return items[id].noteable;
    	}
    
    	/**
    	 * The weight of an item.
    	 */
    	public double weight;
    
    	/**
    	 * Returns the weight of an item.
    	 */
    	public static double getWeight(int id) {
    		return items[id].weight;
    	}
    
    	/**
    	 * The bonuses of an item.
    	 */
    	public double[] bonuses;
    
    	/**
    	 * Returns the array of bonuses for an item.
    	 */
    	public double[] getBonuses(int id) {
    		return items[id].bonuses;
    	}
    
    	/**
    	 * The stand animation of an item.
    	 */
    	public int stand;
    
    	/**
    	 * Returns the stand animation of an item.
    	 */
    	public static int getStand(int id) {
    		return items[id].stand;
    	}
    
    	/**
    	 * The walk animation of an item.
    	 */
    	public int walk;
    
    	/**
    	 * Returns the walk animation of an item.
    	 */
    	public static int getWalk(int id) {
    		return items[id].walk;
    	}
    
    	/**
    	 * The run animation of an item.
    	 */
    	public int run;
    
    	/**
    	 * Returns the run animation of an item.
    	 */
    	public static int getRun(int id) {
    		return items[id].run;
    	}
    
    	/**
    	 * The 90-degree left turn animation of an item.
    	 */
    	public int turn90left;
    
    	/**
    	 * Returns the 90-degree left turn animation of an item.
    	 */
    	public static int get90left(int id) {
    		return items[id].turn90left;
    	}
    
    	/**
    	 * The 90-degree right turn animation of an item.
    	 */
    	public int turn90right;
    
    	/**
    	 * Returns the 90-degree right turn animation of an item.
    	 */
    	public static int get90right(int id) {
    		return items[id].turn90right;
    	}
    
    	/**
    	 * The 180-degree turn animation of an item.
    	 */
    	public int turn180;
    
    	/**
    	 * Returns the 180-degree turn animation of an item.
    	 */
    	public static int get180(int id) {
    		return items[id].turn180;
    	}
    
    	/**
    	 * The attack animation of an item.
    	 */
    	public int attack;
    
    	/**
    	 * Returns the attack animation of an item
    	 */
    	public static int getAttack(int id) {
    		return items[id].attack;
    	}
    
    	/**
    	 * The block animation of an item.
    	 */
    	public int block;
    
    	/**
    	 * Returns the block animation of an item
    	 */
    	public static int getBlock(int id) {
    		return items[id].block;
    	}
    }


    You can reference anything you need such as item bonuses like:
    Code:
    bonuses = ItemDefinitions.getBonuses(id);
    price = ItemDefinitions.getPrice(id);
    Attached image
     


  2. #2  
    Banned
    Join Date
    Apr 2011
    Posts
    500
    Thanks given
    3
    Thanks received
    40
    Rep Power
    0
    This is very nice work, like always. You my friend, are the best of this community
     

  3. #3  
    Renown Programmer

    Join Date
    Dec 2010
    Posts
    2,876
    Thanks given
    508
    Thanks received
    1,898
    Rep Power
    5000
    there's no need to explicitly set fields to their default, uninitialised value.

    the client only does it because its overwriting a cached definition
    never talk to me or my wife's son ever again
     

  4. #4  
    Banned

    Join Date
    Nov 2010
    Age
    29
    Posts
    2,682
    Thanks given
    824
    Thanks received
    404
    Rep Power
    0
    I remember your other one you did. Nice man.
     

  5. #5  
    Banned

    Join Date
    Nov 2009
    Posts
    4,219
    Thanks given
    2,950
    Thanks received
    1,362
    Rep Power
    0
    Well done, as always!
     

  6. #6  
    RevolutionX PK
    All3n's Avatar
    Join Date
    Jul 2010
    Posts
    1,172
    Thanks given
    1,380
    Thanks received
    527
    Rep Power
    982
    I was planning on making something similar to this

    Nice good job.
     

  7. #7  
    Dr. Jaegon


    Join Date
    Sep 2011
    Posts
    2,132
    Thanks given
    407
    Thanks received
    441
    Rep Power
    2559
    Thanks man
     

  8. #8  
    Retired. Stop PMing me.


    Galkon's Avatar
    Join Date
    Nov 2007
    Age
    17
    Posts
    7,526
    Thanks given
    1,805
    Thanks received
    2,830
    Rep Power
    5000
    No problem guys.
    Attached image
     

  9. #9  
    Registered Member
    killamess's Avatar
    Join Date
    Dec 2007
    Age
    33
    Posts
    1,508
    Thanks given
    51
    Thanks received
    284
    Rep Power
    1956
    45 for whip? That can't be right can it?


     

  10. #10  
    Registered Member
    Join Date
    Jan 2012
    Posts
    64
    Thanks given
    0
    Thanks received
    2
    Rep Power
    9
    Hi, Bro, i like your codes, it's very simple and very good...TY!
     

Page 1 of 3 123 LastLast

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. Replies: 9
    Last Post: 12-18-2011, 04:29 AM
  2. Unknown Cache Revision.
    By Snow Cat123 in forum Downloads
    Replies: 28
    Last Post: 12-29-2010, 12:30 AM
  3. Login to an unknown revision.
    By Wizzy G in forum Show-off
    Replies: 27
    Last Post: 05-19-2010, 07:37 PM
  4. Item Definitions
    By Vastiko in forum Help
    Replies: 12
    Last Post: 04-20-2010, 05:33 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
  •