
Originally Posted by
Jason
Good job, it's unfortunate that the cache doesn't contain equipment values and other useful item statistics. How did you go about generating this list? How accurate is it?
dumped straight from oswiki, should be pretty accurate, iirc i forgot prayer bonuses.
Feel free if you ever need to dump higher cache revision bonuses.
Code:
public static void dumpBonuses(int totalItems) {
int[] bonuses = new int[12];
int bonus = 0;
for (int i = 6345; i < totalItems; i++) {
ItemDef item = ItemDef.forID(i);
URL url;
try {
try {
try {
url = new URL("http://2007.runescape.wikia.com/wiki/"
+ item.name.replaceAll(" ", "_"));
URLConnection con = url.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String line;
BufferedWriter writer = new BufferedWriter(
new FileWriter("item.cfg", true));
while ((line = in.readLine()) != null) {
try {
if (line.contains("<td style=\"text-align: center; width: 35px;\">")) {
line = line
.replace("</td>", "")
.replace("%", "")
.replace("?", "").replace("\"\"", "")
.replace(
"<td style=\"text-align: center; width: 35px;\">",
"");
bonuses[bonus] = Integer.parseInt(line);
bonus++;
} else if (line
.contains("<td style=\"text-align: center; width: 30px;\">")) {
if (bonus == 10) {
line = line
.replace("</td>", "")
.replace("%", "")
.replace("?", "")
.replace("%", "")
.replace(
"<td style=\"text-align: center; width: 30px;\">",
"");
bonuses[bonus] = Integer.parseInt(line);
bonus++;
}
}
} catch (NumberFormatException e) {
}
if (bonus >= 11)
bonus = 0;
// in.close();
}
in.close();
writer.write("item = " + i + " "
+ item.name.replace(" ", "_") + " "
+ item.description.replace(" ", "_") + " "
+ item.value + " " + item.value + " "
+ item.value + " " + bonuses[0] + " "
+ bonuses[1] + " " + bonuses[2] + " "
+ bonuses[3] + " " + bonuses[4] + " "
+ bonuses[5] + " " + bonuses[6] + " "
+ bonuses[7] + " " + bonuses[8] + " "
+ bonuses[9] + " " + bonuses[10] + " "
+ bonuses[11]);
bonuses[0] = bonuses[1] = bonuses[2] = bonuses[3] = bonuses[4] = bonuses[5] = bonuses[6] = bonuses[7] = bonuses[8] = bonuses[9] = bonuses[10] = bonuses[11] = 0;
writer.newLine();
writer.close();
} catch (NullPointerException e) {
}
} catch (FileNotFoundException e) {
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}