Thread: RuneCrafting

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 RuneCrafting 
    Banned
    Join Date
    Jan 2010
    Posts
    218
    Thanks given
    5
    Thanks received
    1
    Rep Power
    0
    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;
    }
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jan 2009
    Posts
    764
    Thanks given
    0
    Thanks received
    10
    Rep Power
    3
    Nice, umm Might use it
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Jul 2009
    Posts
    383
    Thanks given
    4
    Thanks received
    9
    Rep Power
    0
    Good job.

    Code:
    	public int[] APPEND_DATA = {
    			1436, 5527, 5529, 5531, 5533, 5535, 5537, 5539, 5541, 5543, 5545, 5547, 5549, 5551	
    	};
    	
    	public int[] APPEND_ITEMS = {
    			556, 558, 555, 559, 557, 554, 564, 561, 562, 563, 560, 565, 566
    	};
    	
    	public int[] CHECK_LEVELS = {
    			1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
    	};
    Those should be final
    Reply With Quote  
     

  4. #4  
    Banned
    Join Date
    Jan 2010
    Posts
    218
    Thanks given
    5
    Thanks received
    1
    Rep Power
    0
    Why'd you give away the anti leech . There you go theres your fixed anti-leech.
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Jan 2010
    Posts
    218
    Thanks given
    5
    Thanks received
    1
    Rep Power
    0
    I guess lol, but I didn't want to make it to hard.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Slay No More's Avatar
    Join Date
    Oct 2008
    Age
    28
    Posts
    2,335
    Thanks given
    696
    Thanks received
    170
    Rep Power
    554
    dude make it to hard? why release then. lol.
    Add me on skype if you wish to contact me.
    slaynomore
    My Steam Profile (from SteamDB)
    • Worth: $719 ($245 with sales)
    • Games owned: 86
    • Games not played: 27 (31%)
    • Hours on record: 1,851.8h
    Reply With Quote  
     

  7. #7  
    Banned
    Join Date
    Jan 2010
    Posts
    218
    Thanks given
    5
    Thanks received
    1
    Rep Power
    0
    I like to be nice .
    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Jan 2008
    Age
    31
    Posts
    1,380
    Thanks given
    76
    Thanks received
    384
    Rep Power
    962
    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;
    
    }
    Redundant class, can be placed in RuneCrafting class.

    Also, those arrays should be final.
    Reply With Quote  
     

  9. #9  
    Banned
    Join Date
    Jan 2010
    Posts
    218
    Thanks given
    5
    Thanks received
    1
    Rep Power
    0
    We have already discussed it wow.., I know the class is Redundant, though I like to be neat and spread things out, there is no harm in that since it isn't causing any more usage. Also to clear up things, I placed an anti-leech in there, I know it was meant to be final.
    Reply With Quote  
     

  10. #10  
    Axed
    Guest
    Leave the guy alone guys, he said it was an anti-leech, and + I looked at his posts, and I think he understands what he doing.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •