Could someone review my Runecrafting. Tell me if anything is wrong or if there is a shorter way of doing it.
Code:
package martin.com.world.Skills;
import martin.com.client;
public class Runecrafting {
public static final int[] BLOOD_RUNE = {77, 50};
public static final int[] DEATH_RUNE = {65, 45};
public static final int[] LAW_RUNE = {54, 42};
public static final int[] NATURE_RUNE = {44, 40};
public static final int[] CHAOS_RUNE = {35, 35};
public static final int[] COSMIC_RUNE = {27, 30};
public static final int[] BODY_RUNE = {20, 25};
public static final int[] FIRE_RUNE = {14, 20};
public static final int[] EARTH_RUNE = {9, 18};
public static final int[] WATER_RUNE = {5, 12};
public static final int[] MIND_RUNE = {2, 10};
public static final int[] AIR_RUNE = {1, 5};
public static final int[] UNKNOWN_RUNE = {0, 0};
public static int[] getRuneInformation(int runeID) {
switch(runeID) {
case 565: //Blood rune
return BLOOD_RUNE;
case 560: //Death rune
return DEATH_RUNE;
case 563: //Law rune
return LAW_RUNE;
case 561: //Nature
return NATURE_RUNE;
case 562: //Chaos
return CHAOS_RUNE;
case 564: //Cosmic
return COSMIC_RUNE;
case 559: //Body
return BODY_RUNE;
case 554: //Fire
return FIRE_RUNE;
case 557: //Earth
return EARTH_RUNE;
case 555: //Water
return WATER_RUNE;
case 558: //Mind
return MIND_RUNE;
case 556: //Air
return AIR_RUNE;
default: //Unknown
return UNKNOWN_RUNE;
}
}
public static final int RUNE_ESSENCE = 1436;
public static void craftRune(client c, int runeID) {
int runeValues[] = getRuneInformation(runeID);
int requiredLevel = runeValues[0];
int experienceGain = runeValues[1];
int essenceCount = 0;
if(c.playerLevel[20] > requiredLevel) {
if(c.freeSlots() == 0) {
c.sendMessage("Not enough space in your inventory.");
} else {
for(int i = 0; i < c.playerItems.length; i++)
if(c.playerItems[i] == RUNE_ESSENCE) {
essenceCount++;
c.deleteItem(RUNE_ESSENCE, i, 1);
c.addItem(runeID, essenceCount);
}
}
c.addSkillXP(essenceCount*experienceGain, c.playerRunecrafting);
c.sendMessage("You runecraft " + essenceCount + " " + c.getItemName(runeID) + ".");
} else {
c.sendMessage("You need a " + c.statName[c.playerRunecrafting] + " level of " + requiredLevel + " to craft these runes.");
}
}
}