Add some Skills
5 posters
PureChaos :: Community :: Suggestions
Page 1 of 1
Add some Skills
I know that there are some skills in the v2, but you are missing some, here are a few:
I took the code from Project insanity haha , you can use it as a snapshot
Agility:
package server.model.players.skills;
import server.Config;
import server.model.players.Client;
/**
* Agility.java
*
* @author Sanity
*
**/
public class Agility {
private Client c;
public Agility(Client c) {
this.c = c;
}
private boolean[] gnomeCourse = new boolean[6];
private final int[] EXP = {8,8,5,8,5,8,8,39};
public void handleGnomeCourse(int object, int objectX, int objectY) {
/*if (object == 2286 && objectY > c.getY()) { //net
c.startAnimation(844);
c.getPA().movePlayer(c.getX(), c.getY() + 2, 0);
gnomeCourse[4] = true;
c.getPA().addSkillXP(EXP[5] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 154 || object == 4058) { //tube
c.startAnimation(844);
c.getPA().walkTo(0,7);
gnomeCourse[5] = true;
if (isDoneGnome())
giveReward(1);
c.getPA().addSkillXP(EXP[6] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2295) {
c.playerSE = 0x328;//walk
c.playerSEW = 762;//walk
c.isRunning = false;
if (objectX > c.getX())
c.getPA().walkTo(1,0);
else if (objectX < c.getX())
c.getPA().walkTo(-1,0);
c.getPA().walkTo(0,-7);
gnomeCourse[0] = true;
c.getPA().addSkillXP(EXP[0] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2285 && c.heightLevel == 0) {
c.startAnimation(828);
c.getPA().movePlayer(c.getX(), c.getY()-2, 1);
gnomeCourse[1] = true;
c.getPA().addSkillXP(EXP[1] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2313 && c.heightLevel == 1) {
c.startAnimation(828);
c.getPA().movePlayer(c.getX(), c.getY()-2, 2);
gnomeCourse[2] = true;
c.getPA().addSkillXP(EXP[2] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2312) {
c.getPA().walkTo(6,0);
c.getPA().addSkillXP(EXP[3] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2314) {
c.getPA().movePlayer(c.getX(), c.getY(), 0);
gnomeCourse[3] = true;
c.getPA().addSkillXP(EXP[4] * Config.AGILITY_EXPERIENCE, c.playerAgility);
}*/
}
private void giveReward(int level) {
/*c.sendMessage("You have completed the course and have been given " + level + " tickets.");
c.getItems().addItem(2996,level);
if (level == 1)
c.getPA().addSkillXP(EXP[EXP.length-1] * Config.AGILITY_EXPERIENCE, c.playerAgility);
for (int j = 0; j < gnomeCourse.length; j++)
gnomeCourse[j] = false;*/
}
private boolean isDoneGnome() {
//return gnomeCourse[0] && gnomeCourse[1] && gnomeCourse[2] && gnomeCourse[3] && gnomeCourse[4] && gnomeCourse[5];
return false;
}
}
Cooking:
package server.model.players.skills;
import server.model.players.Client;
import server.util.Misc;
import server.Config;
public class Cooking {
Client c;
public Cooking(Client c) {
this.c = c;
}
private int[][] cookingItems = {{317,315,7954,1,30},{335,333,323,20,70},{331,329,323,30,90},{359,361,363,35,100},{377,379,381,40,120},{371,373,375,50,140},{7944,7946,7948,62,150},{383,385,387,80,210},{389,391,393,91,169}};
public void itemOnObject(int id) {
for (int j = 0; j < cookingItems.length; j++) {
if (cookingItems[j][0] == id)
cookFish(cookingItems[j][0],j);
}
}
public void cookFish(int id, int slot) {
for (int j = 0; j < 28; j++) {
if (c.getItems().playerHasItem(id,1)) {
if (c.playerLevel[c.playerCooking] >= cookingItems[slot][3]) {
if (Misc.random(c.playerLevel[c.playerCooking] + 3 - cookingItems[slot][3]) == 1) {
c.sendMessage("You accidently burn the fish.");
c.getItems().deleteItem(id, c.getItems().getItemSlot(id), 1);
c.getItems().addItem(cookingItems[slot][2], 1);
} else {
c.getItems().deleteItem(id, c.getItems().getItemSlot(id), 1);
c.getItems().addItem(cookingItems[slot][1], 1);
c.getPA().addSkillXP(cookingItems[slot][4] * Config.COOKING_EXPERIENCE, c.playerCooking);
}
} else {
c.sendMessage("You need a cooking level of " + cookingItems[slot][3] + " to cook this fish.");
break;
}
} else {
break;
}
}
}
}
Crafting:
package server.model.players.skills;
import server.model.players.Client;
import server.Config;
public class Crafting {
Client c;
public Crafting(Client c) {
this.c = c;
}
public int hideType = 0, makeId = 0, amount = 0, craftType = 0, exp = 0, index = 0;
public void resetCrafting() {
hideType = 0;
makeId = 0;
amount = 0;
c.craftingLeather = false;
craftType = 0;
}
public void handleChisel(int id1, int id2) {
if (id1 == 1755)
cutGem(id2);
else
cutGem(id1);
}
public int[][] gems = {{1623,1727,1,50},{1621,1729,27,68},{1619,1725,34,85},{1617,1731,43,108},{1631,1712,55,138},{6571,6585,67,168}};
public void cutGem(int id) {
for (int j = 0; j < gems.length; j++) {
if (gems[j][0] == id) {
if (c.playerLevel[c.playerCrafting] >= gems[j][2]) {
c.getItems().deleteItem(id, c.getItems().getItemSlot(id),1);
c.getItems().addItem(gems[j][1], 1);
c.getPA().addSkillXP(gems[j][3] * Config.CRAFTING_EXPERIENCE, c.playerCrafting);
break;
}
}
}
}
public void handleCraftingClick(int clickId) {
for (int j = 0; j < buttons.length; j++) {
if (buttons[j][0] == clickId) {
craftType = buttons[j][1];
amount = buttons[j][2];
checkRequirements();
break;
}
}
}
public void checkRequirements() {
for (int j = 0; j < expsAndLevels.length; j++) {
if (expsAndLevels[j][0] == hideType) {
if (c.playerLevel[c.playerCrafting] >= expsAndLevels[j][1]) {
if (c.getItems().playerHasItem(hideType, 1)) {
c.getPA().closeAllWindows();
exp = expsAndLevels[j][2];
index = j;
craftHides(hideType);
}
} else {
c.sendMessage("You need a crafting level of " + expsAndLevels[j][1] + " to craft this.");
}
}
}
}
public void craftHides(int id) {
for (int j = 0; j < amount; j++) {
if (!c.getItems().playerHasItem(id,craftType))
break;
c.getItems().deleteItem(id, craftType);
if (getItemToAdd() <= 0)
break;
c.getItems().addItem(getItemToAdd(), 1);
c.getPA().addSkillXP(exp * Config.CRAFTING_EXPERIENCE, c.playerCrafting);
}
resetCrafting();
}
public int getItemToAdd() {
if (craftType == 1) {
return vambs[index];
} else if (craftType == 2) {
return chaps[index];
} else if (craftType == 3) {
return bodys[index];
}
return -1;
}
public int[] vambs = {1065,2487,2489,2491};
public int[] chaps = {1099,2493,2495,2497};
public int[] bodys = {1135,2499,2501,2503};
public void handleLeather(int item1, int item2) {
if (item1 == 1733) {
openLeather(item2);
} else {
openLeather(item1);
}
}
public int[][] buttons = {{34185,1,1},{34184,1,5},{34183,1,10},{34182,1,27},{34189,2,1},{34188,2,5},{34187,2,10},{34186,2,27},{34193,3,1},{34192,3,5},{34191,3,10},{34190,3,27}};
public int[][] expsAndLevels = {{1745,62,57},{2505,66,70},{2507,73,78},{2509,79,86}};
public void openLeather(int item) {
if (item == 1745) {
c.getPA().sendFrame164(8880); //green dhide
c.getPA().sendFrame126("What would you like to make?", 8879);
c.getPA().sendFrame246(8884, 250, 1099); // middle
c.getPA().sendFrame246(8883, 250, 1065); // left picture
c.getPA().sendFrame246(8885, 250, 1135); // right pic
c.getPA().sendFrame126("Vambs", 8889);
c.getPA().sendFrame126("Chaps", 8893);
c.getPA().sendFrame126("Body", 8897);
hideType = item;
} else if (item == 2505) {
c.getPA().sendFrame164(8880); //blue
c.getPA().sendFrame126("What would you like to make?", 8879);
c.getPA().sendFrame246(8884, 250, 2493); // middle
c.getPA().sendFrame246(8883, 250, 2487); // left picture
c.getPA().sendFrame246(8885, 250, 2499); // right pic
c.getPA().sendFrame126("Vambs", 8889);
c.getPA().sendFrame126("Chaps", 8893);
c.getPA().sendFrame126("Body", 8897);
hideType = item;
} else if (item == 2507) {
c.getPA().sendFrame164(8880);
c.getPA().sendFrame126("What would you like to make?", 8879);
c.getPA().sendFrame246(8884, 250, 2495); // middle
c.getPA().sendFrame246(8883, 250, 2489); // left picture
c.getPA().sendFrame246(8885, 250, 2501); // right pic
c.getPA().sendFrame126("Vambs", 8889);
c.getPA().sendFrame126("Chaps", 8893);
c.getPA().sendFrame126("Body", 8897);
hideType = item;
} else if (item == 2509) {
c.getPA().sendFrame164(8880);
c.getPA().sendFrame126("What would you like to make?", 8879);
c.getPA().sendFrame246(8884, 250, 2497); // middle
c.getPA().sendFrame246(8883, 250, 2491); // left picture
c.getPA().sendFrame246(8885, 250, 2503); // right pic
c.getPA().sendFrame126("Vambs", 8889);
c.getPA().sendFrame126("Chaps", 8893);
c.getPA().sendFrame126("Body", 8897);
hideType = item;
}
c.craftingLeather = true;
}
}
Farming:
package server.model.players.skills;
import server.Config;
import server.model.players.Client;
import server.util.Misc;
/**
* Farming.java
*
* @author Sanity
*
**/
public class Farming {
private Client c;
private final int[] VALID_SEEDS = {5291,5292,5293,5294,5295,5296,5297,5298,5299,5300,5301,5302,5303,5304};
private final int[] HERBS = {199,201,203,205,207,3049,209,211,213,3051,215,2485,217,219}; /* lant, toad, snap*/
private final int[] SEED_PLANT_EXP = {11,14,16,22,27,34,43,55,69,88,107,135,171,200};
private final int[] HERB_EXPS = {13,15,18,24,31,39,49,62,78,99,120,152,192,225};
private final int[] FARMING_REQS = {1,14,19,26,32,38,44,50,56,62,67,73,79,85};
private final int PATCH_HERBS = 8143;
private final int PATCH_WEEDS = 8389;
public Farming(Client c) {
this.c = c;
}
public void checkItemOnObject(int itemId) {
for (int j = 0; j < VALID_SEEDS.length; j++) {
if (itemId == VALID_SEEDS[j]) {
handleFarming(VALID_SEEDS[j],HERBS[j],HERB_EXPS[j], j);
return;
}
}
}
private void handleFarming(int seedId, int herbId, int exp, int slot) {
if (c.playerLevel[c.playerFarming] < FARMING_REQS[slot]) {
c.sendMessage("You need a farming level of " + FARMING_REQS[slot] + " to farm this seed.");
return;
}
if (c.getItems().playerHasItem(seedId,1)) {
c.getItems().deleteItem(seedId, c.getItems().getItemSlot(seedId), 1);
c.getPA().addSkillXP(SEED_PLANT_EXP[slot] * Config.FARMING_EXPERIENCE, c.playerFarming);
c.getPA().refreshSkill(c.playerFarming);
int herbAmount = Misc.random(5) + 3;
c.farm[0] = herbId;
c.farm[1] = herbAmount;
updateHerbPatch();
}
}
public int getExp() {
for (int j = 0; j < HERBS.length; j++)
if (HERBS[j] == c.farm[0])
return HERB_EXPS[j];
return 0;
}
public void updateHerbPatch() {
if (c.farm[0] > 0 && c.farm[1] > 0) {
//make object here
http://c.sendMessage("Make herbs...");
c.getPA().object(PATCH_HERBS,2813,3463,-1,10);
} else {
//make weed patch here
http://c.sendMessage("Make weeds...");
c.getPA().object(PATCH_WEEDS,2813,3463,-1,10);
}
}
public void pickHerb() {
if (c.farm[0] > 0 && c.farm[1] > 0) {
if (c.getItems().addItem(c.farm[0], 1)) {
http://c.startAnimation(2273);
c.getPA().addSkillXP(getExp() * Config.FARMING_EXPERIENCE, c.playerFarming);
c.farm[1]--;
if (c.farm[1] == 0)
c.farm[0] = -1;
updateHerbPatch();
c.sendMessage("You pick a herb.");
c.getPA().resetAnimation();
}
}
}
}
Fishing:
package server.model.players.skills;
import server.Config;
import server.util.Misc;
import server.model.players.Client;
/**
* Fishing.java
*
* @author Sanity
*
**/
public class Fishing {
private Client c;
private int fishType;
private int exp;
private int req;
private int equipmentType;
private final int SALMON_EXP = 70;
private final int SWORD_EXP = 100;
private final int SALMON_ID = 331;
private final int SWORD_ID = 371;
public boolean fishing = false;
private final int[] REQS = {1,20,40,35,62,76,81};
private final int[] FISH_TYPES = {317,335,359,359,7944,383,389};
private final int[] EXP = {10,50,80,90,120,110,46};
public Fishing(Client c) {
this.c = c;
}
public void setupFishing(int fishType) {
if (c.getItems().playerHasItem(getEquipment(fishType))) {
if (c.playerLevel[c.playerFishing] >= req) {
int slot = getSlot(fishType);
if (slot > -1) {
this.req = REQS[slot];
this.fishType = FISH_TYPES[slot];
this.equipmentType = getEquipment(fishType);
this.exp = EXP[slot];
c.fishing = true;
c.fishTimer = 3 + Misc.random(2);
}
} else {
c.sendMessage("You need a fishing level of " + req + " to fish here.");
resetFishing();
}
} else {
c.sendMessage("You do not have the correct equipment to use this fishing spot.");
resetFishing();
}
}
public void catchFish() {
if (c.getItems().playerHasItem(getEquipment(fishType))) {
if (c.playerLevel[c.playerFishing] >= req) {
if (c.getItems().freeSlots() > 0) {
if (canFishOther(fishType)) {
c.getItems().addItem(otherFishId(fishType),1);
c.getPA().addSkillXP(otherFishXP(fishType),c.playerFishing);
} else {
c.getItems().addItem(fishType,1);
c.getPA().addSkillXP(exp * Config.FISHING_EXPERIENCE,c.playerFishing);
}
c.sendMessage("You catch a fish.");
c.fishTimer = 2 + Misc.random(2);
}
} else {
c.sendMessage("You need a fishing level of " + req + " to fish here.");
resetFishing();
}
} else {
c.sendMessage("You do not have the correct equipment to use this fishing spot.");
resetFishing();
}
}
private int getSlot(int fishType) {
for (int j = 0; j < REQS.length; j++)
if (FISH_TYPES[j] == fishType)
return j;
return -1;
}
private int getEquipment(int fish) {
if (fish == 317) //shrimp
return 303;
if (fish == 335) //trout + salmon
return 309;
if (fish == 337) //lobs
return 301;
if (fish == 361)//tuna
return 311;
if (fish == 7944)//monks
return 303;
if (fish == 383)//sharks
return 311;
if (fish == 389)//mantas
return 303;
return -1;
}
private boolean canFishOther(int fishType) {
if (fishType == 335 && c.playerLevel[c.playerFishing] >= 30)
return true;
if (fishType == 361 && c.playerLevel[c.playerFishing] >= 50)
return true;
return false;
}
private int otherFishId(int fishType) {
if (fishType == 335)
return SALMON_ID;
else if (fishType == 361)
return SWORD_ID;
return -1;
}
private int otherFishXP(int fishType) {
if (fishType == 335)
return SALMON_EXP;
else if (fishType == 361)
return SWORD_EXP;
return 0;
}
public void resetFishing() {
this.exp = 0;
this.fishType = -1;
this.equipmentType = -1;
this.req = 0;
c.fishTimer = -1;
c.fishing = false;
}
}
Herblore:
package server.model.players.skills;
import server.Config;
import server.model.players.Client;
/**
* Herblore.java
*@author Sanity
**/
public class Herblore {
private Client c;
private int[][] information = {{199,249,1,3},{201,251,5,4},{203,253,11,5},{205,255,20,6},{207,257,25,8},
{3049,2998,30,8},{209,259,40,9},{211,261,48,10},{213,263,54,11},{3051,3000,59,12},
{215,265,65,13},{2485,2481,67,13},{217,267,70,14},{219,269,75,15}};
private int[][] information2 = {{249,121,2428,1,25},{251,175,2446,5,38},{253,115,113,12,50},{255,127,2430,22,63},
{257,139,2434,38,88},{261,2448,2448,40,100},{259,145,2436,45,100},{263,157,2440,55,125},{3000,3026,3024,63,143},
{265,163,2442,66,155},{2481,2454,2452,69,158},{267,169,2444,72,163},{269,189,2450,78,175},
{2998,6687,6685,81,180}};
//{identifiedHerbId,3dosepot,4dosepot,levelreq,exp}
public Herblore(Client c) {
this.c = c;
}
public void handleHerbClick(int herbId) {
for (int j = 0; j < information.length; j++){
if (information[j][0] == herbId)
idHerb(j);
}
}
public void handlePotMaking(int item1, int item2) {
if (item1 == 227 && isIdedHerb(item2))
makePot(item2);
else if (item2 == 227 && isIdedHerb(item1))
makePot(item1);
}
public boolean isUnidHerb(int clickId) {
for (int j = 0; j < information.length; j++)
if (information[j][0] == clickId)
return true;
return false;
}
public boolean isIdedHerb(int item) {
for (int j = 0; j < information2.length; j++)
if (information2[j][0] == item)
return true;
return false;
}
private void idHerb(int slot) {
if (c.getItems().playerHasItem(information[slot][0])) {
if (c.playerLevel[c.playerHerblore] >= information[slot][2]) {
c.getItems().deleteItem(information[slot][0],c.getItems().getItemSlot(information[slot][0]),1);
c.getItems().addItem(information[slot][1],1);
c.getPA().addSkillXP(information[slot][3] * Config.HERBLORE_EXPERIENCE,c.playerHerblore);
c.sendMessage("You identify the herb as a " + c.getItems().getItemName(information[slot][1]) + ".");
} else {
c.sendMessage("You need a herblore level of " + information[slot][2] + " to identify this herb.");
}
}
}
private void makePot(int herbId) {
if (c.getItems().playerHasItem(227) && c.getItems().playerHasItem(herbId)) {
int slot = getSlot(herbId);
if (c.playerLevel[c.playerHerblore] >= information2[slot][3]) {
c.getItems().deleteItem(herbId,c.getItems().getItemSlot(herbId),1);
c.getItems().deleteItem(227,c.getItems().getItemSlot(227),1);
/*if (c.playerLevel[c.playerHerblore] < information2[slot][3] + 15) {
c.getItems().addItem(information2[slot][1],1);
c.sendMessage("You make a " + c.getItems().getItemName(information2[slot][1]) + ".");
} else {*/
c.getItems().addItem(information2[slot][2],1);
c.sendMessage("You make a " + c.getItems().getItemName(information2[slot][2]) + ".");
//}
c.getPA().addSkillXP(information2[slot][4] * Config.HERBLORE_EXPERIENCE,c.playerHerblore);
} else {
c.sendMessage("You need a herblore level of " + information2[slot][3] + " to make this pot.");
}
}
}
private int getSlot(int herb) {
for (int j = 0; j < information2.length; j++)
if (information2[j][0] == herb)
return j;
return -1;
}
}
Slayer:
package server.model.players.skills;
import server.model.players.Client;
import server.Server;
import server.util.Misc;
/**
* Slayer.java
*
* @author Sanity
*
**/
public class Slayer {
private Client c;
public Slayer(Client c) {
this.c = c;
}
public int[] lowTasks = {1648, 1612, 117, 1265, 90, 103, 78, 119, 18,101,1265,181};
public int[] lowReqs = {5, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1};
public int[] medTasks = {1643,1618,941,119,82,52,1612,117,1265,112,125,1341};
public int[] medReqs = {45,50,1,1,1,1,15,1,1,1,1,1};
public int[] highTasks = {1624,1610,1613,1615,55,84,49,1618,941,82,2783,1341};
public int[] highReqs = {65,75,80,85,1,1,1,50,1,1,90,1};
public void giveTask() {
if (c.combatLevel < 50)
giveTask(1);
else if (c.combatLevel >= 50 && c.combatLevel <= 90)
giveTask(2);
else if (c.combatLevel > 90 && c.combatLevel <= 126)
giveTask(3);
else
giveTask(2);
}
public void giveTask2() {
for (int j = 0; j < lowTasks.length; j++) {
if (lowTasks[j] == c.slayerTask) {
c.sendMessage("You already have an easy task... to kill " + c.taskAmount + " " + Server.npcHandler.getNpcListName(c.slayerTask) + ".");
return;
}
}
giveTask(1);
}
public void giveTask(int taskLevel) {
int given = 0;
int random = 0;
if (taskLevel == 1) {
random = (int)(Math.random() * (lowTasks.length - 1));
given = lowTasks[random];
} else if (taskLevel == 2) {
random = (int)(Math.random() * (medTasks.length - 1));
given = medTasks[random];
} else if (taskLevel == 3) {
random = (int)(Math.random() * (highTasks.length - 1));
given = highTasks[random];
}
if (!canDoTask(taskLevel,random)) {
giveTask(taskLevel);
return;
}
c.slayerTask = given;
c.taskAmount = Misc.random(15) + 15;
c.sendMessage("You have been assigned to kill " + c.taskAmount + " " + Server.npcHandler.getNpcListName(given) + " as a slayer task.");
}
public boolean canDoTask(int taskLevel, int random) {
if (taskLevel == 1) {
return c.playerLevel[c.playerSlayer] >= lowReqs[random];
} else if (taskLevel == 2) {
return c.playerLevel[c.playerSlayer] >= medReqs[random];
} else if (taskLevel == 3) {
return c.playerLevel[c.playerSlayer] >= highReqs[random];
}
return false;
}
}
So you guys can work on these codes
I took the code from Project insanity haha , you can use it as a snapshot
Agility:
package server.model.players.skills;
import server.Config;
import server.model.players.Client;
/**
* Agility.java
*
* @author Sanity
*
**/
public class Agility {
private Client c;
public Agility(Client c) {
this.c = c;
}
private boolean[] gnomeCourse = new boolean[6];
private final int[] EXP = {8,8,5,8,5,8,8,39};
public void handleGnomeCourse(int object, int objectX, int objectY) {
/*if (object == 2286 && objectY > c.getY()) { //net
c.startAnimation(844);
c.getPA().movePlayer(c.getX(), c.getY() + 2, 0);
gnomeCourse[4] = true;
c.getPA().addSkillXP(EXP[5] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 154 || object == 4058) { //tube
c.startAnimation(844);
c.getPA().walkTo(0,7);
gnomeCourse[5] = true;
if (isDoneGnome())
giveReward(1);
c.getPA().addSkillXP(EXP[6] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2295) {
c.playerSE = 0x328;//walk
c.playerSEW = 762;//walk
c.isRunning = false;
if (objectX > c.getX())
c.getPA().walkTo(1,0);
else if (objectX < c.getX())
c.getPA().walkTo(-1,0);
c.getPA().walkTo(0,-7);
gnomeCourse[0] = true;
c.getPA().addSkillXP(EXP[0] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2285 && c.heightLevel == 0) {
c.startAnimation(828);
c.getPA().movePlayer(c.getX(), c.getY()-2, 1);
gnomeCourse[1] = true;
c.getPA().addSkillXP(EXP[1] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2313 && c.heightLevel == 1) {
c.startAnimation(828);
c.getPA().movePlayer(c.getX(), c.getY()-2, 2);
gnomeCourse[2] = true;
c.getPA().addSkillXP(EXP[2] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2312) {
c.getPA().walkTo(6,0);
c.getPA().addSkillXP(EXP[3] * Config.AGILITY_EXPERIENCE, c.playerAgility);
} else if (object == 2314) {
c.getPA().movePlayer(c.getX(), c.getY(), 0);
gnomeCourse[3] = true;
c.getPA().addSkillXP(EXP[4] * Config.AGILITY_EXPERIENCE, c.playerAgility);
}*/
}
private void giveReward(int level) {
/*c.sendMessage("You have completed the course and have been given " + level + " tickets.");
c.getItems().addItem(2996,level);
if (level == 1)
c.getPA().addSkillXP(EXP[EXP.length-1] * Config.AGILITY_EXPERIENCE, c.playerAgility);
for (int j = 0; j < gnomeCourse.length; j++)
gnomeCourse[j] = false;*/
}
private boolean isDoneGnome() {
//return gnomeCourse[0] && gnomeCourse[1] && gnomeCourse[2] && gnomeCourse[3] && gnomeCourse[4] && gnomeCourse[5];
return false;
}
}
Cooking:
package server.model.players.skills;
import server.model.players.Client;
import server.util.Misc;
import server.Config;
public class Cooking {
Client c;
public Cooking(Client c) {
this.c = c;
}
private int[][] cookingItems = {{317,315,7954,1,30},{335,333,323,20,70},{331,329,323,30,90},{359,361,363,35,100},{377,379,381,40,120},{371,373,375,50,140},{7944,7946,7948,62,150},{383,385,387,80,210},{389,391,393,91,169}};
public void itemOnObject(int id) {
for (int j = 0; j < cookingItems.length; j++) {
if (cookingItems[j][0] == id)
cookFish(cookingItems[j][0],j);
}
}
public void cookFish(int id, int slot) {
for (int j = 0; j < 28; j++) {
if (c.getItems().playerHasItem(id,1)) {
if (c.playerLevel[c.playerCooking] >= cookingItems[slot][3]) {
if (Misc.random(c.playerLevel[c.playerCooking] + 3 - cookingItems[slot][3]) == 1) {
c.sendMessage("You accidently burn the fish.");
c.getItems().deleteItem(id, c.getItems().getItemSlot(id), 1);
c.getItems().addItem(cookingItems[slot][2], 1);
} else {
c.getItems().deleteItem(id, c.getItems().getItemSlot(id), 1);
c.getItems().addItem(cookingItems[slot][1], 1);
c.getPA().addSkillXP(cookingItems[slot][4] * Config.COOKING_EXPERIENCE, c.playerCooking);
}
} else {
c.sendMessage("You need a cooking level of " + cookingItems[slot][3] + " to cook this fish.");
break;
}
} else {
break;
}
}
}
}
Crafting:
package server.model.players.skills;
import server.model.players.Client;
import server.Config;
public class Crafting {
Client c;
public Crafting(Client c) {
this.c = c;
}
public int hideType = 0, makeId = 0, amount = 0, craftType = 0, exp = 0, index = 0;
public void resetCrafting() {
hideType = 0;
makeId = 0;
amount = 0;
c.craftingLeather = false;
craftType = 0;
}
public void handleChisel(int id1, int id2) {
if (id1 == 1755)
cutGem(id2);
else
cutGem(id1);
}
public int[][] gems = {{1623,1727,1,50},{1621,1729,27,68},{1619,1725,34,85},{1617,1731,43,108},{1631,1712,55,138},{6571,6585,67,168}};
public void cutGem(int id) {
for (int j = 0; j < gems.length; j++) {
if (gems[j][0] == id) {
if (c.playerLevel[c.playerCrafting] >= gems[j][2]) {
c.getItems().deleteItem(id, c.getItems().getItemSlot(id),1);
c.getItems().addItem(gems[j][1], 1);
c.getPA().addSkillXP(gems[j][3] * Config.CRAFTING_EXPERIENCE, c.playerCrafting);
break;
}
}
}
}
public void handleCraftingClick(int clickId) {
for (int j = 0; j < buttons.length; j++) {
if (buttons[j][0] == clickId) {
craftType = buttons[j][1];
amount = buttons[j][2];
checkRequirements();
break;
}
}
}
public void checkRequirements() {
for (int j = 0; j < expsAndLevels.length; j++) {
if (expsAndLevels[j][0] == hideType) {
if (c.playerLevel[c.playerCrafting] >= expsAndLevels[j][1]) {
if (c.getItems().playerHasItem(hideType, 1)) {
c.getPA().closeAllWindows();
exp = expsAndLevels[j][2];
index = j;
craftHides(hideType);
}
} else {
c.sendMessage("You need a crafting level of " + expsAndLevels[j][1] + " to craft this.");
}
}
}
}
public void craftHides(int id) {
for (int j = 0; j < amount; j++) {
if (!c.getItems().playerHasItem(id,craftType))
break;
c.getItems().deleteItem(id, craftType);
if (getItemToAdd() <= 0)
break;
c.getItems().addItem(getItemToAdd(), 1);
c.getPA().addSkillXP(exp * Config.CRAFTING_EXPERIENCE, c.playerCrafting);
}
resetCrafting();
}
public int getItemToAdd() {
if (craftType == 1) {
return vambs[index];
} else if (craftType == 2) {
return chaps[index];
} else if (craftType == 3) {
return bodys[index];
}
return -1;
}
public int[] vambs = {1065,2487,2489,2491};
public int[] chaps = {1099,2493,2495,2497};
public int[] bodys = {1135,2499,2501,2503};
public void handleLeather(int item1, int item2) {
if (item1 == 1733) {
openLeather(item2);
} else {
openLeather(item1);
}
}
public int[][] buttons = {{34185,1,1},{34184,1,5},{34183,1,10},{34182,1,27},{34189,2,1},{34188,2,5},{34187,2,10},{34186,2,27},{34193,3,1},{34192,3,5},{34191,3,10},{34190,3,27}};
public int[][] expsAndLevels = {{1745,62,57},{2505,66,70},{2507,73,78},{2509,79,86}};
public void openLeather(int item) {
if (item == 1745) {
c.getPA().sendFrame164(8880); //green dhide
c.getPA().sendFrame126("What would you like to make?", 8879);
c.getPA().sendFrame246(8884, 250, 1099); // middle
c.getPA().sendFrame246(8883, 250, 1065); // left picture
c.getPA().sendFrame246(8885, 250, 1135); // right pic
c.getPA().sendFrame126("Vambs", 8889);
c.getPA().sendFrame126("Chaps", 8893);
c.getPA().sendFrame126("Body", 8897);
hideType = item;
} else if (item == 2505) {
c.getPA().sendFrame164(8880); //blue
c.getPA().sendFrame126("What would you like to make?", 8879);
c.getPA().sendFrame246(8884, 250, 2493); // middle
c.getPA().sendFrame246(8883, 250, 2487); // left picture
c.getPA().sendFrame246(8885, 250, 2499); // right pic
c.getPA().sendFrame126("Vambs", 8889);
c.getPA().sendFrame126("Chaps", 8893);
c.getPA().sendFrame126("Body", 8897);
hideType = item;
} else if (item == 2507) {
c.getPA().sendFrame164(8880);
c.getPA().sendFrame126("What would you like to make?", 8879);
c.getPA().sendFrame246(8884, 250, 2495); // middle
c.getPA().sendFrame246(8883, 250, 2489); // left picture
c.getPA().sendFrame246(8885, 250, 2501); // right pic
c.getPA().sendFrame126("Vambs", 8889);
c.getPA().sendFrame126("Chaps", 8893);
c.getPA().sendFrame126("Body", 8897);
hideType = item;
} else if (item == 2509) {
c.getPA().sendFrame164(8880);
c.getPA().sendFrame126("What would you like to make?", 8879);
c.getPA().sendFrame246(8884, 250, 2497); // middle
c.getPA().sendFrame246(8883, 250, 2491); // left picture
c.getPA().sendFrame246(8885, 250, 2503); // right pic
c.getPA().sendFrame126("Vambs", 8889);
c.getPA().sendFrame126("Chaps", 8893);
c.getPA().sendFrame126("Body", 8897);
hideType = item;
}
c.craftingLeather = true;
}
}
Farming:
package server.model.players.skills;
import server.Config;
import server.model.players.Client;
import server.util.Misc;
/**
* Farming.java
*
* @author Sanity
*
**/
public class Farming {
private Client c;
private final int[] VALID_SEEDS = {5291,5292,5293,5294,5295,5296,5297,5298,5299,5300,5301,5302,5303,5304};
private final int[] HERBS = {199,201,203,205,207,3049,209,211,213,3051,215,2485,217,219}; /* lant, toad, snap*/
private final int[] SEED_PLANT_EXP = {11,14,16,22,27,34,43,55,69,88,107,135,171,200};
private final int[] HERB_EXPS = {13,15,18,24,31,39,49,62,78,99,120,152,192,225};
private final int[] FARMING_REQS = {1,14,19,26,32,38,44,50,56,62,67,73,79,85};
private final int PATCH_HERBS = 8143;
private final int PATCH_WEEDS = 8389;
public Farming(Client c) {
this.c = c;
}
public void checkItemOnObject(int itemId) {
for (int j = 0; j < VALID_SEEDS.length; j++) {
if (itemId == VALID_SEEDS[j]) {
handleFarming(VALID_SEEDS[j],HERBS[j],HERB_EXPS[j], j);
return;
}
}
}
private void handleFarming(int seedId, int herbId, int exp, int slot) {
if (c.playerLevel[c.playerFarming] < FARMING_REQS[slot]) {
c.sendMessage("You need a farming level of " + FARMING_REQS[slot] + " to farm this seed.");
return;
}
if (c.getItems().playerHasItem(seedId,1)) {
c.getItems().deleteItem(seedId, c.getItems().getItemSlot(seedId), 1);
c.getPA().addSkillXP(SEED_PLANT_EXP[slot] * Config.FARMING_EXPERIENCE, c.playerFarming);
c.getPA().refreshSkill(c.playerFarming);
int herbAmount = Misc.random(5) + 3;
c.farm[0] = herbId;
c.farm[1] = herbAmount;
updateHerbPatch();
}
}
public int getExp() {
for (int j = 0; j < HERBS.length; j++)
if (HERBS[j] == c.farm[0])
return HERB_EXPS[j];
return 0;
}
public void updateHerbPatch() {
if (c.farm[0] > 0 && c.farm[1] > 0) {
//make object here
http://c.sendMessage("Make herbs...");
c.getPA().object(PATCH_HERBS,2813,3463,-1,10);
} else {
//make weed patch here
http://c.sendMessage("Make weeds...");
c.getPA().object(PATCH_WEEDS,2813,3463,-1,10);
}
}
public void pickHerb() {
if (c.farm[0] > 0 && c.farm[1] > 0) {
if (c.getItems().addItem(c.farm[0], 1)) {
http://c.startAnimation(2273);
c.getPA().addSkillXP(getExp() * Config.FARMING_EXPERIENCE, c.playerFarming);
c.farm[1]--;
if (c.farm[1] == 0)
c.farm[0] = -1;
updateHerbPatch();
c.sendMessage("You pick a herb.");
c.getPA().resetAnimation();
}
}
}
}
Fishing:
package server.model.players.skills;
import server.Config;
import server.util.Misc;
import server.model.players.Client;
/**
* Fishing.java
*
* @author Sanity
*
**/
public class Fishing {
private Client c;
private int fishType;
private int exp;
private int req;
private int equipmentType;
private final int SALMON_EXP = 70;
private final int SWORD_EXP = 100;
private final int SALMON_ID = 331;
private final int SWORD_ID = 371;
public boolean fishing = false;
private final int[] REQS = {1,20,40,35,62,76,81};
private final int[] FISH_TYPES = {317,335,359,359,7944,383,389};
private final int[] EXP = {10,50,80,90,120,110,46};
public Fishing(Client c) {
this.c = c;
}
public void setupFishing(int fishType) {
if (c.getItems().playerHasItem(getEquipment(fishType))) {
if (c.playerLevel[c.playerFishing] >= req) {
int slot = getSlot(fishType);
if (slot > -1) {
this.req = REQS[slot];
this.fishType = FISH_TYPES[slot];
this.equipmentType = getEquipment(fishType);
this.exp = EXP[slot];
c.fishing = true;
c.fishTimer = 3 + Misc.random(2);
}
} else {
c.sendMessage("You need a fishing level of " + req + " to fish here.");
resetFishing();
}
} else {
c.sendMessage("You do not have the correct equipment to use this fishing spot.");
resetFishing();
}
}
public void catchFish() {
if (c.getItems().playerHasItem(getEquipment(fishType))) {
if (c.playerLevel[c.playerFishing] >= req) {
if (c.getItems().freeSlots() > 0) {
if (canFishOther(fishType)) {
c.getItems().addItem(otherFishId(fishType),1);
c.getPA().addSkillXP(otherFishXP(fishType),c.playerFishing);
} else {
c.getItems().addItem(fishType,1);
c.getPA().addSkillXP(exp * Config.FISHING_EXPERIENCE,c.playerFishing);
}
c.sendMessage("You catch a fish.");
c.fishTimer = 2 + Misc.random(2);
}
} else {
c.sendMessage("You need a fishing level of " + req + " to fish here.");
resetFishing();
}
} else {
c.sendMessage("You do not have the correct equipment to use this fishing spot.");
resetFishing();
}
}
private int getSlot(int fishType) {
for (int j = 0; j < REQS.length; j++)
if (FISH_TYPES[j] == fishType)
return j;
return -1;
}
private int getEquipment(int fish) {
if (fish == 317) //shrimp
return 303;
if (fish == 335) //trout + salmon
return 309;
if (fish == 337) //lobs
return 301;
if (fish == 361)//tuna
return 311;
if (fish == 7944)//monks
return 303;
if (fish == 383)//sharks
return 311;
if (fish == 389)//mantas
return 303;
return -1;
}
private boolean canFishOther(int fishType) {
if (fishType == 335 && c.playerLevel[c.playerFishing] >= 30)
return true;
if (fishType == 361 && c.playerLevel[c.playerFishing] >= 50)
return true;
return false;
}
private int otherFishId(int fishType) {
if (fishType == 335)
return SALMON_ID;
else if (fishType == 361)
return SWORD_ID;
return -1;
}
private int otherFishXP(int fishType) {
if (fishType == 335)
return SALMON_EXP;
else if (fishType == 361)
return SWORD_EXP;
return 0;
}
public void resetFishing() {
this.exp = 0;
this.fishType = -1;
this.equipmentType = -1;
this.req = 0;
c.fishTimer = -1;
c.fishing = false;
}
}
Herblore:
package server.model.players.skills;
import server.Config;
import server.model.players.Client;
/**
* Herblore.java
*@author Sanity
**/
public class Herblore {
private Client c;
private int[][] information = {{199,249,1,3},{201,251,5,4},{203,253,11,5},{205,255,20,6},{207,257,25,8},
{3049,2998,30,8},{209,259,40,9},{211,261,48,10},{213,263,54,11},{3051,3000,59,12},
{215,265,65,13},{2485,2481,67,13},{217,267,70,14},{219,269,75,15}};
private int[][] information2 = {{249,121,2428,1,25},{251,175,2446,5,38},{253,115,113,12,50},{255,127,2430,22,63},
{257,139,2434,38,88},{261,2448,2448,40,100},{259,145,2436,45,100},{263,157,2440,55,125},{3000,3026,3024,63,143},
{265,163,2442,66,155},{2481,2454,2452,69,158},{267,169,2444,72,163},{269,189,2450,78,175},
{2998,6687,6685,81,180}};
//{identifiedHerbId,3dosepot,4dosepot,levelreq,exp}
public Herblore(Client c) {
this.c = c;
}
public void handleHerbClick(int herbId) {
for (int j = 0; j < information.length; j++){
if (information[j][0] == herbId)
idHerb(j);
}
}
public void handlePotMaking(int item1, int item2) {
if (item1 == 227 && isIdedHerb(item2))
makePot(item2);
else if (item2 == 227 && isIdedHerb(item1))
makePot(item1);
}
public boolean isUnidHerb(int clickId) {
for (int j = 0; j < information.length; j++)
if (information[j][0] == clickId)
return true;
return false;
}
public boolean isIdedHerb(int item) {
for (int j = 0; j < information2.length; j++)
if (information2[j][0] == item)
return true;
return false;
}
private void idHerb(int slot) {
if (c.getItems().playerHasItem(information[slot][0])) {
if (c.playerLevel[c.playerHerblore] >= information[slot][2]) {
c.getItems().deleteItem(information[slot][0],c.getItems().getItemSlot(information[slot][0]),1);
c.getItems().addItem(information[slot][1],1);
c.getPA().addSkillXP(information[slot][3] * Config.HERBLORE_EXPERIENCE,c.playerHerblore);
c.sendMessage("You identify the herb as a " + c.getItems().getItemName(information[slot][1]) + ".");
} else {
c.sendMessage("You need a herblore level of " + information[slot][2] + " to identify this herb.");
}
}
}
private void makePot(int herbId) {
if (c.getItems().playerHasItem(227) && c.getItems().playerHasItem(herbId)) {
int slot = getSlot(herbId);
if (c.playerLevel[c.playerHerblore] >= information2[slot][3]) {
c.getItems().deleteItem(herbId,c.getItems().getItemSlot(herbId),1);
c.getItems().deleteItem(227,c.getItems().getItemSlot(227),1);
/*if (c.playerLevel[c.playerHerblore] < information2[slot][3] + 15) {
c.getItems().addItem(information2[slot][1],1);
c.sendMessage("You make a " + c.getItems().getItemName(information2[slot][1]) + ".");
} else {*/
c.getItems().addItem(information2[slot][2],1);
c.sendMessage("You make a " + c.getItems().getItemName(information2[slot][2]) + ".");
//}
c.getPA().addSkillXP(information2[slot][4] * Config.HERBLORE_EXPERIENCE,c.playerHerblore);
} else {
c.sendMessage("You need a herblore level of " + information2[slot][3] + " to make this pot.");
}
}
}
private int getSlot(int herb) {
for (int j = 0; j < information2.length; j++)
if (information2[j][0] == herb)
return j;
return -1;
}
}
Slayer:
package server.model.players.skills;
import server.model.players.Client;
import server.Server;
import server.util.Misc;
/**
* Slayer.java
*
* @author Sanity
*
**/
public class Slayer {
private Client c;
public Slayer(Client c) {
this.c = c;
}
public int[] lowTasks = {1648, 1612, 117, 1265, 90, 103, 78, 119, 18,101,1265,181};
public int[] lowReqs = {5, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1};
public int[] medTasks = {1643,1618,941,119,82,52,1612,117,1265,112,125,1341};
public int[] medReqs = {45,50,1,1,1,1,15,1,1,1,1,1};
public int[] highTasks = {1624,1610,1613,1615,55,84,49,1618,941,82,2783,1341};
public int[] highReqs = {65,75,80,85,1,1,1,50,1,1,90,1};
public void giveTask() {
if (c.combatLevel < 50)
giveTask(1);
else if (c.combatLevel >= 50 && c.combatLevel <= 90)
giveTask(2);
else if (c.combatLevel > 90 && c.combatLevel <= 126)
giveTask(3);
else
giveTask(2);
}
public void giveTask2() {
for (int j = 0; j < lowTasks.length; j++) {
if (lowTasks[j] == c.slayerTask) {
c.sendMessage("You already have an easy task... to kill " + c.taskAmount + " " + Server.npcHandler.getNpcListName(c.slayerTask) + ".");
return;
}
}
giveTask(1);
}
public void giveTask(int taskLevel) {
int given = 0;
int random = 0;
if (taskLevel == 1) {
random = (int)(Math.random() * (lowTasks.length - 1));
given = lowTasks[random];
} else if (taskLevel == 2) {
random = (int)(Math.random() * (medTasks.length - 1));
given = medTasks[random];
} else if (taskLevel == 3) {
random = (int)(Math.random() * (highTasks.length - 1));
given = highTasks[random];
}
if (!canDoTask(taskLevel,random)) {
giveTask(taskLevel);
return;
}
c.slayerTask = given;
c.taskAmount = Misc.random(15) + 15;
c.sendMessage("You have been assigned to kill " + c.taskAmount + " " + Server.npcHandler.getNpcListName(given) + " as a slayer task.");
}
public boolean canDoTask(int taskLevel, int random) {
if (taskLevel == 1) {
return c.playerLevel[c.playerSlayer] >= lowReqs[random];
} else if (taskLevel == 2) {
return c.playerLevel[c.playerSlayer] >= medReqs[random];
} else if (taskLevel == 3) {
return c.playerLevel[c.playerSlayer] >= highReqs[random];
}
return false;
}
}
So you guys can work on these codes
Last edited by Sn0w Beast on Thu Dec 12, 2013 10:04 am; edited 1 time in total
Sn0w Beast- Forum Moderator
- Posts : 207
Join date : 2013-07-20
Age : 25
Location : U.S.
Re: Add some Skills
It's a pk & bossing server. Not a skilling server.
Jayden- Senior Member
- Posts : 440
Join date : 2013-07-19
Age : 28
Location : Australia
Re: Add some Skills
for now jayden but it would be cool to have a few skills to mess about with
J4mie- Senior Member
- Posts : 363
Join date : 2013-10-28
Age : 27
Location : United Kingdom
Re: Add some Skills
Lol, please don't post random code on the forums. But you know what, I am not the worst person. I will add skills into v2 if the community wants them, that means after we launch Edge4pk and IF more than 50% votes yes for the poll according to skills being added.
Re: Add some Skills
What harm can some skills do ay
J4mie- Senior Member
- Posts : 363
Join date : 2013-10-28
Age : 27
Location : United Kingdom
Re: Add some Skills
Yea man skilling's greatLestic wrote:Lol, please don't post random code on the forums. But you know what, I am not the worst person. I will add skills into v2 if the community wants them, that means after we launch Edge4pk and IF more than 50% votes yes for the poll according to skills being added.
C A P S- Master
- Posts : 500
Join date : 2013-06-15
Age : 27
Location : United Kingdom
Re: Add some Skills
Skilling!
Sn0w Beast- Forum Moderator
- Posts : 207
Join date : 2013-07-20
Age : 25
Location : U.S.
PureChaos :: Community :: Suggestions
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum