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.