This only the client sided part of the interface. I myself have not coded the server sided part yet. Maybe I'll post the server sided coding later. This is also my first release on here!!
Anyways these are the statistics:
Difficulty: 0/10 (I will be spoon feeding you the Snippet)
Classes modified: Client.java RSInterface.java
Version of RSPS: 317 (its a PI server, but client doesn't matter)
Things you will need (Which I will provide): The sprite for the interface
Things you will need {Which I will NOT provide): The preview of your bosses/boss locations ( will explain how to get them)
Lets begin shall we?
First lets download that sprite you need:
Credits to who ever originally made this sprite. (Not sure honestly)
Next add that to your cache. (In this snippet we will not be packing it to the cache, but do not fear its not hard to code the interface when the sprite is packed to the cache. It is pretty much coded the same way just maybe a few name changes, I'll post a snippet on it if need be)
Now this where the coding comes in to play.... Open your RSInterface.java
You need to add a few things here:
First add this somewhere in there...
What this does is allow you to change a sprite on an interface without having to restart the client.
How it works is by storing the sprites in an array (tab.sprites = an array)
the for loop is adding sprites to that array. Then by editing an int inside the client.java class ( we will get to that in a minute )
the interface will show the sprite you set the int inside client.java to. (again we will get to that in a minute)
The rest really isn't important so we won't dive into that stuff.
Next we need to add the the actual interface to RSInterface so lets do that:
Some where add these methods ( for neatness add them together)
Yes I know I used an enum to store the information for the interface... sue me.
I just did that because it makes it easier for me to code the interface and you will see why when we get to it.
All this enum is doing is just simply storing information that the interface will use, such as the frame the text/button will go on, the coords for where the text/button will be at, the text, and the tooltip the player sees when hovering the button.
Lets move on to the next step... or enum...
This enum does the same thing as the last one just different things being stored in them. I guess you could combine them if you want...
Now for the actual interface coding!!
Ok so what we have here is how the actual interface is being made. I'm not going to explain everything in here because its a lot to explain but I think most people on here will understand how things work here...
But if you look closely you can see how the enums make the coding a little easier. Atleast for me they do anyways.
NOTE: The 3rd number in the "addChangeableSprite method ( addChangeableSprite 14402, -1, '9') in this case it's 9.
That's the amount of preview sprites you are adding to the interface. The number before that is the default sprite (-1 meaning no sprite)
Now the only thing you have to do in RSInterface is search for
It should have something similar to streamloader after an '(' Unless your client has things renamed.
(Basically is where the interfaces are unpacked)
add this somewhere underneath your other interfaces:
That should be everything in RSInterface.java
Lets move on to Client.java
You first need to scroll way to the bottom and add this:
This is just an int to will tell the interface which sprite to load.
Next you need to go into your drawInterface method (search for drawinterface)
It should look something like this:
What we want to do here find the last else if(rsChildren.type == ##...
My case it was:
so now that you found it you want to put the following after the closing bracket ( } ) that closes the else if statement
What this does is changes the sprite that is shown on the interface when the "previewSprite" int is changed.
The sprite it changes to is based on what the "previewSprite" int is changed to sprite[0] if previewSprite is 0 or sprite[1] if previewSprite is 1 etc...
Now how do we know this works?
Well that is a really good question... We don't... I'm just kidding of course we do otherwise I wouldn't be posting this.
To test it though you can make a command in the client.java class to change the preview sprite int.
An example of such command would be like this:
Simply put that under where your noclip command is or underneath one of your other client commands.
Now lets talk about how to make your own preview sprites. Tip: Its really simple actually...
Step 1:
First open up snipping tool or any other program that takes a screen shot.
Step 2:
Stand ingame where you want to make the preview sprite and simple take a screen shot. I like to use the snipping tool for this because you can create the area where the screen shot it taken.
Step 3:
Take a screen shot and save it somewhere.
Step 4:
Open your favorite image editing program and edit the size of the image to 130 x 112
Step 5: Save the image to where you put the main interface sprite you downloaded earlier.
If you packed the main interface sprite to your cache then pack the newly created image (the preview image) to your cache too. Repeat this for all the preview images you want to add.
I don't think I left anything out but this should be a pretty cut and clean snippet. You literally should just be able to copy and paste the stuff I presented here with little to no editing and it should work just fine.
Things you need to do though:
Make or use an existing packet to change the previewSprite int inside the Client.java class when clicking a button on the interface from the server. Difficulty: 1/10
Below I will add an image to show case what you are adding:
NOTE: The picture under the "Name" box is the preview image that is what will change based on the preview sprite
Anyways these are the statistics:
Difficulty: 0/10 (I will be spoon feeding you the Snippet)
Classes modified: Client.java RSInterface.java
Version of RSPS: 317 (its a PI server, but client doesn't matter)
Things you will need (Which I will provide): The sprite for the interface
Things you will need {Which I will NOT provide): The preview of your bosses/boss locations ( will explain how to get them)
Lets begin shall we?
First lets download that sprite you need:
Credits to who ever originally made this sprite. (Not sure honestly)
Next add that to your cache. (In this snippet we will not be packing it to the cache, but do not fear its not hard to code the interface when the sprite is packed to the cache. It is pretty much coded the same way just maybe a few name changes, I'll post a snippet on it if need be)
Now this where the coding comes in to play.... Open your RSInterface.java
You need to add a few things here:
First add this somewhere in there...
Java:
public static void addChangeableSprite(int ID, int defaultSprite, int amountOfSprites, String Dir) {
RSInterface tab = interfaceCache[ID] = new RSInterface();
tab.id = ID;
tab.parentID = ID;
tab.type = 14;
tab.atActionType = 0;
tab.contentType = 0;
tab.opacity = 0;
tab.mOverInterToTrigger = 52;
tab.sprites = new Sprite[amountOfSprites];
for(int i = 0; i < amountOfSprites; i++) {
tab.sprites[i] = imageLoader(i, Dir);
}
tab.sprite1 = imageLoader(defaultSprite, Dir);
}
What this does is allow you to change a sprite on an interface without having to restart the client.
How it works is by storing the sprites in an array (tab.sprites = an array)
the for loop is adding sprites to that array. Then by editing an int inside the client.java class ( we will get to that in a minute )
the interface will show the sprite you set the int inside client.java to. (again we will get to that in a minute)
The rest really isn't important so we won't dive into that stuff.
Next we need to add the the actual interface to RSInterface so lets do that:
Some where add these methods ( for neatness add them together)
Java:
public enum BossTeleportTextButtons {
/*Top of interface*/
Teleport(14403, 22, 15, "Teleport", "Teleport to your selected boss."),
Categories(14404, 100, 15, "Categories", "View "+Configuration.ClientName+"' s other teleports."),
Join(14405, 180, 15, "Join", "Join the player's instance you selected."),
Set_Price(14406, 260, 15, "Set Price", "Set your own price for others to pay when they join your instance!"),
Information(14407, 337, 15, "Information", "View important information of your selected boss."),
Exit(14408, 415, 15, "Exit", "Close the boss teleport interface."),
;
private int slot, x, y;
private String text, text2;
BossTeleportTextButtons(int slot, int x, int y, String text, String text2){
this.slot = slot;
this.x = x;
this.y = y;
this.text = text;
this.text2 = text2;
}
public int getSlot() {
return slot;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public String getText() {
return text;
}
public String getToolTip() {
return text2;
}
}
Yes I know I used an enum to store the information for the interface... sue me.
I just did that because it makes it easier for me to code the interface and you will see why when we get to it.
All this enum is doing is just simply storing information that the interface will use, such as the frame the text/button will go on, the coords for where the text/button will be at, the text, and the tooltip the player sees when hovering the button.
Lets move on to the next step... or enum...
Java:
public enum BossTeleportText {
BossName(14409, 233, 62, "Name"),
Players(14410, 400, 62, "Players"),
Drops(14411, 228, 239, "Drops"),
;
private int slot, x, y;
private String text;
BossTeleportText(int slot, int x, int y, String text){
this.slot = slot;
this.x = x;
this.y = y;
this.text = text;
}
public int getSlot() {
return slot;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public String getText() {
return text;
}
}
This enum does the same thing as the last one just different things being stored in them. I guess you could combine them if you want...
Now for the actual interface coding!!
Java:
public static void BossTeleports(TextDrawingArea[] tda) {
RSInterface main = addTabInterface(14400);
addSprite(14401, 0, "Interfaces/TeleportInterface/Bosses/Main");
addChangeableSprite(14402, -1, 9, "Interfaces/TeleportInterface/Bosses/Preview");
for(BossTeleportTextButtons bttb : BossTeleportTextButtons.values()) {
addHoverText(bttb.getSlot(), bttb.getText(), bttb.getToolTip(), tda, 1, 0xff0000, true, true, 70, 13);
}
for(BossTeleportText btt : BossTeleportText.values()) {
addText(btt.getSlot(), btt.getText(), tda, 3, 14929103, true, true);
}
int totalChildren = BossTeleportTextButtons.values().length + BossTeleportText.values().length + 5;
int frame = 2;
setChildren(totalChildren, main);
setBounds(14401, 5, 5, 0, main);
setBounds(14402, 155, 84, 1, main);
for(BossTeleportTextButtons bttb : BossTeleportTextButtons.values()) {
setBounds(bttb.getSlot(), bttb.getX(), bttb.getY(), frame, main);
frame++;
}
for(BossTeleportText btt : BossTeleportText.values()) {
setBounds(btt.getSlot(), btt.getX(), btt.getY(), frame, main);
frame++;
}
setBounds(14412, 13, 67, frame, main);
frame++;
setBounds(14463, 333, 88, frame, main);
frame++;
setBounds(14514, 160, 265, frame, main);
/*Boss names scroll*/
RSInterface BossScroll = addInterface(14412);
BossScroll.height = 253;
BossScroll.width = 110;
BossScroll.scrollMax = 1700;
int totalBosses = 50;
int y = 10;
for(int i = 0; i < totalBosses; i++) {
addHoverText(14413 + i, "Boss "+i, "Select this boss", tda, 2, 0xff0000, true, true, 70, 13);
}
setChildren(totalBosses, BossScroll);
for(int i = 0; i < totalBosses; i++) {
setBounds(14413 + i, 20, y, i, BossScroll);
y += 20;
}
/*Player names scroll*/
RSInterface PlayerScroll = addInterface(14463);
PlayerScroll.height = 106;
PlayerScroll.width = 150;
PlayerScroll.scrollMax = 1700;
int totalPlayers = 50;
int yy = 10;
for(int i = 0; i < totalPlayers; i++) {
addHoverText(14464 + i, "Player "+i, "Select this player to join", tda, 2, 0xff0000, true, true, 70, 13);
}
setChildren(totalPlayers, PlayerScroll);
for(int i = 0; i < totalPlayers; i++) {
setBounds(14464 + i, 20, yy, i, PlayerScroll);
yy += 20;
}
/*Npc Drops scroll*/
RSInterface DropScroll = addInterface(14514);
DropScroll.height = 55;
DropScroll.width = 323;
DropScroll.scrollMax = 1700;
addItemToInterface(14515, 14514, 5, 10, null, null, null, null, null);
setChildren(1, DropScroll);
setBounds(14515, 20, 10, 0, DropScroll);
}
But if you look closely you can see how the enums make the coding a little easier. Atleast for me they do anyways.
NOTE: The 3rd number in the "addChangeableSprite method ( addChangeableSprite 14402, -1, '9') in this case it's 9.
That's the amount of preview sprites you are adding to the interface. The number before that is the default sprite (-1 meaning no sprite)
Now the only thing you have to do in RSInterface is search for
Java:
static void unpackCustom
(Basically is where the interfaces are unpacked)
add this somewhere underneath your other interfaces:
Java:
BossTeleports(textDrawingAreas);
That should be everything in RSInterface.java
Lets move on to Client.java
You first need to scroll way to the bottom and add this:
Java:
public int previewSprite = 1;
This is just an int to will tell the interface which sprite to load.
Next you need to go into your drawInterface method (search for drawinterface)
It should look something like this:
Java:
private void drawInterface(int yScrollPoint, int xPadding, RSInterface rsInterface, int yPadding) {
try {
if(rsInterface.type != 0 || rsInterface.children == null)
return;
if(rsInterface.isMouseoverTriggered && lastHoverChildId != rsInterface.id && anInt1048 != rsInterface.id && anInt1039 != rsInterface.id)
return;
int xTopPos = DrawingArea.topX;
int yTopPos = DrawingArea.topY;
int xBottomPos = DrawingArea.bottomX;
int yBottomPos = DrawingArea.bottomY;
DrawingArea.setDrawingArea(yPadding + rsInterface.height, xPadding, xPadding + rsInterface.width, yPadding);
int totalChildren = rsInterface.children.length;
for(int childIndex = 0; childIndex < totalChildren; childIndex++) {
/*Change these xspritepos and yspritepos for resize/fullscreen*/
int xSpritePos = rsInterface.childX[childIndex] + xPadding;
int ySpritePos = (rsInterface.childY[childIndex] + yPadding) - yScrollPoint;
RSInterface rsChildren = RSInterface.interfaceCache[rsInterface.children[childIndex]];
xSpritePos += rsChildren.anInt263;
ySpritePos += rsChildren.anInt265;
if(rsChildren.contentType > 0)
drawFriendsListOrWelcomeScreen(rsChildren);
//here
int[] IDs = {
1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573,
1290, 1299, 1308, 1315, 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388,
1397, 1404, 1583, 12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469, 15878,
1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553,
1563, 1593, 1635, 12426, 12436, 12446, 12456, 6004, 18471,
/* Ancients */
12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062,
12952, 13000, 13070, 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096
};
for(int m5 = 0; m5 < IDs.length; m5++) {
if(rsChildren.id == IDs[m5] + 1) {
if(m5 > 61)
drawBlackBox(xSpritePos + 1, ySpritePos);
else
drawBlackBox(xSpritePos, ySpritePos + 1);
}
}
int[] runeChildren = {
1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245,
1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, 1295,
1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345,
1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400,
1401, 1407, 1408, 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450,
1456, 1457, 1463, 1464, 1465, 1472, 1473, 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499,
1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556,
1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605, 1606,
1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011, 8673, 8674, 12041,
12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460, 15881, 15882,
15885, 18474, 18475, 18478
};
for(int r = 0; r < runeChildren.length; r++)
if(rsChildren.id == runeChildren[r])
rsChildren.modelZoom = 775;
if(rsChildren.type == 0) {
drawOnBankInterface();
if(rsChildren.scrollPosition > rsChildren.scrollMax - rsChildren.height)
rsChildren.scrollPosition = rsChildren.scrollMax - rsChildren.height;
if(rsChildren.scrollPosition < 0)
rsChildren.scrollPosition = 0;
drawInterface(rsChildren.scrollPosition, xSpritePos, rsChildren, ySpritePos);
if(rsChildren.scrollMax > rsChildren.height)
drawScrollbar(rsChildren.height, rsChildren.scrollPosition, ySpritePos, xSpritePos + rsChildren.width, rsChildren.scrollMax,false);
} else if(rsChildren.type != 1)
if(rsChildren.type == 2) {
int spriteIndex = 0;
for(int l3 = 0; l3 < rsChildren.height; l3++) {
for(int l4 = 0; l4 < rsChildren.width; l4++) {
int k5 = xSpritePos + l4 * (32 + rsChildren.invSpritePadX);
int j6 = ySpritePos + l3 * (32 + rsChildren.invSpritePadY);
if(spriteIndex < 20) {
k5 += rsChildren.spritesX[spriteIndex];
j6 += rsChildren.spritesY[spriteIndex];
}
if(rsChildren.inv[spriteIndex] > 0) {
int k6 = 0;
int j7 = 0;
int inventoryItemId = rsChildren.inv[spriteIndex] - 1;
if(k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == spriteIndex) {
int selectedColour = 0;
if(itemSelected == 1 && itemSlotUsedOn == spriteIndex && anInt1284 == rsChildren.id)
selectedColour = 0xffffff;
Sprite itemSprite = ItemDef.getSprite(inventoryItemId, rsChildren.invStackSizes[spriteIndex], selectedColour);
if(itemSprite != null) {
if(activeInterfaceType != 0 && anInt1085 == spriteIndex && anInt1084 == rsChildren.id) {
k6 = super.mouseX - anInt1087;
j7 = super.mouseY - anInt1088;
if(k6 < 5 && k6 > -5)
k6 = 0;
if(j7 < 5 && j7 > -5)
j7 = 0;
if(anInt989 < 10) { // was 5
k6 = 0;
j7 = 0;
}
itemSprite.drawSprite1(k5 + k6, j6 + j7, 128);
if(j6 + j7 < DrawingArea.topY && rsInterface.scrollPosition > 0) {
int i10 = (anInt945 * (DrawingArea.topY - j6 - j7)) / 3;
if(i10 > anInt945 * 10)
i10 = anInt945 * 10;
if(i10 > rsInterface.scrollPosition)
i10 = rsInterface.scrollPosition;
rsInterface.scrollPosition -= i10;
anInt1088 += i10;
}
if(j6 + j7 + 32 > DrawingArea.bottomY && rsInterface.scrollPosition < rsInterface.scrollMax - rsInterface.height) {
int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
if(j10 > anInt945 * 10)
j10 = anInt945 * 10;
if(j10 > rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition)
j10 = rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition;
rsInterface.scrollPosition += j10;
anInt1088 -= j10;
}
} else if(atInventoryInterfaceType != 0 && atInventoryIndex == spriteIndex && atInventoryInterface == rsChildren.id)
itemSprite.drawSprite1(k5, j6, 128);
else
itemSprite.drawSprite(k5, j6);
if(rsChildren.parentID == 3824) {
infinityIcon.drawSprite(k5, j6);
} else if(itemSprite.maxWidth == 33 || rsChildren.invStackSizes[spriteIndex] != 1) {
int k10 = rsChildren.invStackSizes[spriteIndex];
smallFont.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6);//this is the shadow
if(k10 >= 1)
smallFont.method385(0xFFFF00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
if(k10 >= 100000)
smallFont.method385(0xFFFFFF, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
if(k10 >= 10000000)
smallFont.method385(0x00FF80, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
}
}
}
} else if(rsChildren.sprites != null && spriteIndex < 20) {
Sprite sprite = rsChildren.sprites[spriteIndex];
if(sprite != null)
sprite.drawSprite(k5, j6);
}
spriteIndex++;
}
}
} else if(rsChildren.type == 3) {
boolean flag = false;
if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
flag = true;
int j3;
if(interfaceIsSelected(rsChildren)) {
j3 = rsChildren.anInt219;
if(flag && rsChildren.anInt239 != 0)
j3 = rsChildren.anInt239;
} else {
j3 = rsChildren.textColor;
if(flag && rsChildren.textHoverColour != 0)
j3 = rsChildren.textHoverColour;
}
if(rsChildren.opacity == 0) {
if(rsChildren.aBoolean227)
DrawingArea.drawPixels(rsChildren.height, ySpritePos, xSpritePos, j3, rsChildren.width);
else
DrawingArea.fillPixels(xSpritePos, rsChildren.width, rsChildren.height, j3, ySpritePos);
} else if(rsChildren.aBoolean227)
DrawingArea.method335(j3, ySpritePos, rsChildren.width, rsChildren.height, 256 - (rsChildren.opacity & 0xff), xSpritePos);
else
DrawingArea.method338(ySpritePos, rsChildren.height, 256 - (rsChildren.opacity & 0xff), j3, rsChildren.width, xSpritePos);
} else if(rsChildren.type == 4) {
TextDrawingArea textDrawingArea = rsChildren.textDrawingAreas;
String s = rsChildren.message;
boolean flag1 = false;
if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
flag1 = true;
int i4;
if(interfaceIsSelected(rsChildren)) {
i4 = rsChildren.anInt219;
if(flag1 && rsChildren.anInt239 != 0)
i4 = rsChildren.anInt239;
if(rsChildren.disabledText.length() > 0)
s = rsChildren.disabledText;
} else {
i4 = rsChildren.textColor;
if(flag1 && rsChildren.textHoverColour != 0)
i4 = rsChildren.textHoverColour;
}
if(rsChildren.atActionType == 6 && aBoolean1149) {
s = "Please wait...";
i4 = rsChildren.textColor;
}
if(DrawingArea.width == 519) {
if(i4 == 0xffff00)
i4 = 255;
if(i4 == 49152)
i4 = 0xffffff;
}
if((rsChildren.parentID == 1151) || (rsChildren.parentID == 12855)) {
switch (i4) {
case 16773120: i4 = 0xFE981F; break;
case 7040819: i4 = 0xAF6A1A; break;
}
}
for(int l6 = ySpritePos + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
if(s.indexOf("%") != -1) {
do {
int k7 = s.indexOf("%1");
if(k7 == -1)
break;
if(rsChildren.id < 4000 || rsChildren.id > 5000 && rsChildren.id !=13921 && rsChildren.id !=13922 && rsChildren.id !=12171 && rsChildren.id !=12172)
s = s.substring(0, k7) + methodR(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
else
s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
} while(true);
do {
int l7 = s.indexOf("%2");
if(l7 == -1)
break;
s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(rsChildren, 1)) + s.substring(l7 + 2);
} while(true);
do {
int i8 = s.indexOf("%3");
if(i8 == -1)
break;
s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(rsChildren, 2)) + s.substring(i8 + 2);
} while(true);
do {
int j8 = s.indexOf("%4");
if(j8 == -1)
break;
s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(rsChildren, 3)) + s.substring(j8 + 2);
} while(true);
do {
int k8 = s.indexOf("%5");
if(k8 == -1)
break;
s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(rsChildren, 4)) + s.substring(k8 + 2);
} while(true);
}
int l8 = s.indexOf("\\n");
String s1;
if(l8 != -1) {
s1 = s.substring(0, l8);
s = s.substring(l8 + 2);
} else {
s1 = s;
s = "";
}
if(rsChildren.centerText)
textDrawingArea.method382(i4, xSpritePos + rsChildren.width / 2, s1, l6, rsChildren.textShadow);
else
textDrawingArea.method389(rsChildren.textShadow, xSpritePos, i4, s1, l6);
}
} else if(rsChildren.type == 5 || rsChildren.type == 10) {
Sprite sprite = null;
if(rsChildren.itemSpriteId1 != -1 && rsChildren.sprite1 == null) {
rsChildren.sprite1 = ItemDef.getSprite(rsChildren.itemSpriteId1, 1, (rsChildren.itemSpriteZoom1 == -1) ? 0 : -1,rsChildren.itemSpriteZoom1);
rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, 1, (rsChildren.itemSpriteZoom2 == -1) ? 0 : -1,rsChildren.itemSpriteZoom2);
//rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, rsChildren.invStackSizes[spriteIndex], selectedColour);
if(rsChildren.greyScale)
rsChildren.sprite1.greyScale();
}
if(interfaceIsSelected(rsChildren) || hoverSpriteId == rsChildren.id) {
sprite = rsChildren.sprite2;
} else {
sprite = rsChildren.sprite1;
}
if(spellSelected == 1 && rsChildren.id == spellID && spellID != 0 && sprite != null) {
sprite.drawSprite(xSpritePos, ySpritePos, 0xffffff);
} else {
if (sprite != null)
if(rsChildren.type == 5)
sprite.drawSprite(xSpritePos, ySpritePos);
else
sprite.drawSprite1(xSpritePos, ySpritePos, rsChildren.opacity);
}
if(autoCast && rsChildren.id == autocastId)
magicAuto.drawSprite(xSpritePos-3, ySpritePos-2);
} else if(rsChildren.type == 6) {
int k3 = Texture.textureInt1;
int j4 = Texture.textureInt2;
Texture.textureInt1 = xSpritePos + rsChildren.width / 2;
Texture.textureInt2 = ySpritePos + rsChildren.height / 2;
int i5 = Texture.anIntArray1470[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
int l5 = Texture.anIntArray1471[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
boolean flag2 = interfaceIsSelected(rsChildren);
int i7;
if(flag2)
i7 = rsChildren.anInt258;
else
i7 = rsChildren.anInt257;
Model model;
if(rsChildren.id == 60003) {
if (i7 == -1) {
model = rsChildren.method209(-1, -1, flag2);
} else {
Animation animation = Animation.anims[i7];
model = rsChildren.method209(
animation.anIntArray354[rsChildren.anInt246],
animation.anIntArray353[rsChildren.anInt246],
flag2);
}
} else {
if(i7 == -1) {
model = rsChildren.method209(-1, -1, flag2);
} else {
Animation animation = Animation.anims[i7];
model = rsChildren.method209(animation.anIntArray354[rsChildren.anInt246], animation.anIntArray353[rsChildren.anInt246], flag2);
}
}
if(model != null) {
if(rsChildren.id == 60003) {
//System.out.println(child.id+" - "+childX+" - "+childY+" - "+child.modelRotation2+" - "+child.modelRotation1+" - "+i5+" - "+l5);
if(getMCR().maxCapeColors != null) {
ItemDef def = ItemDef.forID(14019); // maxcape recolor
//System.out.println(Arrays.toString(maxCapeColors));
if(getMCR().maxCapeColor != null && getMCR().maxCapeSlot != -1 && getMCR().maxCapeSlot != -1) {
getMCR().previousMaxCapeColors[getMCR().maxCapeSlot] = getMCR().maxCapeColors[getMCR().maxCapeSlot];
int hash = JagexColor.toHSB(getMCR().maxCapeColor.getRed(), getMCR().maxCapeColor.getGreen(), getMCR().maxCapeColor.getBlue());
getMCR().maxCapeColors[getMCR().maxCapeSlot] = hash;
RSInterface.interfaceCache[getMCR().maxCapeInterfaceId].anInt219 = getMCR().maxCapeColor.getRGB();
getMCR().maxCapeColor = null;
}
for (int i11 = 0; i11 < getMCR().previousMaxCapeColors.length; i11++)
model.recolour(14019, getMCR().previousMaxCapeColors[i11], getMCR().maxCapeColors[i11]);
}
}
model.method482(rsChildren.modelRotation2, 0, rsChildren.modelRotation1, 0, i5, l5);
}
Texture.textureInt1 = k3;
Texture.textureInt2 = j4;
} else if(rsChildren.type == 7) {
TextDrawingArea textDrawingArea_1 = rsChildren.textDrawingAreas;
int k4 = 0;
for(int j5 = 0; j5 < rsChildren.height; j5++) {
for(int i6 = 0; i6 < rsChildren.width; i6++) {
if(rsChildren.inv[k4] > 0) {
ItemDef itemDef = ItemDef.forID(rsChildren.inv[k4] - 1);
String s2 = itemDef.name;
if(itemDef.stackable || rsChildren.invStackSizes[k4] != 1)
s2 = s2 + " x" + intToKOrMilLongName(rsChildren.invStackSizes[k4]);
int i9 = xSpritePos + i6 * (115 + rsChildren.invSpritePadX);
int k9 = ySpritePos + j5 * (12 + rsChildren.invSpritePadY);
if(rsChildren.centerText)
textDrawingArea_1.method382(rsChildren.textColor, i9 + rsChildren.width / 2, s2, k9, rsChildren.textShadow);
else
textDrawingArea_1.method389(rsChildren.textShadow, i9, rsChildren.textColor, s2, k9);
}
k4++;
}
}
} else if (rsChildren.type == 8 && (anInt1500 == rsChildren.id || anInt1044 == rsChildren.id || lastHoverToggleChildId == rsChildren.id) && anInt1501 == 100) {
int boxWidth = 0;
int boxHeight = 0;
TextDrawingArea textDrawingArea_2 = normalFont;
for (String s1 = rsChildren.message; s1.length() > 0;) {
int l7 = s1.indexOf("\\n");
String s4;
if (l7 != -1) {
s4 = s1.substring(0, l7);
s1 = s1.substring(l7 + 2);
} else {
s4 = s1;
s1 = "";
}
int j10 = textDrawingArea_2.getTextWidth(s4);
if (j10 > boxWidth) {
boxWidth = j10;
}
boxHeight += textDrawingArea_2.anInt1497 + 1;
}
boxWidth += 6;
boxHeight += 7;
int xPos = (ySpritePos + rsChildren.width) - 5 - boxWidth;
int yPos = xSpritePos + rsChildren.height + 5;
if (xPos < ySpritePos + 5) {
xPos = ySpritePos + 5;
}
if (xPos + boxWidth > yScrollPoint + rsInterface.width) {
xPos = (yScrollPoint + rsInterface.width) - boxWidth;
}
if (yPos + boxHeight > xPadding + rsInterface.height) {
yPos = (xPadding + rsInterface.height) - boxHeight;
}
DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
String s2 = rsChildren.message;
for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {//anInt1497
int newLineIndex = s2.indexOf("\\n");
String s5;
if (newLineIndex != -1) {
s5 = s2.substring(0, newLineIndex);
s2 = s2.substring(newLineIndex + 2);
} else {
s5 = s2;
s2 = "";
}
textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
}
} else if (rsChildren.type == 9) {
drawHoverBox(xSpritePos, ySpritePos, rsChildren.message);
}
}
DrawingArea.setDrawingArea(yBottomPos, xTopPos, xBottomPos, yTopPos);
} catch(NullPointerException ex) {
}
}
What we want to do here find the last else if(rsChildren.type == ##...
My case it was:
Java:
else if (rsChildren.type == 9) {
so now that you found it you want to put the following after the closing bracket ( } ) that closes the else if statement
Java:
else if(rsChildren.type == 14) {
Sprite sprite = null;
if(previewSprite >= 0/*interfaceIsSelected(rsChildren) || hoverSpriteId == rsChildren.id*/) {
//System.out.println("Boss preview test");
sprite = rsChildren.sprites[previewSprite];
//sprite = rsChildren.sprite2;
} else {
sprite = rsChildren.sprite1;
}
if (sprite != null) {
if(rsChildren.type == 14) {
sprite.drawSprite(xSpritePos, ySpritePos);
} else {
sprite.drawSprite1(xSpritePos, ySpritePos, rsChildren.opacity);
}
}
}
What this does is changes the sprite that is shown on the interface when the "previewSprite" int is changed.
The sprite it changes to is based on what the "previewSprite" int is changed to sprite[0] if previewSprite is 0 or sprite[1] if previewSprite is 1 etc...
Now how do we know this works?
Well that is a really good question... We don't... I'm just kidding of course we do otherwise I wouldn't be posting this.
To test it though you can make a command in the client.java class to change the preview sprite int.
An example of such command would be like this:
Java:
if(inputString.startsWith("::bandos")) {
try {
String[] args = inputString.split(" ");
int preview = Integer.parseInt(args[1]);
previewSprite = preview;
System.out.println("Preview Sprite: "+previewSprite);
} catch(Exception e) {
e.printStackTrace();
}
}
Simply put that under where your noclip command is or underneath one of your other client commands.
Now lets talk about how to make your own preview sprites. Tip: Its really simple actually...
Step 1:
First open up snipping tool or any other program that takes a screen shot.
Step 2:
Stand ingame where you want to make the preview sprite and simple take a screen shot. I like to use the snipping tool for this because you can create the area where the screen shot it taken.
Step 3:
Take a screen shot and save it somewhere.
Step 4:
Open your favorite image editing program and edit the size of the image to 130 x 112
Step 5: Save the image to where you put the main interface sprite you downloaded earlier.
If you packed the main interface sprite to your cache then pack the newly created image (the preview image) to your cache too. Repeat this for all the preview images you want to add.
I don't think I left anything out but this should be a pretty cut and clean snippet. You literally should just be able to copy and paste the stuff I presented here with little to no editing and it should work just fine.
Things you need to do though:
Make or use an existing packet to change the previewSprite int inside the Client.java class when clicking a button on the interface from the server. Difficulty: 1/10
Below I will add an image to show case what you are adding:
NOTE: The picture under the "Name" box is the preview image that is what will change based on the preview sprite
Attachments
Last edited: