mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Fix decanting 4-dose super {attack, strength, defense} into 2-dose potions.
This commit is contained in:
parent
456a45f9d3
commit
f7f8ed6775
2 changed files with 0 additions and 161 deletions
|
|
@ -1,73 +0,0 @@
|
||||||
package core.game.node.entity.skill.herblore;
|
|
||||||
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import rs09.game.content.dialogue.SkillDialogueHandler;
|
|
||||||
import rs09.game.content.dialogue.SkillDialogueHandler.SkillDialogue;
|
|
||||||
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.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The plugin that creates the Super Combat potion.
|
|
||||||
* @author Empathy
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public class MakeSuperCombatPotionPlugin extends UseWithHandler {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ingredients.
|
|
||||||
*/
|
|
||||||
private static final int[] INGREDIENTS = new int[] { 2436, 2442, 2440 };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base.
|
|
||||||
*/
|
|
||||||
private static final Item BASE = new Item(2436);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The product.
|
|
||||||
*/
|
|
||||||
private static final Item PRODUCT = new Item(14871);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new @{Code MakeSuperCombatPotionPlugin} object.
|
|
||||||
*/
|
|
||||||
public MakeSuperCombatPotionPlugin() {
|
|
||||||
super(269, 2436, 2442, 2440);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
for (int i : INGREDIENTS) {
|
|
||||||
addHandler(i, ITEM_TYPE, this);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(NodeUsageEvent event) {
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, PRODUCT) {
|
|
||||||
@Override
|
|
||||||
public void create(final int amount, int index) {
|
|
||||||
player.getPulseManager().run(new SuperCombatPulse(player, BASE, amount));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getAll(int index) {
|
|
||||||
return player.getInventory().getAmount(BASE);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
if (player.getInventory().getAmount(BASE) == 1) {
|
|
||||||
handler.create(0, 1);
|
|
||||||
} else {
|
|
||||||
handler.open();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
package core.game.node.entity.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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the creation of a super combat potion.
|
|
||||||
* @author Empathy
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SuperCombatPulse extends SkillPulse<Item> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ingredients.
|
|
||||||
*/
|
|
||||||
private static final int[] INGREDIENTS = new int[] { 2436, 2442, 2440, 269 };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The product item.
|
|
||||||
*/
|
|
||||||
private static final Item PRODUCT = new Item(14871);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The vial id.
|
|
||||||
*/
|
|
||||||
private static final Item VIAL = new Item(229);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the animation to use when making a potion.
|
|
||||||
*/
|
|
||||||
private static final Animation ANIMATION = new Animation(363);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the amount to make.
|
|
||||||
*/
|
|
||||||
private int amount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code SuperCombatPulse} object.
|
|
||||||
* @param player the player.
|
|
||||||
* @param node the node.
|
|
||||||
* @param amount the amount.
|
|
||||||
*/
|
|
||||||
public SuperCombatPulse(final Player player, final Item node, int amount) {
|
|
||||||
super(player, node);
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkRequirements() {
|
|
||||||
if (player.getSkills().getStaticLevel(Skills.HERBLORE) < 90) {
|
|
||||||
player.sendMessage("You need a Herblore level of at least 90 in order to do this");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!player.getInventory().containsAll(INGREDIENTS)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void animate() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean reward() {
|
|
||||||
if (getDelay() == 1) {
|
|
||||||
setDelay(2);
|
|
||||||
}
|
|
||||||
if (player.getInventory().containsAll(INGREDIENTS)) {
|
|
||||||
if (player.getInventory().remove(new Item(INGREDIENTS[0]), new Item(INGREDIENTS[1]), new Item(INGREDIENTS[2]), new Item(INGREDIENTS[3]))) {
|
|
||||||
VIAL.setAmount(2);
|
|
||||||
player.getSkills().addExperience(Skills.HERBLORE, 150);
|
|
||||||
player.animate(ANIMATION);
|
|
||||||
player.getInventory().add(PRODUCT);
|
|
||||||
player.getInventory().add(VIAL);
|
|
||||||
VIAL.setAmount(1);
|
|
||||||
amount--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return amount == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue