PDA

View Full Version : 317 - Recoloring through the Item Data



iMPeX
June 28th, 2010, 21:13
Note that this should be known by most programmers, and is very simple.

I'm going to take an item from the RuneScape Cache, which would be Black Platebody (T) and Black Platelegs (T).

First off, if you're going to recolor an item that's already in the RuneScape Cache, you're going to need to download this.

ItemDump.txt (Only the registered members can see the link.)

In that file are the items from RuneScape 317 cache, idk which version it is, but it'll work anyways. :P

Now, here is the code for Black Platebody (T) and Black Platelegs (T)...


if(i == 2583){
class8.aStringArray189 = new String[5];
class8.aStringArray189[1] = "Wear";
class8.aString170 = "Black platebody (t)";
class8.aByteArray178 = "Black plate body with trim.".getBytes();
class8.anIntArray156 = new int[3];
class8.anIntArray160 = new int[3];
class8.anIntArray156[0] = 24;
class8.anIntArray156[1] = 61;
class8.anIntArray156[2] = 41;
class8.anIntArray160[0] = 24;
class8.anIntArray160[0] = 8;
class8.anIntArray160[0] = 0;
class8.anInt174 = 2378;//Inv & Ground
class8.anInt181 = 1180;
class8.anInt190 = 452;
class8.anInt198 = 0;
class8.anInt204 = 0;
class8.anInt169 = -1;
class8.anInt194 = -1;
class8.anInt165 = 3379;//Male Wield View
class8.anInt200 = 3383;//Female Wield View
class8.anInt188 = 164;
class8.anInt164 = 344;
class8.anInt175 = -1;
class8.anInt197 = -1;
}


if(i == 2585){
class8.aStringArray189 = new String[5];
class8.aStringArray189[1] = "Wear";
class8.aString170 = "Black platelegs (t)";
class8.aByteArray178 = "Black platelegs with trim.".getBytes();
class8.anIntArray156 = new int[3];
class8.anIntArray160 = new int[3];
class8.anIntArray156[0] = 61;
class8.anIntArray156[1] = 41;
class8.anIntArray156[2] = 57;
class8.anIntArray160[0] = 8;
class8.anIntArray160[1] = 0;
class8.anIntArray160[2] = 24;
class8.anInt174 = 2582;//Inv & Ground
class8.anInt181 = 1740;
class8.anInt190 = 444;
class8.anInt198 = 0;
class8.anInt204 = 0;
class8.anInt169 = 0;
class8.anInt194 = -8;
class8.anInt165 = 268;//Male Wield View
class8.anInt200 = 432;//Female Wield View
class8.anInt188 = -1;
class8.anInt164 = -1;
class8.anInt175 = -1;
class8.anInt197 = -1;
}

Now to explain the main parts of the code...


