#118 Item definitions > xml
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;
}
}
http://puu.sh/qsGVF/76eb7e8b7e.png
inb4youshouldatleastusejson