Thread: Full Herblore

Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1 Full Herblore 
    I'm President Carter


    Join Date
    Jan 2011
    Posts
    1,204
    Thanks given
    17
    Thanks received
    222
    Rep Power
    144
    Well I see no one is really releasing any new useful content for RSPS nowadays so I thought why not. So I wrote up a system for Herblore and it supports cleaning all herbs, making all unfinished points, and making all finished potions.

    Make a new class and name it Herbs.java:
    Code:
    package server.model.content.skills.herblore;
    
    public enum Herbs {
    	
    	GUAM(199, 249, 1, 3),
    	MARRENTILL(201, 251, 5, 4),
    	TARROMIN(203, 253, 11, 5),
    	HARRALANDER(205, 255, 20, 6),
    	RANARR(207, 257, 25, 8),
    	TOADFLAX(3049, 2998, 30, 8),
    	SPIRITWEED(12174, 12172, 35, 8),
    	IRIT(209, 259, 40, 9),
    	WERGALI(14836, 14854, 30, 8),
    	AVANTOE(211, 261, 48, 10),
    	KWUARM(213, 263, 54, 11),
    	SNAPDRAGON(3051, 3000, 59, 12),
    	CADANTINE(215, 265, 65, 13),
    	LANTADYME(2485, 2481, 67, 13),
    	DWARFWEED(217, 267, 70, 14),
    	TORSTOL(219, 269, 75, 15);
    	
    	private int grimyHerb, cleanHerb, levelReq, cleaningExp;
    	
    	private Herbs(int grimyHerb, int cleanHerb, int levelReq, int cleaningExp) {
    		this.grimyHerb = grimyHerb;
    		this.cleanHerb = cleanHerb;
    		this.levelReq = levelReq;
    		this.cleaningExp = cleaningExp;
    	}
    	
    	public int getGrimyHerb() {
    		return grimyHerb;
    	}
    	
    	public int getCleanHerb() {
    		return cleanHerb;
    	}
    	
    	public int getLevelReq() {
    		return levelReq;
    	}
    	
    	public int getExp() {
    		return cleaningExp;
    	}
    	
    	public static Herbs forId(int herbId){
    		for(Herbs herb : Herbs.values()) {
    			if (herb.getGrimyHerb() == herbId) {
    				return herb;
    			}
    		}
    		return null;
    	}
    	
    }
    Now make another class and call it FinishedPotions.java:
    Code:
    package server.model.content.skills.herblore;
    
    public enum FinishedPotions {
    	
    	ATTACK_POTION(121, 91, 221, 1, 25),
    	ANTIPOISON(175, 93, 235, 5, 38),
    	STRENGTH_POTION(115, 95, 225, 12, 50),
    	RESTORE_POTION(127, 97, 223, 22, 63),
    	ENERGY_POTION(3010, 97, 1975, 26, 68),
    	DEFENCE_POTION(133, 99, 239, 30, 75),
    	AGILITY_POTION(3034, 3002, 2152, 34, 80),
    	COMBAT_POTION(9741, 97, 9736, 36, 84),
    	PRAYER_POTION(139, 99, 231, 38, 88),
    	SUMMONING_POTION(12142, 12181, 12109, 40, 92),
    	CRAFTING_POTION(14840, 14856, 5004, 42, 92),
    	SUPER_ATTACK(145, 101, 221, 45, 100),
    	VIAL_OF_STENCH(18661, 101, 1871, 46, 0),
    	FISHING_POTION(181, 101, 235, 48, 106),
    	SUPER_ENERGY(3018, 103, 2970, 52, 118),
    	SUPER_STRENGTH(157, 105, 225, 55, 125),
    	WEAPON_POISON(187, 105, 241, 60, 138),
    	SUPER_RESTORE(3026, 3004, 223, 63, 143),
    	SUPER_DEFENCE(163, 107, 239, 66, 150),
    	ANTIFIRE(2454, 2483, 241, 69, 158),
    	RANGING_POTION(169, 109, 245, 72, 163),
    	MAGIC_POTION(3042, 2483, 3138, 76, 173),
    	ZAMORAK_BREW(189, 111, 247, 78, 175),
    	SARADOMIN_BREW(6687, 3002, 6693, 81, 180),
    	RECOVER_SPECIAL(15301, 3018, 5972, 84, 200),
    	SUPER_ANTIFIRE(15305, 2454, 4621, 85, 210),
    	EXTREME_ATTACK(15309, 145, 261, 88, 220),
    	EXTREME_STRENGTH(15313, 257, 267, 89, 230),
    	EXTREME_DEFENCE(15317, 163, 2481, 90, 240),
    	EXTREME_MAGIC(15321, 3042, 9594, 91, 250),
    	EXTREME_RANGING(15325, 169, 12539, 92, 260),
    	SUPER_PRAYER(15329, 139, 4255, 94, 270);
    	
    	private int finishedPotion, unfinishedPotion, itemNeeded, levelReq, expGained;
    	
    	private FinishedPotions(int finishedPotion, int unfinishedPotion, int itemNeeded, int levelReq, int expGained) {
    		this.finishedPotion = finishedPotion;
    		this.unfinishedPotion = unfinishedPotion;
    		this.itemNeeded = itemNeeded;
    		this.levelReq = levelReq;
    		this.expGained = expGained;
    	}
    	
    	public int getFinishedPotion(){
    		return finishedPotion;
    	}
    	
    	public int getUnfinishedPotion() {
    		return unfinishedPotion;
    	}
    	
    	public int getItemNeeded() {
    		return itemNeeded;
    	}
    	
    	public int getLevelReq() {
    		return levelReq;
    	}
    	
    	public int getExpGained() {
    		return expGained;
    	}
    	
    	public static FinishedPotions forId(int id) {
    		for(FinishedPotions pot : FinishedPotions.values()){
    			if (pot.getUnfinishedPotion() == id) {
    				return pot;
    			}
    		}
    		return null;
    	}
    	
    }
    Now make another class and name it UnfinishedPotions.java:
    Code:
    package server.model.content.skills.herblore;
    
    public enum UnfinishedPotions {
    	
    	GUAM_POTION(91, 249, 1),
    	MARRENTILL_POTION(93, 251, 5),
    	TARROMIN_POTION(95, 253, 12),
    	HARRALANDER_POTION(97, 255, 22),
    	RANARR_POTION(99, 257, 30),
    	TOADFLAX_POTION(3002, 2998, 34),
    	SPIRIT_WEED_POTION(12181, 12172, 40),
    	IRIT_POTION(101, 259, 45),
    	WERGALI_POTION(14856, 14854, 1),
    	AVANTOE_POTION(103, 261, 50),
    	KWUARM_POTION(105, 263, 55),
    	SNAPDRAGON_POTION(3004, 3000, 63),
    	CADANTINE_POTION(107, 265, 66),
    	LANTADYME(2483, 2481, 69),
    	DWARF_WEED_POTION(109, 267, 72),
    	TORSTOL_POTION(111, 269, 78);
    	
    	
    	private int unfinishedPotion, herbNeeded, levelReq;
    	
    	private UnfinishedPotions(int unfinishedPotion, int herbNeeded, int levelReq) {
    		this.unfinishedPotion = unfinishedPotion;
    		this.herbNeeded = herbNeeded;
    		this.levelReq = levelReq;
    	}
    	
    	public int getUnfPotion() {
    		return unfinishedPotion;
    	}
    	
    	public int getHerbNeeded() {
    		return herbNeeded;
    	}
    	
    	public int getLevelReq() {
    		return levelReq;
    	}
    	
    	public static UnfinishedPotions forId(int herbId) {
    		for(UnfinishedPotions unf : UnfinishedPotions.values()) {
    			if (unf.getHerbNeeded() == herbId) {
    				return unf;
    			}
    		}
    		return null;
    	}
    	
    }
    Finally make one last class and name it Herblore.java:
    Code:
    package server.model.content.skills.herblore;
    
    import server.model.World;
    import server.model.content.skills.SkillConstants;
    import server.model.players.Player;
    import server.task.Task;
    
    public class Herblore {
    	
    	public static final int VIAL = 227;
    	private static final int ANIMATION = 363;
    	
    	public static boolean cleanHerb(final Player player, final int herbId) {
    		Herbs herb = Herbs.forId(herbId);
    		if (herb == null) {
    			return false;
    		}
    		if(player.getItems().playerHasItem(herb.getGrimyHerb())) {
    			if (player.getLevelForXP(player.playerXP[player.playerHerblore]) < herb.getLevelReq()) {
    				player.getActionSender().sendMessage("You need a Herblore level of " + herb.getLevelReq() + " to clean this leaf.");
    				return false;
    			}
    			player.getItems().deleteItem(herb.getGrimyHerb(), 1);
    			player.getItems().addItem(herb.getCleanHerb(), 1);
    			player.getPA().addSkillXP(herb.getExp() * SkillConstants.HERBLORE_MULTPLIER, player.playerHerblore);
    			player.getActionSender().sendMessage("You clean the dirt off the leaf.");
    			return true;
    		}
    		return false;
    	}
    	
    	public static boolean makeUnfinishedPotion(final Player player, final int herbId) {
    		final UnfinishedPotions unf = UnfinishedPotions.forId(herbId);
    		if (unf == null) {
    			return false;
    		}
    		if (player.getSkill().isSkilling()[player.playerHerblore]) {
    			return false;
    		}
    		if (player.getLevelForXP(player.playerXP[player.playerHerblore]) < unf.getLevelReq()) {
    			player.getActionSender().sendMessage("You need a Herblore level of " + unf.getLevelReq() + " to make this potion.");
    			return false;
    		}
    		if (player.getItems().playerHasItem(VIAL) && player.getItems().playerHasItem(unf.getHerbNeeded())) {
    			player.getSkill().setSkilling(true, player.playerHerblore);
    			player.startAnimation(ANIMATION);
    			World.submit(new Task(3, true) {
    				protected void execute() {
    					player.getItems().deleteItem(VIAL, player.getItems().getItemSlot(VIAL), 1);
    					player.getItems().deleteItem(unf.getHerbNeeded(), player.getItems().getItemSlot(unf.getHerbNeeded()), 1);
    					player.getItems().addItem(unf.getUnfPotion(), 1);
    					player.getActionSender().sendMessage("You put the " + player.getItems().getHerbName(unf.getHerbNeeded()) + " into the vial of water.");
    					player.getSkill().setSkilling(false, player.playerHerblore);
    					this.stop();
    				}
    			});
    			return true;
    		}
    		return false;
    	}
    	
    	public static boolean finishPotion(final Player player, final int itemUsed, final int usedWith) {
    		final FinishedPotions pot = FinishedPotions.forId(itemUsed);
    		if (pot == null) {
    			return false;
    		}
    		if (player.getSkill().isSkilling()[player.playerHerblore]) {
    			return false;
    		}
    		if (player.getLevelForXP(player.playerXP[player.playerHerblore]) < pot.getLevelReq()) {
    			player.getActionSender().sendMessage("You need a Herblore level of " + unf.getLevelReq() + " to make this potion.");
    			return false;
    		}
    		if(itemUsed == pot.getUnfinishedPotion() && usedWith == pot.getItemNeeded()) {
    			player.getSkill().setSkilling(true, player.playerHerblore);
    			player.startAnimation(ANIMATION);
    			World.submit(new Task(3, true) {
    				protected void execute() {
    					player.getItems().deleteItem(pot.getUnfinishedPotion(), 1);
    					player.getItems().deleteItem(pot.getItemNeeded(), 1);
    					player.getItems().addItem(pot.getFinishedPotion(), 1);
    					player.getPA().addSkillXP(pot.getExpGained() * SkillConstants.HERBLORE_MULTPLIER, player.playerHerblore);
    					player.getActionSender().sendMessage("You combine the ingredients to make a " + player.getItems().getItemName(pot.getFinishedPotion()));
    					player.getSkill().setSkilling(false, player.playerHerblore);
    					this.stop();
    				}
    			});
    			return true;
    		}
    		return false;
    	}
    
    }
    Now go to UseItem.java and add this under ItemonItem:
    Code:
    		if (itemUsed == Herblore.VIAL || useWith == Herblore.VIAL){
               if (Herblore.makeUnfinishedPotion(player, itemUsed) || Herblore.makeUnfinishedPotion(player, useWith))
            	   return;
            }
    		if (Herblore.finishPotion(player, itemUsed, useWith) || Herblore.finishPotion(player, useWith, itemUsed))
    			return;
    Now go to ClickItem.java and add this:
    Code:
    		if (Herblore.cleanHerb(player, itemId))
    			return;
    And now you are done and have fully working herblore. Enjoy and please thank/rep if you used this.

    Spoiler for Some Extra Methods:

    Code:
    	public String getHerbName(int ItemID) {
    		for (int i = 0; i < Config.ITEM_LIMIT; i++) {
    			if (Server.itemHandler.ItemList[i] != null) {
    				if (Server.itemHandler.ItemList[i].itemId == ItemID) {
    					return Server.itemHandler.ItemList[i].itemName.replace("Clean", "");
    				}
    			}
    		}
    		return "";
    	}


    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Registered Member
    Xynth's Avatar
    Join Date
    May 2009
    Posts
    2,222
    Thanks given
    226
    Thanks received
    259
    Rep Power
    1155
    Nice Gilbert.
    Reply With Quote  
     

  4. #3  
    Banned

    Join Date
    Jun 2012
    Posts
    1,063
    Thanks given
    119
    Thanks received
    199
    Rep Power
    0
    Looks good
    Reply With Quote  
     

  5. #4  
    Donator


    Join Date
    Mar 2011
    Posts
    2,350
    Thanks given
    1,193
    Thanks received
    824
    Rep Power
    856
    Good release . Nice to see things like this.
    Reply With Quote  
     

  6. #5  
    Registered Member

    Join Date
    May 2012
    Posts
    343
    Thanks given
    92
    Thanks received
    23
    Rep Power
    86
    Looks nice! Keep it up.
    Reply With Quote  
     

  7. #6  
    Banned

    Join Date
    Jun 2010
    Age
    36
    Posts
    4,335
    Thanks given
    4
    Thanks received
    274
    Rep Power
    0
    thanks might use it !
    Reply With Quote  
     

  8. #7  
    looking for partnership

    Satan's Avatar
    Join Date
    Oct 2010
    Posts
    833
    Thanks given
    287
    Thanks received
    68
    Rep Power
    269
    Good job !

    [/url]
    Reply With Quote  
     

  9. #8  
    need java lessons
    Eclipse's Avatar
    Join Date
    Aug 2012
    Posts
    4,436
    Thanks given
    686
    Thanks received
    898
    Rep Power
    490
    Looks pretty.

    Quote Originally Posted by jerryrocks317 View Post
    i am 14 and have my own laptop im on almost 24/7 currently creating rsps lol so please get off my thread lol
    Reply With Quote  
     

  10. #9  
    Registered Member ajmcbsat1's Avatar
    Join Date
    May 2012
    Posts
    576
    Thanks given
    118
    Thanks received
    27
    Rep Power
    0
    how do i make a new file
    Reply With Quote  
     

  11. #10  



    Join Date
    Oct 2011
    Posts
    874
    Thanks given
    301
    Thanks received
    373
    Rep Power
    338
    Nice release. Great job.
    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

Similar Threads

  1. Avanti: Full Herblore
    By Tha Rulla in forum Show-off
    Replies: 13
    Last Post: 10-28-2012, 06:55 PM
  2. [Hyperion]Full Herblore
    By Vanikan in forum Snippets
    Replies: 49
    Last Post: 06-24-2012, 11:00 PM
  3. [AZURE] Full herblore
    By Satan666 in forum Snippets
    Replies: 21
    Last Post: 12-04-2011, 09:13 AM
  4. Full Hyperion Herblore.
    By Nadroj m4 in forum Projects
    Replies: 5
    Last Post: 04-16-2011, 09:24 PM
  5. Base to full Herblore, Fletching, etc.
    By Jazz in forum Tutorials
    Replies: 6
    Last Post: 10-30-2007, 01:52 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •