Thread: [718] How to edit item bonuses, the RIGHT way! [718]

Results 1 to 10 of 10
  1. #1 [718] How to edit item bonuses, the RIGHT way! [718] 
    Registered Member reattach's Avatar
    Join Date
    Apr 2012
    Posts
    51
    Thanks given
    2
    Thanks received
    12
    Rep Power
    12
    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:
    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);
    	}
    
    }
    Now that is the easy part, you probably already have done that. But here comes the part where people have trouble.

    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:
    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();
    		   }
    
    		}
    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").

    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:
    Code:
    FOR %%F IN (*.*) DO (
    IF %%~zF LSS 1 DEL %%F
    )
    Now save it as "All files" and call it whatever u want but have it end at .bat

    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
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    WebDeveloper
    Charlie''s Avatar
    Join Date
    Sep 2011
    Age
    27
    Posts
    577
    Thanks given
    37
    Thanks received
    27
    Rep Power
    10
    Nice guide will be useful.

    Reply With Quote  
     

  4. #3  
    Registered Member reattach's Avatar
    Join Date
    Apr 2012
    Posts
    51
    Thanks given
    2
    Thanks received
    12
    Rep Power
    12
    Quote Originally Posted by SirusX View Post
    Thank you for this!
    Your welcome

    Quote Originally Posted by Charlie' View Post
    Nice guide will be useful.
    I hope so

    - Reattach
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    May 2012
    Posts
    286
    Thanks given
    7
    Thanks received
    49
    Rep Power
    25
    There's also a gui tool for this available if ppl can't be bothered with hundreds of text files. Nice work though
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    Apr 2016
    Posts
    3
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Thanks!! Just run the packer/unpacker.java in eclipse!
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Apr 2016
    Posts
    54
    Thanks given
    0
    Thanks received
    3
    Rep Power
    0
    I need help with this lol
    #1 pre-eoc rsps pking commentary, please watch!
    Reply With Quote  
     

  8. #7  
    Registered Member
    Join Date
    Mar 2016
    Posts
    18
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    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
    Reply With Quote  
     

  9. #8  
    Registered Member
    Join Date
    Jan 2016
    Posts
    5
    Thanks given
    0
    Thanks received
    2
    Rep Power
    0
    What do you mean by run through eclipse , i can't find it man.
    Reply With Quote  
     

  10. #9  
    Registered Member
    Join Date
    Oct 2015
    Posts
    52
    Thanks given
    14
    Thanks received
    2
    Rep Power
    23
    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
    Reply With Quote  
     

  11. #10  
    Registered Member
    Join Date
    Jun 2017
    Posts
    5
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    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
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 2
    Last Post: 03-14-2014, 12:53 AM
  2. how to change item bonuses 718
    By Nimesh89 in forum Help
    Replies: 2
    Last Post: 04-15-2013, 08:58 PM
  3. how to change item bonuses? [667]
    By getsuga121 in forum Help
    Replies: 0
    Last Post: 07-29-2012, 07:39 PM
  4. How to edit item bonuses 667/711
    By edgar1016 in forum Help
    Replies: 13
    Last Post: 04-18-2012, 11:39 PM
  5. [tut]how to edit weapon bonuses[tut]
    By zauruke in forum Tutorials
    Replies: 4
    Last Post: 08-28-2007, 01:59 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •