|
Hey Rune-server community!
So, I've had the problem myself, and I am aware many others have aswell, and all the posts about this issue is 2-4 years old and still alot of people are gravedigging for answers.
Well, write no longer, I have the solution.
So once I tell you the solution, you will think: "shit how simple!", I know i did.
So unless you don't already know this (which you probably do if you are here), then item bonuses are packed in a .ib file in "YOUR SERVER"\data\items\.
To unpack them, simply run ItemBonusesUnpacker through eclipse, this should already be in your server, located in "YOUR SERVER"\src\com\rs\tools\.
Incase you don't have it, here it is:
Now that is the easy part, you probably already have done that. But here comes the part where people have trouble.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); } }
So now you can of course edit the different item bonuses through opening the .txt files in your "YOUR SERVER"\data\items\bonuses\ folder.
But now to repacking them, yes you want to delete your bonuses.ib file first. And the default matrix 718 revision doesn't come with a ItemBonusesPacker. Though you have probably found it on other posts here, if you looked for it.
If not, here it is:
Oh, and if you are using your own, make sure the path in "File file = new File" is actually ("data/items/bonuses/" + itemId + ".txt") and not just (".bonuses/" + itemId + ".txt").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("data/items/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(); } }
But it still gives a damn error and the bonuses.ib file it creates is friggen 0kb right? Or some other random number, anyhow all stats in game turns to 0. It doesn't work.
I had this problem for quite awhile untill I found out what the "tiny" problem was.
So when you unpack the files, all items that has no stats at all will actually make a clean .txt completely empty. In order for your ItemBonusesPacker to work, they must be deleted.
So what? You have to go through 30.000 files and delete all that are empty?
Luckily not, as I found an easier way, so all .txt files that have anything at all in them, are the size 1kb, where-as the empty ones are 0kb in size. This is good, now theres some difference, this means we can make a .bat file to get rid of all that are 0kb large.
So go ahead and make a .txt file, put this in it:
Now save it as "All files" and call it whatever u want but have it end at .batCode:FOR %%F IN (*.*) DO ( IF %%~zF LSS 1 DEL %%F )
Now go ahead and place it in the "bonuses" folder.
Run it and it (make sure it's in the folder with all the .txt files) and it should delete all of them, keep it open untill you see it is no more deleting any files.
And now you can go ahead and sucessfully run (through eclipse or a.bat file) your ItemBonusesPacker.
Now all your files will be packed, and the bonuses.ib file will be 155kb large. ( thats when you know it works )
That's it for this tutorial, your welcome.
Note: if you have any questions. Just ask me down under, it might help someone else too.
- Reattach
There's also a gui tool for this available if ppl can't be bothered with hundreds of text files. Nice work though
Thanks!! Just run the packer/unpacker.java in eclipse!
I need help with this lol
The .bat file to remove the 0kb files was a nice extra, but didn't work for me, so i just simply deleted them in a detailed pane, took less than 10 seconds.
Thanks a bunch by the way! Got it working
What do you mean by run through eclipse , i can't find it man.
So I ran "ItemBonusesUnpacker.Java" that you gave me, from rs.tools, through Eclipse. It says "Getting Values for XXXXXX" Until 29999 and then it says "Finished Extracting". But nothing is found in "data.items"
Okay I just created a folder with bonus.ib named "bonuses" but still each txt that comes in there is empty....
Welp after putting my glasses on i finally figured things out, thank you very much and sorry for grave digging
Can somebody kindly help me with the Packer. I successfully unpacked all of the items, made my edits, and then when i go to repack, the .txt files stay there and the bonuses.ib files is 0kb. Thanks
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |