Repository reorganisation
Unified kotlin and java into just src/main Unified the rs09 and core packages Took all content out of the core package, and placed it into the new content package Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the barbarian mixing plugin.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class BarbarianMixPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BarbarianMixPlugin} {@Code Object}.
|
||||
*/
|
||||
public BarbarianMixPlugin() {
|
||||
super(123, 177, 4846, 117, 129, 3012, 135, 3036, 9743, 141, 147, 183, 143, 3020, 10002, 159, 3028, 165, 2456, 171, 3044, 191);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(11324, ITEM_TYPE, this);
|
||||
addHandler(11326, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player == null) {
|
||||
return true;
|
||||
}
|
||||
final BarbarianPotion potion = BarbarianPotion.forId(((Item) event.getUsedWith()).getId());
|
||||
if (potion == null) {
|
||||
return true;
|
||||
}
|
||||
if (!potion.isBoth() && event.getUsedItem().getId() == 11324 || ((Item) event.getUsedWith()).getId() == 11324) {
|
||||
return true;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.HERBLORE) < potion.getLevel()) {
|
||||
player.getPacketDispatch().sendMessage("You need a herblore level of " + potion.getLevel() + " to make this mix.");
|
||||
return true;
|
||||
}
|
||||
if (potion.getItem() == event.getUsedItem().getId() || potion.getItem() == ((Item) event.getUsedWith()).getId()) {
|
||||
player.getInventory().remove(new Item(potion.getItem(), 1));
|
||||
player.getInventory().add(new Item(potion.getProduct(), 1));
|
||||
player.getSkills().addExperience(Skills.HERBLORE, potion.getExp(), true);
|
||||
if (potion.isBoth()) {
|
||||
player.getInventory().remove(new Item(11324, 1));
|
||||
}
|
||||
player.getInventory().remove(new Item(11326, 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
/**
|
||||
* Represents the barbarian potion.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum BarbarianPotion {
|
||||
ATTACK_POTION(123, 4, 11429, 8, true), ANTI_POISION_POTION(177, 6, 11433, 12, true), RELIC(4846, 9, 11437, 14, true), STRENGTH_POTION(117, 14, 11443, 17, true), RESTORE_POTION(129, 24, 11449, 21, true), ENERGY_POTION(3012, 29, 11453, 23, false), DEFENCE_POTION(135, 33, 11457, 25, false), AGILITY_POTION(3036, 37, 11461, 27, false), COMBAT_POTION(9743, 40, 11445, 28, false), PRAYER_POTION(141, 42, 11465, 29, false), SUPER_ATTACK_POTION(147, 47, 11469, 33, false), SUPER_ANTIPOISION_POTION(183, 51, 11473, 35, false), FISHING_POTION(143, 53, 11477, 38, false), SUPER_ENERGY_POTION(3020, 59, 11481, 42, false), HUNTER_POTION(10002, 11517, 58, 40, false), SUPER_STRENGTH_POTION(159, 59, 11485, 42, false), SUPER_RESTORE(3028, 67, 11493, 48, false), SUPER_DEFENCE_POTION(165, 71, 11497, 50, false), ANTIFIRE_POTION(2456, 11505, 75, 53, false), RANGING_POTION(171, 80, 11509, 54, false), MAGIC_POTION(3044, 83, 11513, 57, false), ZAMORAK_BREW(191, 85, 11521, 58, false);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BarbarianPotion} {@Code Object}.
|
||||
* @param item the item.
|
||||
* @param product the product.
|
||||
* @param exp the exp.
|
||||
* @param both if both can be added(roe, cavier).
|
||||
*/
|
||||
BarbarianPotion(int item, int level, int product, double exp, boolean both) {
|
||||
this.item = item;
|
||||
this.level = level;
|
||||
this.product = product;
|
||||
this.exp = exp;
|
||||
this.both = both;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item id.
|
||||
*/
|
||||
private int item;
|
||||
|
||||
/**
|
||||
* The product item id.
|
||||
*/
|
||||
private int product;
|
||||
|
||||
/**
|
||||
* The level required.
|
||||
*/
|
||||
private int level;
|
||||
|
||||
/**
|
||||
* the exp gained.
|
||||
*/
|
||||
private double exp;
|
||||
|
||||
/**
|
||||
* Represents if both <b>Roe</b> & <b>Cavier</b> can be added.
|
||||
*/
|
||||
private boolean both;
|
||||
|
||||
/**
|
||||
* Gets the item.
|
||||
* @return The item.
|
||||
*/
|
||||
public int getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product.
|
||||
* @return The product.
|
||||
*/
|
||||
public int getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exp.
|
||||
* @return The exp.
|
||||
*/
|
||||
public double getExp() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the both.
|
||||
* @return The both.
|
||||
*/
|
||||
public boolean isBoth() {
|
||||
return both;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value from the id.
|
||||
* @param id the id.
|
||||
* @return the value.
|
||||
*/
|
||||
public static BarbarianPotion forId(int id) {
|
||||
for (BarbarianPotion pot : BarbarianPotion.values()) {
|
||||
if (pot.getItem() == id) {
|
||||
return pot;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
/**
|
||||
* Represents a finished potion.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum FinishedPotion {
|
||||
ATTACK_POTION(UnfinishedPotion.GUAM, new Item(221), 3, 25, new Item(121)),
|
||||
ANTIPOISON_POTION(UnfinishedPotion.MARRENTILL, new Item(235), 5, 37.5, new Item(175)),
|
||||
STRENGTH_POTION(UnfinishedPotion.TARROMIN, new Item(225), 12, 50, new Item(115)),
|
||||
RESTORE_POTION(UnfinishedPotion.HARRALANDER, new Item(223), 22, 62.5, new Item(127)),
|
||||
ENERGY_POTION(UnfinishedPotion.HARRALANDER, new Item(1975), 26, 67.5, new Item(3010)),
|
||||
DEFENCE_POTION(UnfinishedPotion.RANARR, new Item(239), 30, 45, new Item(133)),
|
||||
AGILITY_POTION(UnfinishedPotion.TOADFLAX, new Item(2152), 34, 80, new Item(3034)),
|
||||
COMBAT_POTION(UnfinishedPotion.HARRALANDER, new Item(9736), 36, 84, new Item(9741)),
|
||||
PRAYER_POTION(UnfinishedPotion.RANARR, new Item(231), 38, 87.5, new Item(139)),
|
||||
SUMMONING_POTION(UnfinishedPotion.SPIRIT_WEED, new Item(12109), 40, 92, new Item(12142)),
|
||||
SUPER_ATTACK(UnfinishedPotion.IRIT, new Item(221), 45, 100, new Item(145)),
|
||||
SUPER_ANTIPOISON(UnfinishedPotion.IRIT, new Item(235), 48, 106.3, new Item(181)),
|
||||
FISHING_POTION(UnfinishedPotion.AVANTOE, new Item(231), 50, 112.5, new Item(151)),
|
||||
SUPER_ENERGY(UnfinishedPotion.AVANTOE, new Item(2970), 52, 117.5, new Item(3018)),
|
||||
HUNTING_POTION(UnfinishedPotion.AVANTOE, new Item(Items.KEBBIT_TEETH_DUST_10111), 53, 120, new Item(10000)),
|
||||
SUPER_STRENGTH(UnfinishedPotion.KWUARM, new Item(225), 55, 125, new Item(157)),
|
||||
WEAPON_POISON(UnfinishedPotion.KWUARM, new Item(241), 60, 137.5, new Item(187)),
|
||||
SUPER_RESTORE(UnfinishedPotion.SNAPDRAGON, new Item(223), 63, 142.5, new Item(3026)),
|
||||
SUPER_DEFENCE(UnfinishedPotion.CADANTINE, new Item(239), 66, 160, new Item(163)),
|
||||
ANTIFIRE(UnfinishedPotion.LANTADYME, new Item(241), 69, 157.5, new Item(2454)),
|
||||
SUPER_RANGING_POTION(UnfinishedPotion.DWARF_WEED, new Item(245), 72, 162.5, new Item(169)),
|
||||
SUPER_MAGIC(UnfinishedPotion.LANTADYME, new Item(3138), 76, 172.5, new Item(3042)),
|
||||
ZAMORAK_BREW(UnfinishedPotion.TORSTOL, new Item(247), 78, 175, new Item(189)),
|
||||
SARADOMIN_BREW(UnfinishedPotion.TOADFLAX, GrindingItem.BIRDS_NEST.getProduct(), 81, 180, new Item(6687)),
|
||||
STRONG_WEAPON_POISON(UnfinishedPotion.STRONG_WEAPON_POISON, new Item(223), 73, 165, new Item(5937)),
|
||||
SUPER_STRONG_WEAPON_POISON(UnfinishedPotion.SUPER_STRONG_WEAPON_POISON, new Item(6018), 82, 190, new Item(5940)),
|
||||
STRONG_ANTIPOISON(UnfinishedPotion.STRONG_ANTIPOISON, new Item(6049), 68, 155, new Item(5945)),
|
||||
SUPER_STRONG_ANTIPOISON(UnfinishedPotion.SUPER_STRONG_ANTIPOISON, new Item(6051), 79, 177.5, new Item(5954)),
|
||||
BLAMISH_OIL(UnfinishedPotion.HARRALANDER, new Item(1581), 25, 80, new Item(1582));
|
||||
|
||||
/**
|
||||
* Represents the unfinished potion.
|
||||
*/
|
||||
private final UnfinishedPotion unfinished;
|
||||
|
||||
/**
|
||||
* Represents the ingredient required.
|
||||
*/
|
||||
private final Item ingredient;
|
||||
|
||||
/**
|
||||
* Represents the level required.
|
||||
*/
|
||||
private final int level;
|
||||
|
||||
/**
|
||||
* Represents the experience gained.
|
||||
*/
|
||||
private final double experience;
|
||||
|
||||
/**
|
||||
* Represents the potion item.
|
||||
*/
|
||||
private final Item potion;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FinishedPotion} {@code Object}.
|
||||
* @param unfinished the unfinished potion base.
|
||||
* @param ingredient the ingredient.
|
||||
* @param level the level.
|
||||
* @param experience the experience.
|
||||
* @param potion the potion.
|
||||
*/
|
||||
FinishedPotion(final UnfinishedPotion unfinished, final Item ingredient, final int level, final double experience, final Item potion) {
|
||||
this.unfinished = unfinished;
|
||||
this.ingredient = ingredient;
|
||||
this.level = level;
|
||||
this.experience = experience;
|
||||
this.potion = potion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the unfinished.
|
||||
* @return The unfinished.
|
||||
*/
|
||||
public UnfinishedPotion getUnfinished() {
|
||||
return unfinished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ingredient.
|
||||
* @return The ingredient.
|
||||
*/
|
||||
public Item getIngredient() {
|
||||
return ingredient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the experience.
|
||||
* @return The experience.
|
||||
*/
|
||||
public double getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the potion.
|
||||
* @return The potion.
|
||||
*/
|
||||
public Item getPotion() {
|
||||
return potion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the finished potion by the unfinished potion and the ingredient.
|
||||
* @param unf the unf-potion.
|
||||
* @param ingredient the ingredient.
|
||||
* @return the finished potion.
|
||||
*/
|
||||
public static FinishedPotion getPotion(final Item unf, final Item ingredient) {
|
||||
for (FinishedPotion pot : values()) {
|
||||
if (pot.getUnfinished().getPotion().getId() == unf.getId() && pot.getIngredient().getId() == ingredient.getId()) {
|
||||
return pot;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.plugin.Initializable;
|
||||
import core.game.dialogue.SkillDialogueHandler;
|
||||
import core.game.dialogue.SkillDialogueHandler.SkillDialogue;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the finished potion plugin creating.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class FinishedPotionPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FinishedPotionPlugin} {@code Object}
|
||||
*/
|
||||
public FinishedPotionPlugin() {
|
||||
super(getUnfinishedItems());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (FinishedPotion potion : FinishedPotion.values()) {
|
||||
addHandler(potion.getIngredient().getId(), ITEM_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final FinishedPotion finished = FinishedPotion.getPotion(event.getUsedItem().getName().contains("(unf)") ? event.getUsedItem() : event.getBaseItem(), event.getUsedItem().getName().contains("(unf)") ? event.getBaseItem() : event.getUsedItem());
|
||||
if (finished == null) {
|
||||
return false;
|
||||
}
|
||||
final GenericPotion potion = GenericPotion.transform(finished);
|
||||
final Player player = event.getPlayer();
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, potion.getProduct()) {
|
||||
@Override
|
||||
public void create(final int amount, int index) {
|
||||
player.getPulseManager().run(new HerblorePulse(player, potion.getBase(), amount, potion));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAll(int index) {
|
||||
return player.getInventory().getAmount(potion.getBase());
|
||||
}
|
||||
|
||||
};
|
||||
if (player.getInventory().getAmount(potion.getBase()) == 1) {
|
||||
handler.create(0, 1);
|
||||
} else {
|
||||
handler.open();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to gather the unfinished item bases.
|
||||
* @return the ids.
|
||||
*/
|
||||
public static int[] getUnfinishedItems() {
|
||||
int[] ids = new int[UnfinishedPotion.values().length];
|
||||
int counter = 0;
|
||||
for (UnfinishedPotion potion : UnfinishedPotion.values()) {
|
||||
ids[counter] = potion.getPotion().getId();
|
||||
counter++;
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a generic potion which is used to transform incoming data to
|
||||
* represent a potion(finished or unfinished).
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public final class GenericPotion {
|
||||
|
||||
/**
|
||||
* Represents the base of the potion.
|
||||
*/
|
||||
private final Item base;
|
||||
|
||||
/**
|
||||
* Represents the ingredient.
|
||||
*/
|
||||
private final Item ingredient;
|
||||
|
||||
/**
|
||||
* Represents the level required.
|
||||
*/
|
||||
private final int level;
|
||||
|
||||
/**
|
||||
* Represents the experience gained.
|
||||
*/
|
||||
private final double experience;
|
||||
|
||||
/**
|
||||
* Represents the product item.
|
||||
*/
|
||||
private final Item product;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GenericPotion} {@code Object}.
|
||||
* @param base the base.
|
||||
* @param ingredient the ingredient.
|
||||
* @param level the level.
|
||||
* @param experience the experience.
|
||||
* @param product the product.
|
||||
*/
|
||||
public GenericPotion(final Item base, final Item ingredient, final int level, final double experience, final Item product) {
|
||||
this.base = base;
|
||||
this.ingredient = ingredient;
|
||||
this.level = level;
|
||||
this.experience = experience;
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to transform an unfinished potion into a generic potion.
|
||||
* @param potion the potion to transform.
|
||||
* @return the transformed potion.
|
||||
*/
|
||||
public static GenericPotion transform(final UnfinishedPotion potion) {
|
||||
return new GenericPotion(potion.getBase(), potion.getIngredient(), potion.getLevel(), 0, potion.getPotion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to transform a finished potion into a generic potion.
|
||||
* @param potion the potion to transform.
|
||||
* @return the transformed potion.
|
||||
*/
|
||||
public static GenericPotion transform(final FinishedPotion potion) {
|
||||
return new GenericPotion(potion.getUnfinished().getPotion(), potion.getIngredient(), potion.getLevel(), potion.getExperience(), potion.getPotion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base.
|
||||
* @return The base.
|
||||
*/
|
||||
public Item getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the experience.
|
||||
* @return The experience.
|
||||
*/
|
||||
public double getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product.
|
||||
* @return The product.
|
||||
*/
|
||||
public Item getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ingredient.
|
||||
* @return The ingredient.
|
||||
*/
|
||||
public Item getIngredient() {
|
||||
return ingredient;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package content.global.skill.herblore
|
||||
|
||||
import core.game.interaction.NodeUsageEvent
|
||||
import core.game.interaction.UseWithHandler
|
||||
import core.game.node.entity.skill.SkillPulse
|
||||
import content.global.skill.herblore.GrindingItem
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.net.packet.PacketRepository
|
||||
import core.net.packet.context.ChildPositionContext
|
||||
import core.net.packet.out.RepositionChild
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import core.game.dialogue.SkillDialogueHandler
|
||||
|
||||
/**
|
||||
* plugin used to handle the grinding of an item.
|
||||
* @author 'Ceikry
|
||||
*/
|
||||
@Initializable
|
||||
class GrindItemPlugin : UseWithHandler(233) {
|
||||
override fun newInstance(arg: Any?): Plugin<Any>? {
|
||||
for (grind in GrindingItem.values()) {
|
||||
for (i in grind.items) {
|
||||
addHandler(i.id, ITEM_TYPE, this)
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(event: NodeUsageEvent): Boolean {
|
||||
val grind = GrindingItem.forItem(if (event.usedItem.id == 233) event.baseItem else event.usedItem)
|
||||
val handler = object : SkillDialogueHandler(event.player,SkillDialogue.ONE_OPTION,grind.product){
|
||||
override fun create(amount: Int, index: Int) {
|
||||
player.pulseManager.run(object : SkillPulse<Item>(player,event.usedItem){
|
||||
var amt = 0
|
||||
init {
|
||||
amt = amount
|
||||
if(amt > player.inventory.getAmount(node)){
|
||||
amt = player.inventory.getAmount(node)
|
||||
}
|
||||
super.setDelay(2)
|
||||
}
|
||||
override fun checkRequirements(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun animate() {
|
||||
player.animator.animate(ANIMATION)
|
||||
}
|
||||
|
||||
override fun reward(): Boolean {
|
||||
if(player.inventory.remove(node)){
|
||||
player.inventory.add(GrindingItem.forItem(node).product)
|
||||
}
|
||||
amt--
|
||||
return amt <= 0
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
override fun getAll(index: Int): Int {
|
||||
return player.inventory.getAmount(event.usedItem)
|
||||
}
|
||||
}
|
||||
handler.open()
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(event.player, 309, 2, 210, 15))
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Represents the animation to use.
|
||||
*/
|
||||
private val ANIMATION = Animation(364)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents an item that will can be ground by pestle and mortar.
|
||||
* @author Vexia
|
||||
*/
|
||||
public enum GrindingItem {
|
||||
UNICORN_HORN(new Item[] { new Item(237) },new Item(235)),
|
||||
KEBBIT_TEETH(new Item[] { new Item(10109) }, new Item(10111)),
|
||||
BIRDS_NEST(new Item[] { new Item(5070), new Item(5071), new Item(5072), new Item(5073), new Item(5074), new Item(5075) }, new Item(6693)),
|
||||
GOAT_HORN(new Item[] { new Item(9735) }, new Item(9736)),
|
||||
MUD_RUNE(new Item[] { new Item(4698) }, new Item(9594)),
|
||||
ASHES(new Item[] { new Item(592) }, new Item(8865)),
|
||||
POISON_KARAMBWAN(new Item[] { new Item(3146) }, new Item(3152)),
|
||||
FISHING_BAIT(new Item[] { new Item(313) }, new Item(12129)),
|
||||
SEAWEED(new Item[] { new Item(401) }, new Item(6683)),
|
||||
BAT_BONES(new Item[] { new Item(530) }, new Item(2391)),
|
||||
CHARCOAL(new Item[] { new Item(973) }, new Item(704)),
|
||||
ASTRAL_RUNE_SHARDS(new Item[] { new Item(11156) }, new Item(11155)),
|
||||
GARLIC(new Item[] { new Item(1550) }, new Item(4668)),
|
||||
DRAGON_SCALE(new Item[] { new Item(243) }, new Item(241)),
|
||||
ANCHOVIES(new Item[] { new Item(319) }, new Item(11266)),
|
||||
CHOCOLATE_BAR(new Item[] {new Item(Items.CHOCOLATE_BAR_1973)}, new Item(Items.CHOCOLATE_DUST_1975)),
|
||||
GUAM_LEAF(new Item[] { new Item(Items.CLEAN_GUAM_249) }, new Item(Items.GROUND_GUAM_6681));
|
||||
|
||||
/**
|
||||
* Represents the item to grind.
|
||||
*/
|
||||
private final Item[] items;
|
||||
|
||||
/**
|
||||
* Represents the product item.
|
||||
*/
|
||||
private final Item product;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GrindingItem} {@code Object}.
|
||||
* @param items the items.
|
||||
* @param product the product.
|
||||
*/
|
||||
GrindingItem(final Item[] items, final Item product) {
|
||||
this.items = items;
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item.
|
||||
* @return The item.
|
||||
*/
|
||||
public Item[] getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product.
|
||||
* @return The product.
|
||||
*/
|
||||
public Item getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the grinding item.
|
||||
* @param item the item.
|
||||
* @return the item.
|
||||
*/
|
||||
public static GrindingItem forItem(final Item item) {
|
||||
for (GrindingItem g : values()) {
|
||||
for (Item i : g.getItems()) {
|
||||
if (i.getId() == item.getId()) {
|
||||
return g;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.api.Container;
|
||||
import static core.api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents the cleaning of a dirty herb.
|
||||
* @author Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class HerbCleanPlugin extends OptionHandler {
|
||||
private static final int[] SFX_IDS = new int[] { 5153, 5155, 5157 };
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.setOptionHandler("clean", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (!player.getQuestRepository().isComplete("Druidic Ritual")) {
|
||||
player.getPacketDispatch().sendMessage("You must complete the Druidic Ritual quest before you can use Herblore.");
|
||||
return true;
|
||||
}
|
||||
final Herbs herb = Herbs.forItem((Item) node);
|
||||
if (player.getSkills().getLevel(Skills.HERBLORE) < herb.getLevel()) {
|
||||
player.getPacketDispatch().sendMessage("You need level " + herb.getLevel() + " Herblore to clean the " + herb.getProduct().getName().replace("Clean", "Grimy") + ".");
|
||||
return true;
|
||||
}
|
||||
double exp = herb.getExperience();
|
||||
if (removeItem(player, node.asItem(), Container.INVENTORY)){
|
||||
player.getSkills().addExperience(Skills.HERBLORE, exp, true);
|
||||
addItem(player, herb.getProduct().getId(), 1, Container.INVENTORY);
|
||||
player.getAudioManager().send(SFX_IDS[RandomFunction.random(SFX_IDS.length)], 1);
|
||||
player.getPacketDispatch().sendMessage("You clean the dirt from the " + herb.getProduct().getName().toLowerCase().replace("clean", "").trim() + " leaf.");
|
||||
}
|
||||
player.lock(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWalk() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.net.packet.PacketRepository;
|
||||
import core.net.packet.context.ChildPositionContext;
|
||||
import core.net.packet.out.RepositionChild;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.game.dialogue.SkillDialogueHandler;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to create a herb tar.
|
||||
* @author Ceikry, fawk Vexia and his bad design.
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class HerbTarPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HerbTarPlugin} {@code Object}.
|
||||
*/
|
||||
public HerbTarPlugin() {
|
||||
super(1939);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (Tars tar : Tars.values()) {
|
||||
addHandler(tar.getIngredient().getId(), ITEM_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
//Tars.forItem(event.getUsedItem().getId() == 1939 ? event.getBaseItem() : event.getUsedItem())
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(event.getPlayer(), SkillDialogueHandler.SkillDialogue.ONE_OPTION,Tars.forItem(event.getUsedItem().getId() == 1939 ? event.getBaseItem() : event.getUsedItem()).getTar()){
|
||||
@Override
|
||||
public void create(int amount, int index) {
|
||||
event.getPlayer().getPulseManager().run(new HerbTarPulse(event.getPlayer(), null, Tars.forItem(event.getUsedItem().getId() == 1939 ? event.getBaseItem() : event.getUsedItem()), amount));
|
||||
}
|
||||
@Override
|
||||
public int getAll(int index) {
|
||||
return event.getPlayer().getInventory().getAmount(event.getUsedItem());
|
||||
}
|
||||
};
|
||||
handler.open();
|
||||
PacketRepository.send(RepositionChild.class, new ChildPositionContext(event.getPlayer(), 309, 2, 210, 15));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.node.entity.skill.SkillPulse;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
|
||||
/**
|
||||
* Represents the pulse used to create herb tars.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public final class HerbTarPulse extends SkillPulse<Item> {
|
||||
|
||||
/**
|
||||
* Represents the animation to use.
|
||||
*/
|
||||
private static final Animation ANIMATION = new Animation(364);
|
||||
|
||||
/**
|
||||
* Represents the pestle and mortar item.
|
||||
*/
|
||||
private static final Item PESTLE_AND_MORTAR = new Item(233);
|
||||
|
||||
/**
|
||||
* Represents the swamp tar item.
|
||||
*/
|
||||
private static final Item SWAMP_TAR = new Item(1939, 15);
|
||||
|
||||
/**
|
||||
* Represents the tar to make.
|
||||
*/
|
||||
private final Tars tar;
|
||||
|
||||
/**
|
||||
* Represents the amount to make.
|
||||
*/
|
||||
private int amount;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HerbTarPulse} {@code Object}.
|
||||
* @param player the player.
|
||||
* @param node the node.
|
||||
* @param tar the tar.
|
||||
* @param amount the amount.
|
||||
*/
|
||||
public HerbTarPulse(Player player, Item node, Tars tar, int amount) {
|
||||
super(player, node);
|
||||
this.tar = tar;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
if (!player.getQuestRepository().isComplete("Druidic Ritual")) {
|
||||
player.getPacketDispatch().sendMessage("You must complete the Druidic Ritual quest before you can use Herblore.");
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.HERBLORE) < tar.getLevel()) {
|
||||
player.getPacketDispatch().sendMessage("You need a Herblore level of at least " + tar.getLevel() + " in order to do this.");
|
||||
return false;
|
||||
}
|
||||
if (!player.getInventory().containsItem(PESTLE_AND_MORTAR)) {
|
||||
player.getPacketDispatch().sendMessage("You need Pestle and Mortar in order to crush the herb.");
|
||||
return false;
|
||||
}
|
||||
if (!player.getInventory().containsItem(SWAMP_TAR)) {
|
||||
player.getPacketDispatch().sendMessage("You need at least 15 swamp tar in order to do this.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animate() {
|
||||
player.animate(ANIMATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reward() {
|
||||
if (getDelay() == 1) {
|
||||
setDelay(4);
|
||||
return false;
|
||||
}
|
||||
if (player.getInventory().containsItem(SWAMP_TAR) && player.getInventory().containsItem(tar.getIngredient()) && player.getInventory().remove(SWAMP_TAR) && player.getInventory().remove(tar.getIngredient())) {
|
||||
final Item item = new Item(tar.getTar().getId(), 15);
|
||||
player.getInventory().add(item);
|
||||
player.getSkills().addExperience(Skills.HERBLORE, tar.getExperience(), true);
|
||||
player.getPacketDispatch().sendMessage("You add the " + tar.getIngredient().getName().toLowerCase().replace("clean", "").trim() + " to the swamp tar.");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
amount--;
|
||||
return amount == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void message(int type) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tar.
|
||||
* @return The tar.
|
||||
*/
|
||||
public Tars getTar() {
|
||||
return tar;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.node.entity.skill.SkillPulse;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.tools.StringUtils;
|
||||
|
||||
/**
|
||||
* Represents the skill pulse used to handle the creating of potions.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public final class HerblorePulse extends SkillPulse<Item> {
|
||||
|
||||
/**
|
||||
* Represents the vial of water item.
|
||||
*/
|
||||
public static final Item VIAL_OF_WATER = new Item(227);
|
||||
|
||||
/**
|
||||
* Represents the coonut milk item.
|
||||
*/
|
||||
public static final Item COCONUT_MILK = new Item(5935);
|
||||
|
||||
/**
|
||||
* Represents the animation to use when making a potion.
|
||||
*/
|
||||
private static final Animation ANIMATION = new Animation(363);
|
||||
|
||||
/**
|
||||
* Represents the generic potion.
|
||||
*/
|
||||
private final GenericPotion potion;
|
||||
|
||||
/**
|
||||
* Represents the amount to make.
|
||||
*/
|
||||
private int amount;
|
||||
|
||||
/**
|
||||
* Represents the initial amount to make.
|
||||
*/
|
||||
private int initialAmount;
|
||||
|
||||
/**
|
||||
* Represents the cycles.
|
||||
*/
|
||||
private int cycles;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HerblorePulse} {@code Object}.
|
||||
* @param player the player.
|
||||
* @param node the node.
|
||||
*/
|
||||
public HerblorePulse(final Player player, final Item node, final int amount, final GenericPotion potion) {
|
||||
super(player, node);
|
||||
this.amount = amount;
|
||||
this.initialAmount = amount;
|
||||
this.potion = potion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
if (!player.getQuestRepository().isComplete("Druidic Ritual")) {
|
||||
player.getPacketDispatch().sendMessage("You must complete the Druidic Ritual quest before you can use Herblore.");
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.HERBLORE) < potion.getLevel()) {
|
||||
player.getPacketDispatch().sendMessage("You need a Herblore level of at least " + potion.getLevel() + " in order to do this.");
|
||||
return false;
|
||||
}
|
||||
if (!player.getInventory().containsItem(potion.getBase()) || !player.getInventory().containsItem(potion.getIngredient())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reward() {
|
||||
if (potion.getBase().getId() == VIAL_OF_WATER.getId()) {
|
||||
if (initialAmount == 1 && getDelay() == 1) {
|
||||
player.animate(ANIMATION);
|
||||
setDelay(3);
|
||||
return false;
|
||||
}
|
||||
handleUnfinished();
|
||||
} else {
|
||||
if (initialAmount == 1 && getDelay() == 1) {
|
||||
player.animate(ANIMATION);
|
||||
setDelay(3);
|
||||
return false;
|
||||
}
|
||||
if (getDelay() == 1) {
|
||||
setDelay(3);
|
||||
player.animate(ANIMATION);
|
||||
return false;
|
||||
}
|
||||
handleFinished();
|
||||
}
|
||||
amount--;
|
||||
return amount == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to handle the potion making of an unf-potion.
|
||||
*/
|
||||
public void handleUnfinished() {
|
||||
if (cycles == 0) {
|
||||
player.animate(ANIMATION);
|
||||
}
|
||||
if ((player.getInventory().containsItem(potion.getBase()) && player.getInventory().containsItem(potion.getIngredient())) && player.getInventory().remove(potion.getBase(), potion.getIngredient())) {
|
||||
final Item item = potion.getProduct();
|
||||
player.getInventory().add(item);
|
||||
player.getPacketDispatch().sendMessage("You put the" + StringUtils.formatDisplayName(potion.getIngredient().getName().toLowerCase().replace("clean", "")) + " leaf into the vial of water.");
|
||||
player.getAudioManager().send(2608);
|
||||
if (cycles++ == 3) {
|
||||
player.animate(ANIMATION);
|
||||
cycles = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to handle the finished potion making.
|
||||
*/
|
||||
public void handleFinished() {
|
||||
if ((player.getInventory().containsItem(potion.getBase()) && player.getInventory().containsItem(potion.getIngredient())) && player.getInventory().remove(potion.getBase(), potion.getIngredient())) {
|
||||
final Item item = potion.getProduct();
|
||||
player.getInventory().add(item);
|
||||
player.getSkills().addExperience(Skills.HERBLORE, potion.getExperience(), true);
|
||||
player.getPacketDispatch().sendMessage("You mix the " + potion.getIngredient().getName().toLowerCase() + " into your potion.");
|
||||
player.getAudioManager().send(2608);
|
||||
player.animate(ANIMATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the enumeration of herbs to clean.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum Herbs {
|
||||
GUAM(new Item(199), 2.5, 3, new Item(249)), MARRENTILL(new Item(201), 3.8, 5, new Item(251)), TARROMIN(new Item(203), 5, 11, new Item(253)), HARRALANDER(new Item(205), 6.3, 20, new Item(255)), RANARR(new Item(207), 7.5, 25, new Item(257)), TOADFLAX(new Item(3049), 8, 30, new Item(2998)), SPIRIT_WEED(new Item(12174), 7.8, 35, new Item(12172)), IRIT(new Item(209), 8.8, 40, new Item(259)), AVANTOE(new Item(211), 10, 48, new Item(261)), KWUARM(new Item(213), 11.3, 54, new Item(263)), SNAPDRAGON(new Item(3051), 11.8, 59, new Item(3000)), CADANTINE(new Item(215), 12.5, 65, new Item(265)), LANTADYME(new Item(2485), 13.1, 67, new Item(2481)), DWARF_WEED(new Item(217), 13.8, 70, new Item(267)), TORSTOL(new Item(219), 15, 75, new Item(269)), SNAKE_WEED(new Item(1525), 2.5, 3, new Item(1526)), ARDRIGAL(new Item(1527), 2.5, 3, new Item(1528)), SITO_FOIL(new Item(1529), 2.5, 3, new Item(1530)), VOLENCIA_MOSS(new Item(1531), 2.5, 3, new Item(1532)), ROGUES_PUSE(new Item(1533), 2.5, 3, new Item(1534));
|
||||
|
||||
/**
|
||||
* Represents the herb item.
|
||||
*/
|
||||
private final Item herb;
|
||||
|
||||
/**
|
||||
* Represents the level required to clean this herb.
|
||||
*/
|
||||
private final int level;
|
||||
|
||||
/**
|
||||
* Represents the experience.
|
||||
*/
|
||||
private final double experience;
|
||||
|
||||
/**
|
||||
* Represents the product recieved from cleaning the herb.
|
||||
*/
|
||||
private final Item product;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code Herbs} {@code Object}.
|
||||
* @param herb the herb.
|
||||
* @param level the level.
|
||||
* @param experience the experience.
|
||||
* @param product the product.
|
||||
*/
|
||||
Herbs(final Item herb, final double experience, final int level, final Item product) {
|
||||
this.herb = herb;
|
||||
this.experience = experience;
|
||||
this.level = level;
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the herb.
|
||||
* @return The herb.
|
||||
*/
|
||||
public Item getHerb() {
|
||||
return herb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the experience.
|
||||
* @return The experience.
|
||||
*/
|
||||
public double getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product.
|
||||
* @return The product.
|
||||
*/
|
||||
public Item getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the herb from the item id.
|
||||
* @param item the item.
|
||||
* @return the herb.
|
||||
*/
|
||||
public static Herbs forItem(final Item item) {
|
||||
for (Herbs herb : Herbs.values()) {
|
||||
if (herb.getHerb().getId() == item.getId()) {
|
||||
return herb;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle the decanting of potions.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public final class PotionDecantingPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the empty item vial.
|
||||
*/
|
||||
private static final Item EMPTY_VIAL = new Item(229, 1);
|
||||
|
||||
/**
|
||||
* Represents the array of potions to utilitize.
|
||||
*/
|
||||
public static final int[] POTIONS = new int[] {
|
||||
/* empty vial */229,
|
||||
/* Strength potion(4) */113,
|
||||
/* Strength potion(3) */115,
|
||||
/* Strength potion(2) */117,
|
||||
/* Strength potion(1) */119,
|
||||
/* Attack potion(3) */121,
|
||||
/* Attack potion(2) */123,
|
||||
/* Attack potion(1) */125,
|
||||
/* Restore potion(3) */127,
|
||||
/* Restore potion(2) */129,
|
||||
/* Restore potion(1) */131,
|
||||
/* Defence potion(3) */133,
|
||||
/* Defence potion(2) */135,
|
||||
/* Defence potion(1) */137,
|
||||
/* Prayer potion(3) */139,
|
||||
/* Prayer potion(2) */141,
|
||||
/* Prayer potion(1) */143,
|
||||
/* Super attack(3) */145,
|
||||
/* Super attack(2) */147,
|
||||
/* Super attack(1) */149,
|
||||
/* Fishing potion(3) */151,
|
||||
/* Fishing potion(2) */153,
|
||||
/* Fishing potion(1) */155,
|
||||
/* Super strength(3) */157,
|
||||
/* Super strength(2) */159,
|
||||
/* Super strength(1) */161,
|
||||
/* Super defence(3) */163,
|
||||
/* Super defence(2) */165,
|
||||
/* Super defence(1) */167,
|
||||
/* Ranging potion(3) */169,
|
||||
/* Ranging potion(2) */171,
|
||||
/* Ranging potion(1) */173,
|
||||
/* Antipoison(3) */175,
|
||||
/* Antipoison(2) */177,
|
||||
/* Antipoison(1) */179,
|
||||
/* Super antipoison(3) */181,
|
||||
/* Super antipoison(2) */183,
|
||||
/* Super antipoison(1) */185,
|
||||
/* Bravery potion */739,
|
||||
/* Cadava potion */756,
|
||||
/* Magic ogre potion */2395,
|
||||
/* Attack potion(4) */2428,
|
||||
/* Restore potion(4) */2430,
|
||||
/* Defence potion(4) */2432,
|
||||
/* Prayer potion(4) */2434,
|
||||
/* Super attack(4) */2436,
|
||||
/* Fishing potion(4) */2438,
|
||||
/* Super strength(4) */2440,
|
||||
/* Super defence(4) */2442,
|
||||
/* Ranging potion(4) */2444,
|
||||
/* Antipoison(4) */2446,
|
||||
/* Super antipoison(4) */2448,
|
||||
/* Antifire potion(4) */2452,
|
||||
/* Antifire potion(3) */2454,
|
||||
/* Antifire potion(2) */2456,
|
||||
/* Antifire potion(1) */2458,
|
||||
/* Energy potion(4) */3008,
|
||||
/* Energy potion(3) */3010,
|
||||
/* Energy potion(2) */3012,
|
||||
/* Energy potion(1) */3014,
|
||||
/* Super energy(4) */3016,
|
||||
/* Super energy(3) */3018,
|
||||
/* Super energy(2) */3020,
|
||||
/* Super energy(1) */3022,
|
||||
/* Super restore(4) */3024,
|
||||
/* Super restore(3) */3026,
|
||||
/* Super restore(2) */3028,
|
||||
/* Super restore(1) */3030,
|
||||
/* Agility potion(4) */3032,
|
||||
/* Agility potion(3) */3034,
|
||||
/* Agility potion(2) */3036,
|
||||
/* Agility potion(1) */3038,
|
||||
/* Magic potion(4) */3040,
|
||||
/* Magic potion(3) */3042,
|
||||
/* Magic potion(2) */3044,
|
||||
/* Magic potion(1) */3046,
|
||||
/* Troll potion */3265,
|
||||
/* Explosive potion */4045,
|
||||
/* Super kebab */4608,
|
||||
/* Strange potion */4836,
|
||||
/* Antipoison+(4) */5943,
|
||||
/* Antipoison+(3) */5945,
|
||||
/* Antipoison+(2) */5947,
|
||||
/* Antipoison+(1) */5949,
|
||||
/* Antipoison++(4) */5952,
|
||||
/* Antipoison++(3) */5954,
|
||||
/* Antipoison++(2) */5956,
|
||||
/* Antipoison++(1) */5958,
|
||||
/* Supercompost */6034,
|
||||
/* Compost potion(4) */6470,
|
||||
/* Compost potion(3) */6472,
|
||||
/* Compost potion(2) */6474,
|
||||
/* Compost potion(1) */6476,
|
||||
/* Combat potion(4) */9739,
|
||||
/* Combat potion(3) */9741,
|
||||
/* Combat potion(2) */9743,
|
||||
/* Combat potion(1) */9745,
|
||||
/* Hunter potion(4) */9998,
|
||||
/* Hunter potion(3) */10000,
|
||||
/* Hunter potion(2) */10002,
|
||||
/* Hunter potion(1) */10004,
|
||||
/* Antipoison mix(2) */11433,
|
||||
/* Antipoison mix(1) */11435,
|
||||
/* Superattack mix(2) */11469,
|
||||
/* Superattack mix(1) */11471,
|
||||
/* Antifire mix(2) */11505,
|
||||
/* Antifire mix(1) */11507,
|
||||
/* Goblin potion (4) */11809,
|
||||
/* Goblin potion (3) */11810,
|
||||
/* Goblin potion (2) */11811,
|
||||
/* Goblin potion (1) */11812,
|
||||
/* Summoning potion(4) */12140,
|
||||
/* Summoning potion(3) */12142,
|
||||
/* Summoning potion(2) */12144,
|
||||
/* Summoning potion(1) */12146,
|
||||
/* Saradomin brews */ 6685, 6687, 6689, 6691,
|
||||
/* Zamorak brews*/ 2450, 189, 191, 193,
|
||||
/* Extended antifire potions*/ 14753, 14755, 14757, 14759,
|
||||
/* Super ranging */ 14776, 14777, 14778, 14779,
|
||||
/* Super magic */ 14780, 14781, 14782, 14783,
|
||||
/* Overloads */ 14784, 14785, 14786, 14787,
|
||||
/*Super Combat Pots */ 14871, 14869, 14867, 14865};
|
||||
|
||||
/**
|
||||
* Constructs a new {@code PotionDecantingPlugin} {@code Object}.
|
||||
*/
|
||||
public PotionDecantingPlugin() {
|
||||
super(POTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (int i : POTIONS) {
|
||||
addHandler(i, ITEM_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final Item item = event.getUsedItem();
|
||||
final Item other = event.getBaseItem();
|
||||
final String itemName = formatName(item);
|
||||
final String otherName = formatName(other);
|
||||
if (!itemName.equals(otherName) && (item.getId() != 229 && other.getId() != 229)) {
|
||||
return false;
|
||||
}
|
||||
final int itemDose = getPotionDose(item);
|
||||
final int otherDose = getPotionDose(other);
|
||||
if (flagged(itemDose, otherDose)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.getId() == item.getNoteChange() || other.getId() == item.getNoteChange()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final int[] newDoses = getDoses(itemDose, otherDose);
|
||||
if (itemDose == 4 && otherDose == 0 || otherDose == 4 && itemDose == 0) {
|
||||
player.getInventory().replace(getItem(item.getName().contains("Vial") ? otherName : itemName, newDoses[1]), item.getSlot());
|
||||
player.getInventory().replace(getItem(item.getName().contains("Vial") ? otherName : itemName, newDoses[1]), other.getSlot());
|
||||
player.getPacketDispatch().sendMessage("You decant the potion into two equal parts.");
|
||||
} else {
|
||||
player.getInventory().replace(getItem(item.getName().contains("Vial") ? otherName : itemName, newDoses[0]), other.getSlot());
|
||||
player.getInventory().replace(getItem(item.getName().contains("Vial") ? otherName : itemName, newDoses[1]), item.getSlot());
|
||||
player.getPacketDispatch().sendMessage("You have combined the liquid into " + (newDoses[0] == 0 ? newDoses[1] : newDoses[0]) + " doses.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decants all the potions in a players inventory.
|
||||
* @param player The player
|
||||
*/
|
||||
public static void decant(Player player) {
|
||||
Map<String, Integer> potions = new HashMap<>();
|
||||
|
||||
int totalVials = 0;
|
||||
int newVials = 0;
|
||||
int vialsToGive;
|
||||
|
||||
for (Item item : player.getInventory().toArray()) {
|
||||
if (item != null) {
|
||||
if (getPotionDose(item) > 0 && isPot(item.getId())) {
|
||||
String itemName = formatName(item);
|
||||
item.setAmount(item.getAmount());
|
||||
totalVials += item.getAmount();
|
||||
if (player.getInventory().remove(item)) {
|
||||
if (potions.get(itemName) != null) {
|
||||
potions.put(itemName, potions.get(itemName) + (item.getAmount() * getPotionDose(item)));
|
||||
} else {
|
||||
potions.put(itemName, item.getAmount() * getPotionDose(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Integer> entry : potions.entrySet()) {
|
||||
int amount = entry.getValue() / 4;
|
||||
int excess = entry.getValue() % 4;
|
||||
newVials += amount + (excess > 0 ? 1 : 0);
|
||||
Item fourDose = getItem(entry.getKey(), 4);
|
||||
player.getInventory().add(new Item(fourDose.getId() + 1, amount), player);
|
||||
if (excess > 0) {
|
||||
player.getInventory().add(new Item(getItem(entry.getKey(), excess).getId() + 1), player);
|
||||
}
|
||||
}
|
||||
|
||||
vialsToGive = totalVials - newVials;
|
||||
|
||||
if (vialsToGive > 0) {
|
||||
player.getInventory().add(new Item(EMPTY_VIAL.getId() + 1, vialsToGive), player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to format a name of a potion.
|
||||
* @param item the item.
|
||||
* @return the name.
|
||||
*/
|
||||
public static String formatName(final Item item) {
|
||||
return item.getName().replace("(1)", "").replace("(2)", "").replace("(3)", "").replace("(4)", "").trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to get the potion does between two potions.
|
||||
* @param item the item.
|
||||
* @return the doses.
|
||||
*/
|
||||
public static int getPotionDose(final Item item) {
|
||||
return item.getName().contains("(1)") ? 1 : item.getName().contains("(2)") ? 2 : item.getName().contains("(3)") ? 3 : item.getName().contains("(4)") ? 4 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to check if a new potion ca be created based on the doses.
|
||||
* @param itemDose the item dose.
|
||||
* @param otherDose the other dose.
|
||||
* @return <code>True</code> if flagged.
|
||||
*/
|
||||
public boolean flagged(final int itemDose, final int otherDose) {
|
||||
return (itemDose == 4 && otherDose != 0 || itemDose != 4 && otherDose == 0 || itemDose == 4 && otherDose == 3 || itemDose == 0 && otherDose != 4) || (otherDose == 4 && itemDose != 0 || otherDose != 4 && itemDose == 0 || otherDose == 4 && itemDose == 3 || otherDose == 0 && itemDose != 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to return the doses of the new items.
|
||||
* @param itemDose the item dose.
|
||||
* @param otherDose the other dose.
|
||||
* @return the new doses.
|
||||
*/
|
||||
public int[] getDoses(final int itemDose, final int otherDose) {
|
||||
return itemDose == 1 && otherDose == 1 ? new int[] { 2, 0 } : itemDose == 3 && otherDose == 3 ? new int[] { 4, 2 } : itemDose == 2 && otherDose == 2 ? new int[] { 4, 0 } : itemDose == 2 && otherDose == 3 ? new int[] { 4, 1 } : itemDose == 1 && otherDose == 2 ? new int[] { 0, 3 } : itemDose == 4 && otherDose == 0 ? new int[] { 2, 2 } : itemDose == 1 && otherDose == 3 ? new int[] { 0, 4 } : otherDose == 2 && itemDose == 3 ? new int[] { 1, 4 } : otherDose == 1 && itemDose == 2 ? new int[] { 0, 3 } : otherDose == 4 && itemDose == 0 ? new int[] { 2, 2 } : otherDose == 1 && itemDose == 3 ? new int[] { 0, 4 } : itemDose == 0 && otherDose == 4 ? new int[] { 2, 2 } : otherDose == 4 && itemDose == 0 ? new int[] { 2, 2 } : new int[] { 0, 0 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to get the new item.
|
||||
* @param name the name.
|
||||
* @param dose the dose of the new item.
|
||||
* @return the new item.
|
||||
*/
|
||||
public static Item getItem(String name, int dose) {
|
||||
ItemDefinition def = null;
|
||||
name += (oldSchool(name) ? " " : "")+"(" + dose + ")";
|
||||
if (dose == 0) {
|
||||
return EMPTY_VIAL;
|
||||
}
|
||||
for (int id : POTIONS) {
|
||||
def = ItemDefinition.forId(id);
|
||||
if (def.getName().equals(name)) {
|
||||
return new Item(id);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an item is a pot.
|
||||
* @param itemId The item id.
|
||||
* @return true if so.
|
||||
*/
|
||||
public static boolean isPot(int itemId) {
|
||||
for (int i : POTIONS) {
|
||||
if (itemId == i || itemId == (i + 1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* If an item is oldschool... add an extra space.
|
||||
* @param name
|
||||
* @return
|
||||
* @author Jagex
|
||||
*/
|
||||
private static boolean oldSchool(String name){
|
||||
if(name.contains("xtended") || name.contains("uper rangin") || name.contains("uper magic") || name.contains("verload")){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the swamp toad plugin.
|
||||
* @author Zombiemode
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class SwampToadPlugin extends OptionHandler {
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.setOptionHandler("remove-legs", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (player.getInventory().replace(new Item(2152), ((Item) node).getSlot()) != null) {
|
||||
player.getPacketDispatch().sendMessage("You pull the legs off the toad. Poor toad. At least they'll grow back.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWalk() { return false; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a tar to create.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum Tars {
|
||||
GUAM_TAR(Herbs.GUAM.getProduct(), 19, 30, new Item(10142)), MARRENTILL_TAR(Herbs.MARRENTILL.getProduct(), 31, 42.5, new Item(10143)), TARROMIN_TAR(Herbs.TARROMIN.getProduct(), 39, 55, new Item(10144)), HARRALANDER_TAR(Herbs.HARRALANDER.getProduct(), 44, 72.5, new Item(10145));
|
||||
|
||||
/**
|
||||
* Represents the ingredient.
|
||||
*/
|
||||
private final Item ingredient;
|
||||
|
||||
/**
|
||||
* Represents the level required.
|
||||
*/
|
||||
private final int level;
|
||||
|
||||
/**
|
||||
* Represents the experience gained.
|
||||
*/
|
||||
private final double experience;
|
||||
|
||||
/**
|
||||
* Represents the tar item.
|
||||
*/
|
||||
private final Item tar;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code Tars} {@code Object}.
|
||||
* @param ingredient the ingredient.
|
||||
* @param level the level.
|
||||
* @param experience the experience.
|
||||
* @param tar the tar.
|
||||
*/
|
||||
Tars(Item ingredient, int level, double experience, Item tar) {
|
||||
this.ingredient = ingredient;
|
||||
this.level = level;
|
||||
this.experience = experience;
|
||||
this.tar = tar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ingredient.
|
||||
* @return The ingredient.
|
||||
*/
|
||||
public Item getIngredient() {
|
||||
return ingredient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the experience.
|
||||
* @return The experience.
|
||||
*/
|
||||
public double getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tar.
|
||||
* @return The tar.
|
||||
*/
|
||||
public Item getTar() {
|
||||
return tar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tar.
|
||||
* @param item the item.
|
||||
* @return the tar.
|
||||
*/
|
||||
public static Tars forItem(final Item item) {
|
||||
for (Tars tar : Tars.values()) {
|
||||
if (tar.getIngredient().getId() == item.getId()) {
|
||||
return tar;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents an unfinished potion to make.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum UnfinishedPotion {
|
||||
GUAM(Herbs.GUAM.getProduct(), 3, new Item(91)),
|
||||
MARRENTILL(Herbs.MARRENTILL.getProduct(), 5, new Item(93)),
|
||||
TARROMIN(Herbs.TARROMIN.getProduct(), 12, new Item(95)),
|
||||
HARRALANDER(Herbs.HARRALANDER.getProduct(), 22, new Item(97)),
|
||||
RANARR(Herbs.RANARR.getProduct(), 30, new Item(99)),
|
||||
TOADFLAX(Herbs.TOADFLAX.getProduct(), 34, new Item(3002)),
|
||||
SPIRIT_WEED(Herbs.SPIRIT_WEED.getProduct(), 40, new Item(12181)),
|
||||
IRIT(Herbs.IRIT.getProduct(), 45, new Item(101)),
|
||||
AVANTOE(Herbs.AVANTOE.getProduct(), 50, new Item(103)),
|
||||
KWUARM(Herbs.KWUARM.getProduct(), 55, new Item(105)),
|
||||
SNAPDRAGON(Herbs.SNAPDRAGON.getProduct(), 63, new Item(3004)),
|
||||
CADANTINE(Herbs.CADANTINE.getProduct(), 66, new Item(107)),
|
||||
LANTADYME(Herbs.LANTADYME.getProduct(), 69, new Item(2483)),
|
||||
DWARF_WEED(Herbs.DWARF_WEED.getProduct(), 72, new Item(109)),
|
||||
TORSTOL(Herbs.TORSTOL.getProduct(), 75, new Item(111)),
|
||||
STRONG_WEAPON_POISON(HerblorePulse.COCONUT_MILK, new Item(6016), 73, new Item(5936)),
|
||||
SUPER_STRONG_WEAPON_POISON(HerblorePulse.COCONUT_MILK, new Item(2398), 82, new Item(5939)),
|
||||
STRONG_ANTIPOISON(HerblorePulse.COCONUT_MILK, Herbs.TOADFLAX.getProduct(), 68, new Item(5942)),
|
||||
SUPER_STRONG_ANTIPOISON(HerblorePulse.COCONUT_MILK, Herbs.IRIT.getProduct(), 79, new Item(5951));
|
||||
|
||||
/**
|
||||
* Represents the base item.
|
||||
*/
|
||||
private final Item base;
|
||||
|
||||
/**
|
||||
* Represents the ingredient needed to make this unf-potion.
|
||||
*/
|
||||
private final Item ingredient;
|
||||
|
||||
/**
|
||||
* Represents the level required to make this unf-potion.
|
||||
*/
|
||||
private final int level;
|
||||
|
||||
/**
|
||||
* Represents the potion product.
|
||||
*/
|
||||
private final Item potion;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code UnfinishedPotion} {@code Object}.
|
||||
* @param ingredient the ingredient.
|
||||
* @param level the level.
|
||||
* @param potion the potion.
|
||||
*/
|
||||
UnfinishedPotion(final Item base, final Item ingredient, final int level, final Item potion) {
|
||||
this.base = base;
|
||||
this.ingredient = ingredient;
|
||||
this.level = level;
|
||||
this.potion = potion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code UnfinishedPotion} {@code Object}.
|
||||
* @param ingredient the ingredient.
|
||||
* @param level the level.
|
||||
* @param potion the potion.
|
||||
*/
|
||||
UnfinishedPotion(final Item ingredient, final int level, final Item potion) {
|
||||
this(HerblorePulse.VIAL_OF_WATER, ingredient, level, potion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ingredient.
|
||||
* @return The ingredient.
|
||||
*/
|
||||
public Item getIngredient() {
|
||||
return ingredient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the potion.
|
||||
* @return The potion.
|
||||
*/
|
||||
public Item getPotion() {
|
||||
return potion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base.
|
||||
* @return The base.
|
||||
*/
|
||||
public Item getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the unf-potion.
|
||||
* @param item the item.
|
||||
* @paramt the base item.
|
||||
* @return the unf-potion.
|
||||
*/
|
||||
public static UnfinishedPotion forItem(final Item item, final Item base) {
|
||||
for (UnfinishedPotion potion : values()) {
|
||||
if ((potion.getIngredient().getId() == item.getId() || potion.getIngredient().getId() == base.getId()) && (item.getId() == potion.getBase().getId() || base.getId() == potion.getBase().getId())) {
|
||||
return potion;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package content.global.skill.herblore;
|
||||
|
||||
import core.plugin.Initializable;
|
||||
import core.game.dialogue.SkillDialogueHandler;
|
||||
import core.game.dialogue.SkillDialogueHandler.SkillDialogue;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle the creation of creation an unf-potion.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public final class UnfinishedPotionPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code UnfinishedPotionPlugin} {@code Object}.
|
||||
*/
|
||||
public UnfinishedPotionPlugin() {
|
||||
super(227, 5935);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (UnfinishedPotion potion : UnfinishedPotion.values()) {
|
||||
addHandler(potion.getIngredient().getId(), ITEM_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final UnfinishedPotion unf = UnfinishedPotion.forItem(event.getUsedItem(), event.getBaseItem());
|
||||
if (unf == null) {
|
||||
return false;
|
||||
}
|
||||
final GenericPotion potion = GenericPotion.transform(unf);
|
||||
final Player player = event.getPlayer();
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, potion.getProduct()) {
|
||||
@Override
|
||||
public void create(final int amount, int index) {
|
||||
player.getPulseManager().run(new HerblorePulse(player, potion.getBase(), amount, potion));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAll(int index) {
|
||||
return player.getInventory().getAmount(potion.getBase());
|
||||
}
|
||||
|
||||
};
|
||||
if (player.getInventory().getAmount(potion.getBase()) == 1) {
|
||||
handler.create(0, 1);
|
||||
} else {
|
||||
handler.open();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user