So first, you want to navigate to your
Skills.Java, usually hanging out in the
com.rs.game.player file.
After you find and locate the file, your going to want to first put in the arrays and id's of the new skill. Look for :
Code:
/**
* Integers representing Skill ID's.
*/
public static final int ATTACK = 0, DEFENCE = 1, STRENGTH = 2, HITPOINTS = 3, RANGE = 4, PRAYER = 5, MAGIC = 6,
COOKING = 7, WOODCUTTING = 8, FLETCHING = 9, FISHING = 10, FIREMAKING = 11, CRAFTING = 12, SMITHING = 13,
MINING = 14, HERBLORE = 15, AGILITY = 16, THIEVING = 17, SLAYER = 18, FARMING = 19, RUNECRAFTING = 20,
CONSTRUCTION = 22, HUNTER = 21, SUMMONING = 23, DUNGEONEERING = 24, DIVINATION = 25, INVENTION = 26;
/**
* Strings representing Skill names.
*/
public static final String[] SKILL_NAME = { "Attack", "Defence", "Strength", "Constitution", "Ranged", "Prayer",
"Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining",
"Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecrafting", "Hunter", "Construction",
"Summoning", "Dungeoneering", "Divination", "Invention" };
Here we have the skills being declared and assigning an ID and Name to each skill. Now for adding new skills, you want to input into both of these the new skill, let's say the new skill is
Treasure.
Code:
/**
* Integers representing Skill ID's.
*/
public static final int ATTACK = 0, DEFENCE = 1, STRENGTH = 2, HITPOINTS = 3, RANGE = 4, PRAYER = 5, MAGIC = 6,
COOKING = 7, WOODCUTTING = 8, FLETCHING = 9, FISHING = 10, FIREMAKING = 11, CRAFTING = 12, SMITHING = 13,
MINING = 14, HERBLORE = 15, AGILITY = 16, THIEVING = 17, SLAYER = 18, FARMING = 19, RUNECRAFTING = 20,
CONSTRUCTION = 22, HUNTER = 21, SUMMONING = 23, DUNGEONEERING = 24, DIVINATION = 25, INVENTION = 26, TREASURE = 27;
/**
* Strings representing Skill names.
*/
public static final String[] SKILL_NAME = { "Attack", "Defence", "Strength", "Constitution", "Ranged", "Prayer",
"Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining",
"Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecrafting", "Hunter", "Construction",
"Summoning", "Dungeoneering", "Divination", "Invention", "Treasure" };
Now that you have put these in, next is to find :
Code:
public Skills() {
LegendaryPetLevel = new short[5];
LegendaryPetXp = new double[5];
level = new short[27];
xp = new double[27];
level[3] = 10;
xp[3] = 1184;
level[HERBLORE] = 3;
xp[HERBLORE] = 250;
xpPopup = true;
xpTracks = new double[3];
trackSkills = new boolean[3];
trackSkillsIds = new byte[3];
trackSkills[0] = true;
for (int i = 0; i < trackSkillsIds.length; i++)
trackSkillsIds[i] = 30;
}
Here your going to want to change the
level & XP tags.
VERY IMPORTANT! - The arrays associate the first one as 0 (Attack) so when adding a new skill, always make it equal to one above the new skill, in example the Treasure skill ID is 27, so we want to change it to 28.
Code:
public Skills() {
LegendaryPetLevel = new short[5];
LegendaryPetXp = new double[5];
level = new short[28];
xp = new double[28];
level[3] = 10;
xp[3] = 1184;
level[HERBLORE] = 3;
xp[HERBLORE] = 250;
xpPopup = true;
xpTracks = new double[3];
trackSkills = new boolean[3];
trackSkillsIds = new byte[3];
trackSkills[0] = true;
for (int i = 0; i < trackSkillsIds.length; i++)
trackSkillsIds[i] = 30;
}
Next, lets find :
Code:
public int getTotalLevel1(Player player) {
int totallevel = 0;
for (int i = 0; i <= 27; i++) {
totallevel += player.getSkills().getLevelForXp(i);
}
return totallevel;
}
Lets change it just like the last one, 27 -> 28
Code:
public int getTotalLevel1(Player player) {
int totallevel = 0;
for (int i = 0; i <= 28; i++) {
totallevel += player.getSkills().getLevelForXp(i);
}
return totallevel;
}
**Please note there may be a couple Total Level tags, it may run off level.length or may have the int, if it runs off the int, change it from 27 -> 28 like we did above.
Find your Skill Name String here:
Code:
public String getSkillName(int skill) {
switch (skill) {
case ATTACK:
return "Attack";
case STRENGTH:
return "Strength";
case DEFENCE:
return "Defence";
case RANGE:
return "Ranged";
case HITPOINTS:
return "Hitpoints";
case PRAYER:
return "Prayer";
case AGILITY:
return "Agility";
case HERBLORE:
return "Herblore";
case THIEVING:
return "Thieving";
case CRAFTING:
return "Crafting";
case MINING:
return "Mining";
case SMITHING:
return "Smithing";
case FISHING:
return "Fishing";
case COOKING:
return "Cooking";
case FIREMAKING:
return "Firemaking";
case WOODCUTTING:
return "Woodcutting";
case SLAYER:
return "Slayer";
case FARMING:
return "Farming";
case CONSTRUCTION:
return "Construction";
case HUNTER:
return "Hunter";
case SUMMONING:
return "Summoning";
case DUNGEONEERING:
return "Dungeoneering";
case MAGIC:
return "Magic";
case FLETCHING:
return "Fletching";
case RUNECRAFTING:
return "Runecrafting";
case DIVINATION:
return "Divination";
default:
return "Null";
}
}
And add in your new skill:
Code:
public String getSkillName(int skill) {
switch (skill) {
case ATTACK:
return "Attack";
case STRENGTH:
return "Strength";
case DEFENCE:
return "Defence";
case RANGE:
return "Ranged";
case HITPOINTS:
return "Hitpoints";
case PRAYER:
return "Prayer";
case AGILITY:
return "Agility";
case HERBLORE:
return "Herblore";
case THIEVING:
return "Thieving";
case CRAFTING:
return "Crafting";
case MINING:
return "Mining";
case SMITHING:
return "Smithing";
case FISHING:
return "Fishing";
case COOKING:
return "Cooking";
case FIREMAKING:
return "Firemaking";
case WOODCUTTING:
return "Woodcutting";
case SLAYER:
return "Slayer";
case FARMING:
return "Farming";
case CONSTRUCTION:
return "Construction";
case HUNTER:
return "Hunter";
case SUMMONING:
return "Summoning";
case DUNGEONEERING:
return "Dungeoneering";
case MAGIC:
return "Magic";
case FLETCHING:
return "Fletching";
case RUNECRAFTING:
return "Runecrafting";
case DIVINATION:
return "Divination";
case TREASURE:
return "Treasure";
default:
return "Null";
}
}
(OPTIONAL)
If you want your new skill to be a new combat skill, being a damage increase or wearing new armors, you will need to add a few more variables.
Look for :
Code:
public static boolean isCombatSkill(int skillId) {
switch (skillId) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 23:
return true;
}
return false;
}
Yours may have skill <= 6 or some case to that, if you want to add new ones, its better to change it to the SWITCH and be able to signify each one. But let's say treasure is a combat skill. We want to add the id to the combat skill here.
Code:
public static boolean isCombatSkill(int skillId) {
switch (skillId) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 23:
case 27:
return true;
}
return false;
}
Next if you want to add this combat skill to your combat level, look for :
Code:
public int getCombatLevel() {
int attack = getLevelForXp(0);
int defence = getLevelForXp(1);
int strength = getLevelForXp(2);
int hp = getLevelForXp(3);
int prayer = getLevelForXp(5);
int ranged = getLevelForXp(4);
int magic = getLevelForXp(6);
int combatLevel = 3;
combatLevel = (int) ((defence + hp + Math.floor(prayer / 2)) * 0.25) + 1;
double melee = (attack + strength) * 0.325;
double ranger = Math.floor(ranged * 1.5) * 0.325;
double mage = Math.floor(magic * 1.5) * 0.325;
if (melee >= ranger && melee >= mage) {
combatLevel += melee;
} else if (ranger >= melee && ranger >= mage) {
combatLevel += ranger;
} else if (mage >= melee && mage >= ranger) {
combatLevel += mage;
}
return combatLevel;
}
Here you can add it into the level, in this case lets label it as a melee skill and want to just add some to that faction
Code:
public int getCombatLevel() {
int attack = getLevelForXp(0);
int defence = getLevelForXp(1);
int strength = getLevelForXp(2);
int hp = getLevelForXp(3);
int prayer = getLevelForXp(5);
int ranged = getLevelForXp(4);
int magic = getLevelForXp(6);
int treasure = getLevelForXp(27);
int combatLevel = 3;
combatLevel = (int) ((defence + hp + Math.floor(prayer / 2) + Math.floor(treasure / 2)) * 0.25) + 1;
double melee = (attack + strength + treasure) * 0.325;
double ranger = Math.floor(ranged * 1.5) * 0.325;
double mage = Math.floor(magic * 1.5) * 0.325;
if (melee >= ranger && melee >= mage) {
combatLevel += melee;
} else if (ranger >= melee && ranger >= mage) {
combatLevel += ranger;
} else if (mage >= melee && mage >= ranger) {
combatLevel += mage;
}
return combatLevel;
}
Now don't spam me on how how the level here is put in, you can adjust and center it to the way you want, this is just a small input on where and how you can input it on to increase combat level.
After this you add boosts to damage and others in your combat files.
CLIENT SIDED
This seems to be the hardest part some people come across as far as I see, this and CS2 Scripts but those are for another time..
So first you want to look for a file called
PacketsDecoder.java and your going to want to search in this file for SKILL and should find this :
Code:
if (((Class25) class25).INCOMMING_PACKET == IncommingPacket.SKILL_LEVEL_PACKET) {
int skillId = stream.readUnsigned128Byte((byte) 17);
int xp = stream.readInt();
int level = stream.readUnsignedByte128(-1014855659);
client.anIntArray8829[skillId] = xp;
client.anIntArray8924[skillId] = level;
client.anIntArray8828[skillId] = 1;
int i_443_ = Class368.anIntArray4002[skillId] - 1;
for (int i_444_ = 0; i_444_ < i_443_; i_444_++) {
if (xp >= Class368.anIntArray4003[i_444_])
client.anIntArray8828[skillId] = 2 + i_444_;
}
client.anIntArray8833[(client.anInt8875 += 1972492301) * -1048955195 - 1 & 0x1f] = skillId;
((Class25) class25).INCOMMING_PACKET = null;
return true;
}
Looks like a lot i know, but after reading it, it displays the client arrays, and the one's you need to focus on is the
Class368.anIntArray4002 ,
Class368.anIntArray4003. So from here you would take one of these arrays, and do a project search for this array Class368.anIntArray4003, which pulls up
Class368.java. Here you will find a few lines that we need :
Code:
public static int[] anIntArray4002 = { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 120, 99, 99, 99, 99, 99, 120, 99, 99 };
public static int[] anIntArray4003 = new int[120];
public static int anInt4004 = 27;
public static int anInt4005;
It will look something like this. So here we have the max level for the each level in the array at the top, and 4004 is the level limit. So lets change these up. **REMEMBER - the array sees 0 as the first, so there should be 27 arrays, with 0 being the first, were going to add one, so 28 arrays in t
Code:
public static int[] anIntArray4002 = { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 120, 99, 99, 99, 99, 99, 120, 99, 99, 99 };
public static int[] anIntArray4003 = new int[120];
public static int anInt4004 = 28;
public static int anInt4005;
Another index you need to add is:
Client.Java, find these three arrays
Code:
anIntArray8924 = new int[25];
anIntArray8828 = new int[25];
anIntArray8829 = new int[25];
Change to :
Code:
anIntArray8924 = new int[26];
anIntArray8828 = new int[26];
anIntArray8829 = new int[26];
This is basically all you need on the client side for it to recognize there is another skill there.
Another important bit I got share, thanks to amazing Clem for helping me. Inside your
Player.java file, your going to want to find your Start :
Code:
public void start() {
loadMapRegions();
started = true;
run();
if (isDead())
sendDeath(null);
}
Add in this little code :
Code:
public void start() {
loadMapRegions();
started = true;
skills.migrate();
run();
if (isDead())
sendDeath(null);
}
Head back to your
Skills.java, and at the bottom put this down at the bottom of the page :
Code:
public void migrate() {
if (level.length == 28 && xp.length == 28) return;
short[] newLevel = new short[27];
double[] newXp = new double[27];
System.arraycopy(xp, 0, newXp, 0, 27);
System.arraycopy(level, 0, newLevel , 0, 27);
xp = newXp;
level = newLevel;
}
This is very important, as this turns around and re-serialize the player file with the new array for the new skill. Without this, players will be running into errors, so will your server.
If I missed anything let me know, figured I got this down on my server so I would share the information, hearing a lot of people held stuff on the server sided instead of updating the client arrays so I'm not sure if this is already released or not. Hope it helps.