Thread: #118 Item definitions > xml

Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Quote Originally Posted by Naga View Post
    Code:
    sep 19, 2016 11:18:09 AM rs2.Server main
    INFO: Initializing RuneScape...
    Sep 19, 2016 11:18:09 AM rs2.abyssalps.model.items.defs.ItemDefinitions init
    INFO: Loading item definitions...
    Exception in thread "main" com.thoughtworks.xstream.converters.ConversionException: itemDef : itemDef
    ---- Debugging information ----
    path                : /list/itemDef 
    message             : itemDef : itemDef 
    required-type       : java.util.ArrayList 
    line number         : 2 
    cause-message       : itemDef : itemDef 
    class               : java.util.List 
    cause-exception     : com.thoughtworks.xstream.alias.CannotResolveClassException
    I replaced all the itemDef in the xml file with itemDefinition and worked for me
    Reply With Quote  
     

  2. #12  
    Registered Member
    Join Date
    Jan 2012
    Posts
    176
    Thanks given
    110
    Thanks received
    33
    Rep Power
    43
    Quote Originally Posted by Idiot Bird View Post
    Contains the following defs
    • Id
    • Name
    • Examine
    • Price
    • Stackable indicator
    • Noted indicator
    • bonuses
    • tradeable indicator
    • alch values
    • weight


    Link; Download item.definitions.xml @ UppIT

    Loader / def class
    Code:
    package server.model.items;
    
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Objects;
    import java.util.logging.Logger;
    
    import server.model.players.Player;
    import server.model.players.content.container.impl.Equipment;
    import server.util.XMLController;
    
    /**
     * 
     * @author Jack
     *
     */
    
    public class ItemDefinitions {
    
    	/**
    	 * Map which contains all item defintion data
    	 */
    	private static HashMap<Integer, ItemDefinitions> definitions = new HashMap<Integer, ItemDefinitions>();
    
    	/**
    	 * Fetches definitions map
    	 * 
    	 * @param id
    	 * @return
    	 */
    	public static ItemDefinitions get(int id) {
    		return definitions.get(id);
    	}
    
    	/**
    	 * Logger
    	 */
    	private static final Logger logger = Logger.getLogger(ItemDefinitions.class.getName());
    
    	/**
    	 * Loads the definitions from XML file
    	 * 
    	 * @throws FileNotFoundException
    	 */
    	@SuppressWarnings({ "unchecked" })
    	public static void loadDefinitions() throws FileNotFoundException {
    		logger.info("Loading item definitions...");
    		List<ItemDefinitions> definitionList = (List<ItemDefinitions>) XMLController.getxStream().fromXML(
    				new FileInputStream("./Data/item_definitions.xml"));
    
    		for (ItemDefinitions defs : definitionList) {
    			definitions.put(defs.getId(), defs);
    		}
    		logger.info("..." + definitions.size() + " item definitions loaded.");
    	}
    
    	/**
    	 * Item id
    	 */
    	private int id;
    
    	/**
    	 * Item name
    	 */
    	private String name;
    
    	/**
    	 * Item description
    	 */
    	private String examine;
    
    	/**
    	 * Item price
    	 */
    	private int price;
    
    	/**
    	 * Stackable indicator
    	 */
    	private boolean stackable = false;
    
    	/**
    	 * Noted indicator
    	 */
    	private boolean noted = false;
    
    	/**
    	 * Item bonuses
    	 */
    	private int[] bonuses = new int[14];
    
    	/**
    	 * Tradeable indicator
    	 */
    	private boolean tradeable = true;
    
    	/**
    	 * Item alch values
    	 */
    	private int[] alchValues = new int[2];
    
    	/**
    	 * Item weight
    	 */
    	private double weight;
    
    	public int getId() {
    		return this.id;
    	}
    
    	public String getName() {
    		return this.name;
    	}
    
    	public String getExamine() {
    		return this.examine;
    	}
    
    	public int getPrice() {
    		return this.price;
    	}
    
    	public boolean isStackable() {
    		return this.stackable;
    	}
    
    	public boolean isNoted() {
    		return this.noted;
    	}
    
    	public int[] getBonuses() {
    		return this.bonuses;
    	}
    
    	public boolean tradeable() {
    		return this.tradeable;
    	}
    
    	public int[] getAlchValues() {
    		return this.alchValues;
    	}
    
    	public double getWeight() {
    		return this.weight;
    	}
    }


    inb4youshouldatleastusejson
    Hi there, was wondering where you dumped the alch prices from?
    Reply With Quote  
     

Page 2 of 2 FirstFirst 12

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. #118 Equipment Definitions.xml
    By Dinh in forum Requests
    Replies: 4
    Last Post: 07-31-2016, 06:43 AM
  2. #110 Item Definitions .xml
    By Severus in forum Requests
    Replies: 0
    Last Post: 03-31-2016, 02:29 PM
  3. Replies: 13
    Last Post: 02-20-2016, 12:08 AM
  4. Replies: 7
    Last Post: 11-07-2012, 09:35 PM
  5. [HYPERION] Adding new item definition's
    By AlexMason in forum Tutorials
    Replies: 15
    Last Post: 04-09-2011, 02:23 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •