I made this today because I was bored, it is basic, and doesn't give the runes depending on your altars. This will be done for my server base only. Before you start flaming me, I know that I could of used a 2D array, though I couldn't be bothered, and I wanted you guys to learn stuff by your selves. You will need to set the levels your self, and the tiara + tailsman checking, and switch through the altars. One more thing, you will need to make it give the amount that you have in your inventory, I didn't set it to see if anyone will know how to do it.
Ok lets start.
Create a new Class called RuneCrafting.java and place that inside:
Code:
package server.players.Skills;
import server.*;
import server.players.*;
public class RuneCrafting {
public final int[] APPEND_DATA = {
1436, 5527, 5529, 5531, 5533, 5535, 5537, 5539, 5541, 5543, 5545, 5547, 5549, 5551
};
public final int[] APPEND_ITEMS = {
556, 558, 555, 559, 557, 554, 564, 561, 562, 563, 560, 565, 566
};
public final int[] CHECK_LEVELS = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
};
public void doRuneCrafting(client c) {
if (c.getStatus().isBusy()) {
return;
}
if (!c.GoodDistance(c.skillX, c.skillY, c.getX(), c.getY(), 2)) {
c.Main().sendMessage("You expect me to RuneCraft from here?");
c.getRuneGetter().setCanRuneCraft(false);
resetRuneCrafting(c);
return;
}
if(c.freeSlots() < 1) {
c.Main().sendMessage("You do not have any essence left.");
c.getRuneGetter().setCanRuneCraft(false);
resetRuneCrafting(c);
return;
}
for(int i = 0; i < APPEND_DATA.length; i++) {
if(c.Main().playerHasItem1(APPEND_DATA[i])) {
checkLevels(c);
c.getRuneGetter().setCanRuneCraft(true);
c.deleteItem(APPEND_DATA[i], 1);
c.addItem(APPEND_ITEMS[i], 1);
c.Main().sendMessage("You have crafted some runes.");
c.getRuneGetter().setAmountLeft(c.getRuneGetter().getAmountLeft() - 1);
} else {
resetRuneCrafting(c);
}
}
}
public void checkLevels(client c) {
for(int i = 0; i < CHECK_LEVELS.length; i++) {
if(c.playerLevel[20] < CHECK_LEVELS[i]) {
c.Main().sendMessage("You need a level of " + CHECK_LEVELS[i] + " to runecraft this.");
resetRuneCrafting(c);
return;
}
}
}
public void resetRuneCrafting(client c) {
c.getRuneGetter().setCanRuneCraft(false);
c.getRuneGetter().setAmountLeft(0);
c.getStatus().setNotBusy();
}
}
Ok now create a new Class called RuneGetters.java and place this inside:
Code:
public class RuneGetters {
public void setCanRuneCraft(boolean canRuneCraft) {
this.canRuneCraft = canRuneCraft;
}
public boolean CanRuneCraft() {
return canRuneCraft;
}
private boolean canRuneCraft;
public void setAmountLeft(int amountLeft) {
this.amountLeft = amountLeft;
}
public int getAmountLeft() {
return amountLeft;
}
private int amountLeft;
}
Ok now add this in your objectOption Class, under the switch statement:
Code:
case 7139:
case 2478://Air
case 7140:
case 2479://Mind
case 7137:
case 2480://Water
case 7130:
case 2481://Earth
case 7129:
case 4091://Fire
case 7131:
case 2483://Body
case 7132:
case 2484://Cosmic
case 7134:
case 2487://Chaos
case 7133:
case 2486://Nature
case 7135:
case 2485://Law
case 7136:
case 2488://Death
case 7141://Blood
case 7138://Soul
c.getRuneCrafting().doRuneCrafting(c);
break;
Ok now in your client Class place inside:
Code:
private RuneGetters getter = new RuneGetters();
public RuneGetters getRuneGetter() {
return getters;
}
Also this:
Code:
private RuneCrafting crafting = new RuneCrafting();
public RuneCrafting getRuneCrafting() {
return crafting;
}