Fire Rag3
March 12th, 2011, 06:13
Made it for Legion, but meh... some people might find this useful as it can be used for 562, also.
Anyways, figure out how to use it yourself.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rs2hd.skills.herblore;
import com.rs2hd.event.Event;
import com.rs2hd.model.Item;
import com.rs2hd.model.Player;
import com.rs2hd.model.Skills;
import com.rs2hd.model.World;
/**
*
* @author James
*/
public class Herblore {
private static final int[][] HERB_DATA = {
//grimy Herb, Clean Herb, EXP, lvl req
{199, 249, 3, 1}, //guam
{201, 251, 4, 5}, //marrentill
{203, 253, 5, 11}, //tarromin
{205, 255, 6, 20}, //harralander
{207, 257, 7, 25}, //ranarr
{3049, 2998, 8, 30}, //toadflax
{209, 259, 9, 40}, //irit
{211, 261, 10, 48}, //avantoe
{213, 263, 11, 54}, //kwaurm
{3000, 3051, 12, 59}, //snapdragon
{215, 265, 13, 65}, //Cadantine
{2485, 2481, 14, 67}, //Lantadyme
{217, 267, 15, 70}, //dwarf weed
{219, 269, 16, 75} //torstel
};
public static void cleanHerb(Player p) {
for (int[] data : HERB_DATA) {
int grimyHerb = data[0];
int cleanHerb = data[1];
int experience = data[2];
int levelReq = data[3];
if (!p.getInventory().contains(grimyHerb)) {
p.getActionSender().sendMessage("You do not have this herb in your inventory!");
return;
}
if (p.getSkills().getLevel(Skills.HERBLORE) < levelReq) {
p.getActionSender().sendMessage("You need an herblore level of atleast " + levelReq + " to clean this herb.");
return;
}
Item item = new Item(grimyHerb);
p.getInventory().deleteItem(grimyHerb, 1);
p.getInventory().addItem(cleanHerb, 1);
p.getSkills().addXp(15, experience);
p.getActionSender().sendMessage("You cleaned the dirt from the grimy " + item.getDefinition().getName().toLowerCase());
}
}
private static final int[][] POTION_DATA = {
//herbID, unf Potion, Second Ingre, finished Potion, EXP, lvl req
{249, 91, 221, 121, 25, 1}, //guam
{251, 93, 235, 175, 38, 5}, //marrentill
{253, 95, 225, 115, 50, 12}, //tarromin
{255, 97, 223, 127, 62, 22}, //harralander
{257, 99, 231, 139, 88, 38}, //ranarr
{259, 101, 221, 145, 100, 45}, //irit
{261, 103, 231, 151, 113, 50}, //avantoe
{263, 105, 225, 157, 125, 55}, //kwaurm
{3051, 3004, 223, 3026, 143, 63}, //snapdragon
{265, 107, 239, 163, 150, 66}, //Cadantine
{267, 109, 245, 169, 163, 72}, //dwarf weed
{2481, 2483, 3138, 3042, 173, 76}, //Lantadyme
{269, 111, 247, 189, 175, 78}, //torstel
{2998, 3002, 6693, 6687, 180, 81} //toadflax
};
public static boolean handlePotions(Player p, int itemUsed, int usedWith, int slot) {
for (int[] data : POTION_DATA) {
int herbId = data[0];
int unfPot = data[1];
int secondIngre = data[2];
int potionId = data[3];
int experience = data[4];
int levelReq = data[5];
if (itemUsed == herbId && usedWith == 227 || itemUsed == 227 && usedWith == herbId) {
if (p.getSkills().getLevel(Skills.HERBLORE) > levelReq) {
p.getActionSender().sendMessage("You need an Herblore level of at least " + levelReq + " to make this potion.");
return false;
}
if (!p.getInventory().contains(itemUsed) || !p.getInventory().contains(usedWith)) {
p.getActionSender().sendMessage("Noob hacker.");
return false;
}
makeUnfinishedPotion(p, herbId, unfPot);
return true;
}
if (itemUsed == unfPot && usedWith == secondIngre || itemUsed == secondIngre && usedWith == unfPot) {
if (p.getSkills().getLevel(Skills.HERBLORE) > 0) {
p.getActionSender().sendMessage("You need an Herblore level of at least " + levelReq + " to make this potion.");
return false;
}
if (!p.getInventory().contains(itemUsed) || !p.getInventory().contains(usedWith)) {
p.getActionSender().sendMessage("Noob hacker.");
return false;
}
makeFinishedPotion(p, unfPot, secondIngre, potionId, experience);
}
}
return false;
}
public static void makeUnfinishedPotion(final Player p, final int herbID, final int unfPot) {
final Item item = new Item(herbID, 1);
p.getInventory().deleteItem(herbID, 1);
p.getInventory().deleteItem(227, 1);
p.animate(363, 0);
p.setBusy(true);
p.getActionSender().sendMessage("You put the " + item.getDefinition().getName().toLowerCase() + " into the vial of water.");
World.getInstance().registerEvent(new Event(600) {
public void execute() {
p.getInventory().addItem(unfPot, 1);
this.stop();
}
});
}
public static void makeFinishedPotion(final Player p, final int unfPot, int second, final int potion, final int exp) {
final Item item = new Item(second);
p.getInventory().deleteItem(second, 1);
p.getInventory().deleteItem(unfPot, 1);
p.animate(363, 0);
p.setBusy(true);
p.getActionSender().sendMessage("You carefully mix the " + item.getDefinition().getName().toLowerCase() + " into your potion");
World.getInstance().registerEvent(new Event(600) {
public void execute() {
p.getInventory().addItem(potion, 1);
p.getSkills().addXp(15, exp);
this.stop();
}
});
}
}
Anyways, figure out how to use it yourself.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rs2hd.skills.herblore;
import com.rs2hd.event.Event;
import com.rs2hd.model.Item;
import com.rs2hd.model.Player;
import com.rs2hd.model.Skills;
import com.rs2hd.model.World;
/**
*
* @author James
*/
public class Herblore {
private static final int[][] HERB_DATA = {
//grimy Herb, Clean Herb, EXP, lvl req
{199, 249, 3, 1}, //guam
{201, 251, 4, 5}, //marrentill
{203, 253, 5, 11}, //tarromin
{205, 255, 6, 20}, //harralander
{207, 257, 7, 25}, //ranarr
{3049, 2998, 8, 30}, //toadflax
{209, 259, 9, 40}, //irit
{211, 261, 10, 48}, //avantoe
{213, 263, 11, 54}, //kwaurm
{3000, 3051, 12, 59}, //snapdragon
{215, 265, 13, 65}, //Cadantine
{2485, 2481, 14, 67}, //Lantadyme
{217, 267, 15, 70}, //dwarf weed
{219, 269, 16, 75} //torstel
};
public static void cleanHerb(Player p) {
for (int[] data : HERB_DATA) {
int grimyHerb = data[0];
int cleanHerb = data[1];
int experience = data[2];
int levelReq = data[3];
if (!p.getInventory().contains(grimyHerb)) {
p.getActionSender().sendMessage("You do not have this herb in your inventory!");
return;
}
if (p.getSkills().getLevel(Skills.HERBLORE) < levelReq) {
p.getActionSender().sendMessage("You need an herblore level of atleast " + levelReq + " to clean this herb.");
return;
}
Item item = new Item(grimyHerb);
p.getInventory().deleteItem(grimyHerb, 1);
p.getInventory().addItem(cleanHerb, 1);
p.getSkills().addXp(15, experience);
p.getActionSender().sendMessage("You cleaned the dirt from the grimy " + item.getDefinition().getName().toLowerCase());
}
}
private static final int[][] POTION_DATA = {
//herbID, unf Potion, Second Ingre, finished Potion, EXP, lvl req
{249, 91, 221, 121, 25, 1}, //guam
{251, 93, 235, 175, 38, 5}, //marrentill
{253, 95, 225, 115, 50, 12}, //tarromin
{255, 97, 223, 127, 62, 22}, //harralander
{257, 99, 231, 139, 88, 38}, //ranarr
{259, 101, 221, 145, 100, 45}, //irit
{261, 103, 231, 151, 113, 50}, //avantoe
{263, 105, 225, 157, 125, 55}, //kwaurm
{3051, 3004, 223, 3026, 143, 63}, //snapdragon
{265, 107, 239, 163, 150, 66}, //Cadantine
{267, 109, 245, 169, 163, 72}, //dwarf weed
{2481, 2483, 3138, 3042, 173, 76}, //Lantadyme
{269, 111, 247, 189, 175, 78}, //torstel
{2998, 3002, 6693, 6687, 180, 81} //toadflax
};
public static boolean handlePotions(Player p, int itemUsed, int usedWith, int slot) {
for (int[] data : POTION_DATA) {
int herbId = data[0];
int unfPot = data[1];
int secondIngre = data[2];
int potionId = data[3];
int experience = data[4];
int levelReq = data[5];
if (itemUsed == herbId && usedWith == 227 || itemUsed == 227 && usedWith == herbId) {
if (p.getSkills().getLevel(Skills.HERBLORE) > levelReq) {
p.getActionSender().sendMessage("You need an Herblore level of at least " + levelReq + " to make this potion.");
return false;
}
if (!p.getInventory().contains(itemUsed) || !p.getInventory().contains(usedWith)) {
p.getActionSender().sendMessage("Noob hacker.");
return false;
}
makeUnfinishedPotion(p, herbId, unfPot);
return true;
}
if (itemUsed == unfPot && usedWith == secondIngre || itemUsed == secondIngre && usedWith == unfPot) {
if (p.getSkills().getLevel(Skills.HERBLORE) > 0) {
p.getActionSender().sendMessage("You need an Herblore level of at least " + levelReq + " to make this potion.");
return false;
}
if (!p.getInventory().contains(itemUsed) || !p.getInventory().contains(usedWith)) {
p.getActionSender().sendMessage("Noob hacker.");
return false;
}
makeFinishedPotion(p, unfPot, secondIngre, potionId, experience);
}
}
return false;
}
public static void makeUnfinishedPotion(final Player p, final int herbID, final int unfPot) {
final Item item = new Item(herbID, 1);
p.getInventory().deleteItem(herbID, 1);
p.getInventory().deleteItem(227, 1);
p.animate(363, 0);
p.setBusy(true);
p.getActionSender().sendMessage("You put the " + item.getDefinition().getName().toLowerCase() + " into the vial of water.");
World.getInstance().registerEvent(new Event(600) {
public void execute() {
p.getInventory().addItem(unfPot, 1);
this.stop();
}
});
}
public static void makeFinishedPotion(final Player p, final int unfPot, int second, final int potion, final int exp) {
final Item item = new Item(second);
p.getInventory().deleteItem(second, 1);
p.getInventory().deleteItem(unfPot, 1);
p.animate(363, 0);
p.setBusy(true);
p.getActionSender().sendMessage("You carefully mix the " + item.getDefinition().getName().toLowerCase() + " into your potion");
World.getInstance().registerEvent(new Event(600) {
public void execute() {
p.getInventory().addItem(potion, 1);
p.getSkills().addXp(15, exp);
this.stop();
}
});
}
}