RuneScape 2 Development > Server Help

718 Matrix 1 - Trying to Edit ItemBonuses!

Pages: (1/1)

Stilah:

Every time I edit the item bonuses I can Unpack , No problems.
I use Eclipse to run the .java and it works fine.

And here's the ItemBonusUnpacker.java's code :


--- Code: ---package com.rs.tools;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import com.rs.cache.Cache;
import com.rs.utils.ItemBonuses;
import com.rs.utils.Utils;

/**
 * @author Frosty Teh Snowman
 *
 *         Unpacks the Item Bonuses that are packed into the bonuses.ib file.
 */
public class ItemBonusesUnpacker {

public static final void main(String[] args) {
log("Unpacker Started.");
try {
Cache.init();
log("Cache Initiated.");
} catch (IOException e) {
log("Exception in initializing cache.");
}
ItemBonuses.init();
log("Item Bonuses Initiated.");
for (int itemId = 0; itemId < Utils.getItemDefinitionsSize(); itemId++) {
log("Getting Values for item " + itemId);
int[] bonuses = ItemBonuses.getItemBonuses(itemId);
File file = new File("data/items/bonuses/" + itemId + ".txt");
try {
if (file.createNewFile()) {
BufferedWriter writer = new BufferedWriter(new FileWriter(
file));
writer.write("Attack Bonus");
writer.newLine();
writer.write(Integer.toString(bonuses[0]));
writer.newLine();
writer.write(Integer.toString(bonuses[1]));
writer.newLine();
writer.write(Integer.toString(bonuses[2]));
writer.newLine();
writer.write(Integer.toString(bonuses[3]));
writer.newLine();
writer.write(Integer.toString(bonuses[4]));
writer.newLine();
writer.write("Defense Bonus");
writer.newLine();
writer.write(Integer.toString(bonuses[5]));
writer.newLine();
writer.write(Integer.toString(bonuses[6]));
writer.newLine();
writer.write(Integer.toString(bonuses[7]));
writer.newLine();
writer.write(Integer.toString(bonuses[8]));
writer.newLine();
writer.write(Integer.toString(bonuses[9]));
writer.newLine();
writer.write(Integer.toString(bonuses[10]));
writer.newLine();
writer.write("Damage Absorption");
writer.newLine();
writer.write(Integer.toString(bonuses[11]));
writer.newLine();
writer.write(Integer.toString(bonuses[12]));
writer.newLine();
writer.write(Integer.toString(bonuses[13]));
writer.newLine();
writer.write("Other Bonuses");
writer.newLine();
writer.write(Integer.toString(bonuses[14]));
writer.newLine();
writer.write(Integer.toString(bonuses[15]));
writer.newLine();
writer.write(Integer.toString(bonuses[16]));
writer.newLine();
writer.write(Integer.toString(bonuses[17]));
writer.flush();
writer.close();
}
} catch (Exception e) {
}
}
log("Finished Unpacking.");
}

private static void log(String s) {
System.out.println(s);
}

}

--- End code ---

But here's the ItemBonusesPacker.java


--- Code: ---package com.rs.tools;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;

import com.rs.cache.Cache;
import com.rs.utils.Utils;

public class ItemBonusesPacker {

public static final void main(String[] args) throws IOException {
Cache.init();
DataOutputStream out = new DataOutputStream(new FileOutputStream(
"data/items/bonuses.ib"));
for (int itemId = 0; itemId < Utils.getItemDefinitionsSize(); itemId++) {
File file = new File("bonuses/" + itemId + ".txt");
if (file.exists()) {
BufferedReader reader = new BufferedReader(new FileReader(file));
out.writeShort(itemId);
reader.readLine();
// att bonuses
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
reader.readLine();
// def bonuses
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
reader.readLine();
// Damage absorption
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
reader.readLine();
// Other bonuses
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
out.writeShort(Integer.valueOf(reader.readLine()));
if (reader.readLine() != null)
throw new RuntimeException("Should be null line" + itemId);
}
}
out.flush();
out.close();
}

}

--- End code ---

I get this error if I run it with Eclipse.


--- Code: ---<terminated> ItemBonusesPacker [Java Application] C:\Program Files\jre7\bin\javaw.exe (Date & Time)

--- End code ---

If i try to use a Compiler (ItemBonusesPacker.bat)
It loops me in a different set of error.

Cannot find or Load com.rs.tools.itembonusespacker

Multiple Errors in ItemBonusesPacker.java or A wierd Cache.class Error with "alex.store.Store" in it...



Pages: (1/1)

Go to full version