I just finished importing the Item.CFG file into my SQL database, thought I would share the SQL file and query for people looking to use SQL type loading.
You can download it here.
Code:
public boolean loadItemList() {
if(!SQLEngine.Online) {System.out.println("SQL Engine is not online. Item Spawns failed."); return false;}
String Query = "SELECT * FROM items";
try {
Statement S = World.createStatement();
ResultSet R = S.executeQuery(Query);
int[] Bonuses = new int[12];
int ID = 0;
String IName;
String IDes;
int ShopVal;
int LowAlch;
int HighAlch;
while (R.next()) {
ID = R.getInt("ItemID");
IName = R.getString("ItemName");
IDes = R.getString("Description");
ShopVal = R.getInt("ShopValue");
LowAlch = R.getInt("LowAlch");
HighAlch = R.getInt("HighAlch");
Bonuses[0] = R.getInt("AttackStab");
Bonuses[1] = R.getInt("AttackSlash");
Bonuses[2] = R.getInt("AttackCrush");
Bonuses[3] = R.getInt("AttackMagic");
Bonuses[4] = R.getInt("AttackRange");
Bonuses[5] = R.getInt("DefenceStab");
Bonuses[6] = R.getInt("DefenceSlash");
Bonuses[7] = R.getInt("DefenceCrush");
Bonuses[8] = R.getInt("DefenceMagic");
Bonuses[9] = R.getInt("DefenceRange");
Bonuses[10] = R.getInt("StrengthBonus");
Bonuses[11] = R.getInt("PrayerBonus");
/*This is where you put the Item into the JVM, my method here may not work for your source.*/
newItemList(ID,IName,IDes,ShopVal,LowAlch,HighAlch,Bonuses);
}
System.out.println("Item Data Loaded from Database.");
return true;
} catch (Exception E) {
System.out.println("Error Loading Item Data: "+E);
return false;
}
}
Enjoy.