Can someone review my RuneCrafting?

electron

New member
Joined
Nov 30, 2010
Messages
1
Points
0
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.");
        }
            
    }
        
}
 
You didn't do much with the altars. Idk how buggy those would be.

This is mine:

Code:
package server.players.Skills;

import server.players.client;
import server.util.misc;
import server.*;
import server.util.*;
import server.players.*;
public class Runecrafting {



	public client client;


	public Runecrafting(client c) {
	client = c;
	}

	public void runecraft(client c, int level, int experience, int rune, int a2,
				int a3, int a4, int a5, int a6, int a7,	int a8,
					int a9, int a10)
		{
			int essence = c.amountOfItem(7936);
			if (c.playerLevel[c.playerRunecrafting] < level)
			{
				c.CAM().sendMessage("You do not have enough runes to craft this.");
				c.CAM().sendMessage("You need at least "+level+" to runecraft this.");
				return;
			}
			if (!c.playerHasItem(7936))
			{
				c.CAM().sendMessage("You do not have any pure essence to craft.");
				return;
			}
			if (c.playerLevel[c.playerRunecrafting] >= level)
			{
				if (c.playerLevel[c.playerRunecrafting] >= a2 && c.playerLevel[c.playerRunecrafting] < a3)
					essence = c.amountOfItem(7936) * 2;
				if (c.playerLevel[c.playerRunecrafting] >= a3 && c.playerLevel[c.playerRunecrafting] < a4)
					essence = c.amountOfItem(7936) * 3;
				if (c.playerLevel[c.playerRunecrafting] >= a4 && c.playerLevel[c.playerRunecrafting] < a5)
					essence = c.amountOfItem(7936) * 4;
				if (c.playerLevel[c.playerRunecrafting] >= a5 && c.playerLevel[c.playerRunecrafting] < a6)
					essence = c.amountOfItem(7936) * 5;
				if (c.playerLevel[c.playerRunecrafting] >= a6 && c.playerLevel[c.playerRunecrafting] < a7)
					essence = c.amountOfItem(7936) * 6;
				if (c.playerLevel[c.playerRunecrafting] >= a7 && c.playerLevel[c.playerRunecrafting] < a8)
					essence = c.amountOfItem(7936) * 7;
				if (c.playerLevel[c.playerRunecrafting] >= a8 && c.playerLevel[c.playerRunecrafting] < a9)
					essence = c.amountOfItem(7936) * 8;
				if (c.playerLevel[c.playerRunecrafting] >= a9 && c.playerLevel[c.playerRunecrafting] < a10)
					essence = c.amountOfItem(7936) * 9;
				if (c.playerLevel[c.playerRunecrafting] >= a10)
					essence = c.amountOfItem(7936) * 10;

			}
			for (int i = 0; i < 30; i++) {
			c.deleteItem2(7936, 30);
			c.addItem(rune, essence);
			c.addSkillXP(experience*essence * server.SERVER_EXPERIENCE, c.playerRunecrafting);
			c.CAM().sendMessage("You bind the temple's power into "+c.getItemName(rune)+".");
			c.startAnimation(791);
			c.proGFX(186);
			return;
			}
		}
 
Just Rip an RC base from any delta, it works for Devo fine.

~Damon
 
Back
Top