if(i == ####){

Is just the ID of the item. You can replace an existing item, or make a new one, doesn't matter.


class8.aStringArray189[1] = "Wear";
class8.aString170 = "Black platelegs (t)";
class8.aByteArray178 = "Black platelegs with trim.".getBytes();

class8.aStringArray189[1] = "Wear"; is the option you'll see when you mouse over the item.
class8.aString170 = "Black platelegs (t)"; Is the name of the time, simple enough.
class8.aByteArray178 = "Black platelegs with trim.".getBytes(); Is the examine info.


class8.anInt165 = 268;//Male Wield View
class8.anInt200 = 432;//Female Wield View

Those are the female and male models.


class8.anInt174 = 2582;//Inv & Ground

That is the drop, and inventory model.

Now, to explain the recoloring...


class8.anIntArray156 = new int[3];
class8.anIntArray160 = new int[3];
class8.anIntArray156[0] = 61;
class8.anIntArray156[1] = 41;
class8.anIntArray156[2] = 57;
class8.anIntArray160[0] = 8;
class8.anIntArray160[1] = 0;
class8.anIntArray160[2] = 24;

This, is where the recoloring takes place.


class8.anIntArray156 = new int[3];
class8.anIntArray160 = new int[3];

That basically tells the client how many colors are going to be shown, and replaced.
Whenever you recolor an item, you have to tell the client how many colors are being put in, and how many are going to be replaced.


class8.anIntArray156 = new int[3];

The class8.anIntArray156 is the variable for the original color withing the model itself.


class8.anIntArray160 = new int[3];

The class8.anIntArray160 is the variable for the new color that is replacing the original.

Whenever you are doing either of those, you have to change the [3] to how many colors there are.

Like if you wanted say, 7 colors being shown, and then replaced, it'd be...


class8.anIntArray156 = new int[7];
class8.anIntArray160 = new int[7];

The only thing being changed in there is the number by the int.


class8.anIntArray156[0] = 61;
class8.anIntArray156[1] = 41;
class8.anIntArray156[2] = 57;
class8.anIntArray160[0] = 8;
class8.anIntArray160[1] = 0;
class8.anIntArray160[2] = 24;

These are the old and new colors.

As I stated before...

class8.anIntArray156 is the original color.
class8.anIntArray160 is the new color.

Whenever you are doing those two, say you have 3 original colors, and 3 new colors, it'll always be as so...


class8.anIntArray156[0] = #;
class8.anIntArray156[1] = #;
class8.anIntArray156[2] = #;
class8.anIntArray160[0] = #;
class8.anIntArray160[1] = #;
class8.anIntArray160[2] = #;

The new color ints, and original color ints, are always started with 0, then 1, 2, and so on.

When you put in...


class8.anIntArray156 = new int[3];
class8.anIntArray160 = new int[3];

The ints, [3] will always be the same as each other, and it will always be one more number than your finishing number, so if you put new int[3];, your colors will be... [0], [1], and [2].

Now...


class8.anIntArray156[0] = 61;
class8.anIntArray156[1] = 41;
class8.anIntArray156[2] = 57;
class8.anIntArray160[0] = 8;
class8.anIntArray160[1] = 0;
class8.anIntArray160[2] = 24;

In this, whatever int you have for 160, will replace the int for 156.

So the class8.anIntArray160[2] will replace the class8.anIntArray156[2].

Now, I'm going to make the gray, in Black (T), into white, and then show you a picture of it...

I'm also going to be using a 16-Bit color code, but you can use just about anything, HTML colors, 16-bit, etc.


if(i == New item ID){
class8.aStringArray189 = new String[5];
class8.aStringArray189[1] = "New item option";
class8.aString170 = "New item name";
class8.aByteArray178 = "New item examine info".getBytes();
class8.anIntArray156 = new int[3];
class8.anIntArray160 = new int[3];
class8.anIntArray156[0] = 24;
class8.anIntArray156[1] = 61;
class8.anIntArray156[2] = 41;
class8.anIntArray160[0] = 0x007f;
class8.anIntArray160[1] = 8;
class8.anIntArray160[2] = 0;
class8.anInt174 = 2378;//Inv & Ground
class8.anInt181 = 1180;
class8.anInt190 = 452;
class8.anInt198 = 0;
class8.anInt204 = 0;
class8.anInt169 = -1;
class8.anInt194 = -1;
class8.anInt165 = 3379;//Male Wield View
class8.anInt200 = 3383;//Female Wield View
class8.anInt188 = 164;
class8.anInt164 = 344;
class8.anInt175 = -1;
class8.anInt197 = -1;
}

As you can see, I bolded and italicized the 0x007f (that being white).

When using 16-bit color codes, you have to put 0x in front of it, just to show that it is a color.

And the...


class8.anIntArray156[0] = 24;

Is gray, and since the white is used as [0], it replaces the gray.

Although, the model used for black t, is just a recolored iron platebody, so it was quite simple to figure out which one was gray.

Now, you could just add that into your class8 and compile, and you'd be set. Of course, if you added it as a new item, you'd have to do your item class things, server sided to show that it is a platebody.

Picture of the recolored platebody...

Only the registered members can see the link.

Thanks.
iMPeX

TehCow
June 28th, 2010, 22:33
Pretty good guide.
Im thinking bout starting a 317 again.

XxBryantD
June 28th, 2010, 22:54
nice goodjob

iMPeX
June 29th, 2010, 00:24
Fun stuff. thanks guys, appreciate it. :P

exlot
June 29th, 2010, 06:59
how do you know white is that code? what are you using?

AlexDGr8r
June 30th, 2010, 13:58
Nice guide, but shouldn't this be in Client Hacking? IDK, but good job on explaining it. It will help a lot of ppl out.

iMPeX
July 2nd, 2010, 20:18
@Exlot, if you want to know some simple 16-Bit color codes, go over to Run3-Server and find a tut by Yarnova, (Ray), he has a tut on it.

Thanks Alex, and no, I'm pretty sure this is Teaching. :P