Thread: [RS2E] Fletching

Results 1 to 3 of 3
  1. #1 [RS2E] Fletching 
    Encouragin
    Guest
    Description: Fletching System.

    Difficulty: 3/10

    Assumed Knowledge: Basic Java and knowing how to use RS2E.

    Tested Server: Pk Predatory (RS2E)

    Files/Classes Modified: Fletching.java

    Procedure:

    Step 1: The fletching class. Open up Skills folder and create new class called Fletching.java:
    Code:
    /*
    
     * @author Encouragin
    
     * Class Name: Fletching
    
     * Information: Handles Fletching Skill.
    
     */
    
    package RS2E.Skills;
    
    import RS2E.Main;
    import RS2E.Players.*;
    import RS2E.NPCs.*;
    
    public class Fletching {
    
    	Player p;
    
    	public Fletching(Player _p) {
    	p = _p;
    	}
    
    	int getWood() {
    	switch (p.getFletchType()) {
    
    		case 1: return 1511;
    	}
    	return 0;
    	}
    
    	int getBow() {
    	switch (p.getFletchType()) {
    
    		case 1: return 52;
    	}
    	return 0;
    	}
    
    	int getExperience() {
    	switch (p.getFletchType()) {
    
    		case 1: return 15;
    	}
    	return 0;
    	}
    
    	public void fletchSystem() {
    	   if (p == null)
    	   {
    		return;
    	   }
    	   PlayerItems pi = new PlayerItems();
    	   if (pi.freeSlots(p) >= 0) {
    	   	if (p.IsFletching()) {
    			p.requestAnim(1248, 0);
    			pi.deleteItem(p, getWood(), pi.getItemSlot(p, getWood()), 1);
    			pi.addItem(p, getBow(), 15);
    			p.addSkillXP(getExperience(), 9);
    			p.frame.sendMessage(p, "You fletched a bow.");
    			p.setFletchDelay(4);
    	   		}
    			if (!pi.playerHasItem(p, getWood())) {
    			p.setFletching(false);
    			p.setFletchDelay(-1);
    			p.frame.sendMessage(p, "You ran out of logs.");
    			}
    	  	} else {
    		p.setFletching(false);
    		p.setFletchDelay(-1);
    		p.frame.sendMessage(p, "Not enough space in your inventory.");
    	   }
    	}
    	
    
    }
    Step 2: Close Skills folder and head to Players folder -> PlayerItems.java. declare this method:
    Code:
        public boolean playerHasItem(Player p, int ItemId)
    	{
    		for (int i=0; i <p.items.length; i++)
    		{
    			if (p.items[i] == ItemId+1)
    			{
    				return true;
    			}
    		}
    		return false;
    
    	}
    Step 3: Close PlayerItems.java and open up PlayerInstance.java. The methods below are there for you to declare:
    Code:
    /**
         * Fletching Variables
         */
        int fletchDelay;
        int fletchType;
        boolean isFletching;
    
        public void setFletchDelay(int fletchDelay) {
    	this.fletchDelay = fletchDelay;
        }
    
        public boolean IsFletching() {
    	return isFletching;
        }
    
        public void setFletchType(int fletchType) {
    	this.fletchType = fletchType;
        }
    
        public void setFletching(boolean isFletching) {
    	this.isFletching = isFletching;
        }
    
        public int getFletchType() {
    	return fletchType;
        }
    Step 4: The fletchin auto system. Head to Player.java and add these to process:
    Code:
    	if (fletchDelay > 0)
    	{
    	    fletchDelay--;
    	}
    	if (fletchDelay == 0 && IsFletching())
    	{
    	    Fletching fl = new Fletching(this);
    	    fl.fletchSystem();
    	    fl = null;
    	}
    the import:
    Code:
    import RS2E.Skills.Fletching;
    Step 5: Walking away = Stop fletching. -> Walk.java Packets folder. Method:
    MainWalkReset.
    Code:
    	p.setFletching(false);
    	p.setFletchDelay(-1);
    Step 6: Item on Item. This requires My Item on Item tutorial. If you dont have it. I suggest you do it. or else you cant do this. Open up ItemOnItem.java and add this:
    Code:
    	    if (usedItem == 946 && itemTarget == 1511 || usedItem == 1511 && itemTarget == 946) {
    	    p.setFletchType(1);
    	    p.setFletchDelay(1);
    	    p.setFletching(true);
    	    }
    Note:
    This fletching System do NOT Include Interfaces. If you want Interfaces you have to go search for yourself. Have a nice day.

    Credits:
    Palidino76 - Creating RS2E
    Ownage Bone/Encouragin - For making Fletching System.
    wL - for a simple item method.
     

  2. #2  
    sυввч

    Sub's Avatar
    Join Date
    Aug 2007
    Age
    24
    Posts
    4,352
    Thanks given
    1,205
    Thanks received
    359
    Rep Power
    2845
    gooood! we relsing rsemu stuff
     

  3. #3  
    Encouragin
    Guest
    Quote Originally Posted by Sub View Post
    gooood! we relsing rsemu stuff
    Lul, Im gonna release dialogues soon. Just gotta find out how to make them activate if first click npc option got activated. Wont take long tbh.
     


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
  •