Thread: How to Add Custom Items [Client-Sided] [718 loading 718-RS3]

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 How to Add Custom Items [Client-Sided] [718 loading 718-RS3] 
    DrygonScape Developer
    kryeus's Avatar
    Join Date
    May 2016
    Posts
    10
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    So after not finding a tutorial like this anywhere, I decided to develop it for myself and give back to the RSPS community to those learning to code and existing developers. I know it would be easier to use an Item Def Editor for any cache before 745, but anyone developing on the Valkyr or Helwyr sources that were released won't be able to add custom items due to most of them not having a working Item Def Editor.

    STEP 1: Finding the Location for Your Code to Go

    If you're using a standard 718 client, you're going to want to open up the file ItemDefinitions.java [de-obfuscated name of Class468] in Eclipse, or your default text editor. Search for the following method (depending on actual client, some fields/variables might be different, but it's the method that reads the opcodes from the server)

    Code:
    	void decode(RsByteBuffer stream, int opcode) {
    		try {
    			if (1 == opcode)
    				this.invModelId = (stream.readBigSmart(1235052657));

    Under the else if statement for Opcode #249, there should be a for each statement for processing the client script maps. (In layman's terms, this means it runs for each value (item id) in a given list (array)) Directly below this for each statement is going to be where you will be creating your custom items.

    STEP 2: Building your custom item from existing models and color codes

    So for this example I will be turning the off-white partyhat item (Item Id #28702) into a lava colored partyhat with the name Example partyhat and the color of lava yellow. Paste this blank snippet below the for each statement. (If it gives you compile errors, please load it in eclipse as this will help you track down the actual variable name (depending on client))

    Code:
    					if(name.equalsIgnoreCase(""))
    					{
    						
    						name = "";
    						aStringArray5732[1] = "Wear";
    						maleEquipModelId1 = ;
    						femaleEquipModelId1 = ;
    						originalModelColors[0] = ; 
    						modifiedModelColors[0] = (short) ;
    					}
    So comparatively, my complete edited working statement would be:

    Code:
    					if(name.equalsIgnoreCase("off-white partyhat")){
    						name = "Example Partyhat";
    						aStringArray5732[1] = "Wear";
    						maleEquipModelId1 = 187;
    						femaleEquipModelId1 = 363;
    						originalModelColors[0] = 926; 
    						modifiedModelColors[0] = (short) 6073;
    					}
    So to give some context to what exactly each line of code does, so you can make your own items....
    Line #1: To determine what item name you will be changing, this could be anything from "bandos godsword" to "obsidian gloves". Just make sure it's an item that's never going to be used, it cannot be a null
    Line #2: This changes the item name - client sided only, the server will still think it is called "off-white partyhat"
    Line #3: This adds the wear option to the inventory options on the client side of things. (Server side code coming below)
    Line #4: This changes the Male model ID in the cache that you will be using, and then modifying. (187 is universal male phat model #)
    Line #5: This changes the Female model ID in the cache that you will be using, and then modifying. (363 is universal female phat model #)
    Line #6: This sets the original model color that you will be changing, I didn't make the color white for mine, and it still worked in-game.
    Line #7: This sets the new color code for your item, 6073 is lava. I will link the color ID list I used from CNova below.

    STEP 3: Letting your source know that you're making some mods to an item.

    This step is crucial when adding any type of custom colored equipment or else the server will reject the client's request to equip the item, or equip it in the wrong item slot. Navigate to your Equiptment.java file in your Source and find the getItemSlot method. Add the following statement below it.

    Code:
        	if (itemId == 28703)
        		return Equipment.SLOT_HAT;
    Make sure to change the Item ID to the Item ID that you are replacing and change the Equipment Enum/byte to the proper equipment slot. The full list of them should be at the start of the class. (Ex. If you're making a custom Spirit Shield, it would be Equipment.SLOT_SHIELD instead)


    STEP 4: Save and Compile!

    Save and compile your source and client (if you're in eclipse just make sure the files are saved) and then log in and spawn your item!


    Resources

    IDE Model Colour ID's

    Please let me know if this helps you as a developer, as that will encourage me to share more tutorials for things that I had to figure out myself due to lack of resources out there.
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jul 2011
    Posts
    1,767
    Thanks given
    493
    Thanks received
    425
    Rep Power
    0
    cool guide actually but I don't think a lot of released clients have deobfuscated the fields that you provided in this tutorial
    Reply With Quote  
     

  3. #3  
    DrygonScape Developer
    kryeus's Avatar
    Join Date
    May 2016
    Posts
    10
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by _hassan View Post
    cool guide actually but I don't think a lot of released clients has deobfuscated the fields that you provided in this tutorial
    I'll download the one that comes with Valkyr now and find the original IDs. I refactored most of the fields I commonly change in my client so I don't remember them anymore lol.

    Quote Originally Posted by _hassan View Post
    cool guide actually but I don't think a lot of released clients have deobfuscated the fields that you provided in this tutorial
    So as it turns out, in the Valkyr Client, ItemDefinitions.java is deob'ed, but the opcode is under #249, still the last one on the list. It also has the comments "//client script map" after the for each loop.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jul 2011
    Posts
    1,767
    Thanks given
    493
    Thanks received
    425
    Rep Power
    0
    Quote Originally Posted by kryeus View Post
    I'll download the one that comes with Valkyr now and find the original IDs. I refactored most of the fields I commonly change in my client so I don't remember them anymore lol.



    So as it turns out, in the Valkyr Client, ItemDefinitions.java is deob'ed, but the opcode is under #249, still the last one on the list. It also has the comments "//client script map" after the for each loop.
    do you know how to duplicate an item to a custom ID via client?
    Reply With Quote  
     

  5. #5  
    DrygonScape Developer
    kryeus's Avatar
    Join Date
    May 2016
    Posts
    10
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by _hassan View Post
    do you know how to duplicate an item to a custom ID via client?
    Yeah I wrote my own method for it in ItemDefinitions.java. It basically takes two ItemDefinitions objects. It then sets the values of the initialized object/item to the values of the existing object/item. I'd post it here but that might be for a later tutorial seeing as how the method itself is half-deob'ed and it might scare children if I do.
    Reply With Quote  
     

  6. #6  
    Banned

    Join Date
    Jul 2011
    Posts
    1,767
    Thanks given
    493
    Thanks received
    425
    Rep Power
    0
    Quote Originally Posted by kryeus View Post
    Yeah I wrote my own method for it in ItemDefinitions.java. It basically takes two ItemDefinitions objects. It then sets the values of the initialized object/item to the values of the existing object/item. I'd post it here but that might be for a later tutorial seeing as how the method itself is half-deob'ed and it might scare children if I do.
    ah very cool I would like to see that
    Reply With Quote  
     

  7. #7  
    van 't stad

    Shnek's Avatar
    Join Date
    Oct 2013
    Posts
    1,065
    Thanks given
    343
    Thanks received
    297
    Rep Power
    109
    Goodjob on finding but, I suggest doing it cache sided with an editor
    Attached image

    Do not use the vps from ovh, blocking vps without reason and no customer support
    Reply With Quote  
     

  8. #8  
    DrygonScape Developer
    kryeus's Avatar
    Join Date
    May 2016
    Posts
    10
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by omglolomghi View Post
    Goodjob on finding but, I suggest doing it cache sided with an editor
    That's easy if you have a RS3 cache editor. But for any cache over 745 that becomes a luxury some developers can't afford haha
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Sep 2014
    Posts
    300
    Thanks given
    122
    Thanks received
    91
    Rep Power
    158
    Quote Originally Posted by kryeus View Post
    That's easy if you have a RS3 cache editor. But for any cache over 745 that becomes a luxury some developers can't afford haha
    Omglolomghi released a modified frosty cache editor that supports till RS3 cache I believe, so that shouldnt be a problem anymore kudos to him. Anyways, good find and thanks for the release. I like client-sided finds and tutorials.
    Reply With Quote  
     

  10. #10  
    DrygonScape Developer
    kryeus's Avatar
    Join Date
    May 2016
    Posts
    10
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by Banners View Post
    Omglolomghi released a modified frosty cache editor that supports till RS3 cache I believe, so that shouldnt be a problem anymore kudos to him. Anyways, good find and thanks for the release. I like client-sided finds and tutorials.
    At the time of this post, it didn't exist. So I'm glad he released it as it will make so many developers lives easier. Props to him, I'll definitely be taking a look and thanking him!
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. [718/***]How To Add Custom items
    By Trexed in forum Tutorials
    Replies: 112
    Last Post: 12-08-2015, 12:08 AM
  2. Replies: 3
    Last Post: 10-17-2015, 01:46 AM
  3. How to add custom items/recolor items
    By Shayn in forum Help
    Replies: 5
    Last Post: 09-15-2013, 03:43 AM
  4. Replies: 2
    Last Post: 09-05-2013, 12:29 AM
  5. How to add Custom Items to a 562 RSPS?
    By Exorcist in forum Help
    Replies: 1
    Last Post: 07-19-2011, 09:15 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •