Jump to content
Sign in to follow this  
Rameez

602 SkillTab Fixed Client/Server Sided

Recommended Posts

[b]*Client Sided*[/b]

Replace your Skills Class with the following code:

[code]final class Skills
{

public static int skillsCount = 25;
public static String skillNames[] = {
"attack", "defence", "strength", "hitpoints", "ranged", "prayer", "magic", "cooking", "woodcutting", "fletching",
"fishing", "firemaking", "crafting", "smithing", "mining", "herblore", "agility", "thieving", "slayer", "farming",
"runecraft", "construction", "hunter", "summoning", "dungeoneering"
};
public static boolean skillEnabled[] = {
true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true
};

}[/code]

Add this following code in your Client class:

[code]public int getXPForLevel(int level) {
int points = 0;
int output = 0;
for (int lvl = 1; lvl <= level; lvl++) {
points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
if (lvl >= level) {
return output;
}
output = (int)Math.floor(points / 4);
}
return 0;
}
public String[] skillNames = { "Attack", "Hitpoints", "Mining", "Strength", "Agility",
"Smithing", "Defence", "Herblore", "Fishing", "Range", "Thieving",
"Cooking", "Prayer", "Crafting", "Firemaking", "Magic", "Fletching", "Woodcutting",
"Runecrafting", "Slayer", "Farming", "Construction", "Hunter", "Summoning",
"Dungeoneering" };
public String setMessage(int level){
String[] messages = new String[4];
String message = "";
int maxLevel = 99;
if(maxStats[level] > maxLevel){
if(level != 24){
maxStats[level] = 99;
} else if(maxStats[level] > 120){
maxStats[level] = 120;
}
}
int[] stuff = {0,3,14,2,16,13,1,15,10,4,17,7,5,12,11,6,9,8,20,18,19,21,22,23,24};
messages[0] = skillNames[level]+": "+currentStats[stuff[level]]+"/"+maxStats[stuff[level]]+"\\n";
messages[1] = "Current XP: " + getXPForLevel(maxStats[stuff[level]])+"\\n";
messages[2]= "Remainder: "+ (getXPForLevel(maxStats[stuff[level]]+1)-getXPForLevel(maxStats[stuff[level]]))+"\\n";
messages[3]= "Next level: "+ getXPForLevel(maxStats[stuff[level]]+1);
message = messages[0] + messages[1] + messages[2] + messages[3];
return message;
}[/code]

Still in the Client class, find the following void:

[quote]void drawFriendsListOrWelcomeScreen[/quote]

Add the following code in that method:

[code]if(j >= 206 && j <= 206+25){
j -= 206;
class9.message = setMessage(j);
return;
}[/code]

Now in your RSInterface class find the following:

[quote]aClass44 = streamLoader_1;[/quote]

Now right below it add this code:

[code]skillTab602(textDrawingAreas);[/code]

Now add the following methods for your SkillTab:

[code]public static void skillTab602(TextDrawingArea[] TDA) {
RSInterface skill = addInterface(3917);
addText(27203, "99", 0xFFFF00, false, true, -1, TDA, 0);
addText(27204, "99", 0xFFFF00, false, true, -1, TDA, 0);
addText(27205, "99", 0xFFFF00, false, true, -1, TDA, 0);
addText(27206, "99", 0xFFFF00, false, true, -1, TDA, 0);
skill.totalChildren(4);
skill.child(0, 27203, 158, 175);
skill.child(1, 27204, 171, 186);
skill.child(2, 27205, 158, 203);
skill.child(3, 27206, 171, 214);
String[] spriteNames = { "Attack", "HP", "Mine", "Strength", "Agility", "Smith", "Defence", "Herblore", "Fish", "Range", "Thief", "Cook", "Prayer", "Craft", "Fire", "Mage", "Fletch", "Wood", "Rune", "Slay", "Farm", "Construction", "Hunter", "Summon", "Dungeon" };
int[] buttons = { 27207, 27208, 27209, 27210, 27211, 27212, 27213, 27214, 27215, 27216, 27217, 27218, 27219, 27220, 27221, 27222, 27223, 27224, 27225, 27226, 27231, 27232, 27233, 27234, 27235 };
int[] hovers = { 4040, 4076, 4112, 4046, 4082, 4118, 4052, 4088, 4124, 4058, 4094, 4130, 4064, 4100, 4136, 4070, 4106, 4142, 4160, 2832, 13917, 19005, 19006, 19007, 19008 };
int[][] text = { { 4004, 4005 }, { 4016, 4017 }, { 4028, 4029 },
{ 4006, 4007 }, { 4018, 4019 }, { 4030, 4031 }, { 4008, 4009 },
{ 4020, 4021 }, { 4032, 4033 }, { 4010, 4011 }, { 4022, 4023 },
{ 4034, 4035 }, { 4012, 4013 }, { 4024, 4025 }, { 4036, 4037 },
{ 4014, 4015 }, { 4026, 4027 }, { 4038, 4039 }, { 4152, 4153 },
{ 12166, 12167 }, { 13926, 13927 }, { 18165, 18169 },
{ 18166, 18170 }, { 18167, 18171 }, { 18168, 18172 } };

int[] icons = { 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973,
3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 4151,
12165, 13925, 27227, 27228, 27229, 27230 };

int[][] buttonCoords = { { 4, 4 }, { 66, 4 }, { 128, 4 }, { 4, 32 },
{ 66, 32 }, { 128, 32 }, { 4, 60 }, { 66, 60 }, { 128, 60 },
{ 4, 88 }, { 66, 88 }, { 128, 88 }, { 4, 116 }, { 66, 116 },
{ 128, 116 }, { 4, 144 }, { 66, 144 }, { 128, 144 },
{ 4, 172 }, { 66, 172 }, { 128, 172 }, { 4, 200 }, { 66, 200 },
{ 128, 200 }, { 4, 229 } };
int[][] iconCoords = { { 6, 6 }, { 69, 7 }, { 131, 6 }, { 9, 34 },
{ 68, 33 }, { 131, 36 }, { 9, 64 }, { 67, 63 }, { 131, 61 },
{ 7, 91 }, { 68, 94 }, { 133, 90 }, { 6, 118 }, { 70, 120 },
{ 130, 118 }, { 6, 147 }, { 69, 146 }, { 132, 146 },
{ 6, 173 }, { 69, 173 }, { 130, 174 }, { 6, 202 }, { 69, 201 },
{ 131, 202 }, { 6, 230 } };
int[][] textCoords = { { 31, 7, 44, 18 }, { 93, 7, 106, 18 },
{ 155, 7, 168, 18 }, { 31, 35, 44, 46 }, { 93, 35, 106, 46 },
{ 155, 35, 168, 46 }, { 31, 63, 44, 74 }, { 93, 63, 106, 74 },
{ 155, 63, 168, 74 }, { 31, 91, 44, 102 },
{ 93, 91, 106, 102 }, { 155, 91, 168, 102 },
{ 31, 119, 44, 130 }, { 93, 119, 106, 130 },
{ 155, 119, 168, 130 }, { 31, 147, 44, 158 },
{ 93, 147, 106, 158 }, { 155, 147, 168, 158 },
{ 31, 175, 44, 186 }, { 93, 175, 106, 186 },
{ 155, 175, 168, 186 }, { 32, 203, 45, 214 },
{ 94, 203, 107, 214 }, { 156, 203, 169, 214 },
{ 32, 231, 45, 242 } };
int[][] newText = { { 18165, 18166, 18167, 18168 },
{ 18169, 18170, 18171, 18172 },
{ 27223, 27224, 27225, 27226 } };
for (int i = 0; i < hovers.length; i++) {
createSkillHover(hovers[i], 206 + i);
//addTooltipBox(hovers[i], 205 + i);
addSkillButton(buttons[i]);
addImage(icons[i], spriteNames[i]);
}
for (int i = 0; i < 4; i++) {
addSkillText(newText[0][i], false, i + 21);
addSkillText(newText[1][i], true, i + 21);
}
skill.children(icons.length + (text.length * 2) + hovers.length + buttons.length + 1);
int frame = 0;
RSInterface totalLevel = interfaceCache[3984];
totalLevel.message = "@[email protected] level: %1";
totalLevel.textDrawingAreas = fonts[2];
skill.child(frame, 3984, 94, 237); frame++;
for (int i = 0; i < buttons.length; i++) {
skill.child(frame, buttons[i], buttonCoords[i][0], buttonCoords[i][1]); frame++;
}
for (int i = 0; i < icons.length; i++) {
skill.child(frame, icons[i], iconCoords[i][0], iconCoords[i][1]); frame++;
}
for (int i = 0; i < text.length; i++) {
skill.child(frame, text[i][0], textCoords[i][0], textCoords[i][1]); frame++;
}
for (int i = 0; i < text.length; i++) {
skill.child(frame, text[i][1], textCoords[i][2], textCoords[i][3]); frame++;
}
for (int i = 0; i < hovers.length; i++) {
skill.child(frame, hovers[i], buttonCoords[i][0], buttonCoords[i][1]); frame++;
}
}

public void children(int total) {
children = new int[total];
childX = new int[total];
childY = new int[total];
}


public static void createSkillHover(int id, int x) {
RSInterface hover = addInterface(id);
hover.type = 8;
hover.message = "TESTING!";
hover.contentType = x;
hover.width = 60;
hover.height = 28;
hover.inventoryHover = true;
}
public static void addImage(int id, String s) {
RSInterface image = addInterface(id);
image.type = 5;
image.atActionType = 0;
image.contentType = 0;
image.width = 100;
image.height = 100;
image.sprite1 = getSprite(s);
}

public static void addSkillText(int id, boolean max, int skill) {
RSInterface text = addInterface(id);
text.id = id;
text.parentID = id;
text.type = 4;
text.atActionType = 0;
text.width = 15;
text.height = 12;
text.centerText = true;
text.textShadow = true;
text.textColor = 16776960;
text.textDrawingAreas = fonts[0];
if (!max) {
text.valueIndexArray = new int[1][];
text.valueIndexArray[0] = new int[3];
text.valueIndexArray[0][0] = 1;
text.valueIndexArray[0][1] = skill;
text.valueIndexArray[0][2] = 0;
} else {
text.valueIndexArray = new int[2][];
text.valueIndexArray[0] = new int[3];
text.valueIndexArray[0][0] = 1;
text.valueIndexArray[0][1] = skill;
text.valueIndexArray[0][2] = 0;
text.valueIndexArray[1] = new int[1];
text.valueIndexArray[1][0] = 0;
}
text.message = "%1";
}

public static Sprite getSprite(String s) {
Sprite image;
try {
image = new Sprite("/Skill/" + s);
if (image != null) {
return image;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return image;
}

public boolean inventoryHover;[/code]

Download and extract the following sprites in your Sprites folder which should be found in the cache: [url]http://www.mediafire.com/?n9jpla6je4hk4bd[/url]

[b]*Server Sided*[/b]

In your PlayerAssisstant class, find the following void:

[quote]void refreshSkill[/quote]

Now at the far end of this method you should see "case 20:" after the break; in that case add this following code:

[code]case 21://Hunter
sendFrame126("@[email protected]" + c.playerLevel[21] + "", 18166);
sendFrame126("@[email protected]" + c.playerLevel[21] + "", 18170);
break;
case 22: //construction
sendFrame126("@[email protected]" + c.playerLevel[22] + "", 18165);
sendFrame126("@[email protected]" + c.playerLevel[22] + "", 18169);
break;
case 23: //summoning
sendFrame126("@[email protected]" + c.playerLevel[23] + "", 18167);
sendFrame126("@[email protected]" + c.playerLevel[23] + "", 18171);
sendFrame126("" + c.playerXP[23] + "", 29803);
break;

case 24: //Dungeoneering
sendFrame126("@[email protected]" + c.playerLevel[24] + "", 18168);
sendFrame126("@[email protected]" + c.playerLevel[24] + "", 18172);
break;[/code]

Now in your Client class, introduce the following method:

[code]public void RefreshAllSkills() {
for (int i = 0; i < 25; i++) {
getPA().setSkillLevel(i, playerLevel[i], playerXP[i]);
getPA().refreshSkill(i);
}
}[/code]

Still in Client class find the following void:

[quote]void destruct[/quote]

Right below [quote]Misc.println("[DEREGISTERED]: "+playerName+"");[/quote]

Add this:

[code]RefreshAllSkills();[/code]

Find the following method:

[quote]void initialize[/quote]

At the far bottom of this method right after:

[quote]getPA().clearClanChat();
getPA().resetFollow();
getPA().sendFrame36(172, autoRet);
getPA().sendFrame36(173, isRunning2 ? 1 : 0);[/quote]

Add the following:

[code]RefreshAllSkills();[/code]

A picture of the skill-tab with all skills appearing perfectly:

[img]http://screensnapr.com/e/w8Euy6.jpg[/img]

Share this post


Link to post
Share on other sites
Sign in to follow this  

×