mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Enchanting tiaras no longer removes incorrect items from the player's inventory
Talisman type is now checked correctly when enchanting tiaras
This commit is contained in:
parent
8bad573568
commit
7600ac8b49
2 changed files with 30 additions and 16 deletions
|
|
@ -65,26 +65,28 @@ public final class EnchantTiaraDialogue extends DialoguePlugin {
|
|||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
end();
|
||||
int amt = 0;
|
||||
// ButtonId 5=1x, 4=5x, 3=MakeX, 2=All
|
||||
switch (buttonId) {
|
||||
case 6:
|
||||
case 5:
|
||||
amt = 1;
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
amt = 5;
|
||||
break;
|
||||
case 4:
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
player.getPulseManager().run(new EnchantTiaraPulse(player, event.getUsedItem(), Talisman.forItem(event.getUsedItem()).getTiara(), (int) value));
|
||||
case 3:
|
||||
end()
|
||||
; sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
player.getPulseManager().run(new EnchantTiaraPulse(player, event.getUsedItem(), altar ,Talisman.forItem(event.getUsedItem()).getTiara(), (int) value));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
return true;
|
||||
case 3:
|
||||
case 2:
|
||||
amt = player.getInventory().getAmount(event.getUsedItem());
|
||||
break;
|
||||
}
|
||||
player.getPulseManager().run(new EnchantTiaraPulse(player, event.getUsedItem(), altar.getTiara(), amt));
|
||||
player.getPulseManager().run(new EnchantTiaraPulse(player, event.getUsedItem(), altar ,altar.getTiara(), amt));
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package content.global.skill.runecrafting;
|
|||
|
||||
import core.game.node.entity.impl.Animator;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.game.node.entity.skill.SkillPulse;
|
||||
|
|
@ -9,13 +10,21 @@ import core.game.node.entity.skill.Skills;
|
|||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static java.lang.Math.min;
|
||||
|
||||
/**
|
||||
* Represents the enchanting of a tiara pulse.
|
||||
* @author 'Vexia
|
||||
* @date 02/11/2013
|
||||
*/
|
||||
public class EnchantTiaraPulse extends SkillPulse<Item> {
|
||||
|
||||
/**
|
||||
* Represents the Altar.
|
||||
*/
|
||||
private final Altar altar;
|
||||
|
||||
/**
|
||||
* Represents the tiara.
|
||||
*/
|
||||
|
|
@ -39,22 +48,25 @@ public class EnchantTiaraPulse extends SkillPulse<Item> {
|
|||
* @param player the player.
|
||||
* @param node the node.
|
||||
*/
|
||||
public EnchantTiaraPulse(Player player, Item node, final Tiara tiara, final int amount) {
|
||||
public EnchantTiaraPulse(Player player, Item node, final Altar altar, final Tiara tiara, final int amount) {
|
||||
super(player, node);
|
||||
this.tiara = tiara;
|
||||
this.amount = amount;
|
||||
this.altar = altar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
super.start();
|
||||
int tiaraAmt = player.getInventory().getAmount(TIARA);
|
||||
int talsminAmt = player.getInventory().getAmount(node);
|
||||
if (tiaraAmt > talsminAmt) {
|
||||
amount = talsminAmt;
|
||||
} else {
|
||||
amount = tiaraAmt;
|
||||
int tiaraAmt = player.getInventory().getAmount(TIARA); // Plain Silver Tiara
|
||||
int talismanAmt = player.getInventory().getAmount(tiara.getTalisman().getTalisman()); // specific talisman being fused, "node" is all various talismans in inventory
|
||||
String talismanType = tiara.getTalisman().getTalisman().getName().toLowerCase();
|
||||
String altarType = altar.getRuin().name().toLowerCase();
|
||||
// Check that the talisman type and the alter type match
|
||||
if ( talismanType.contains(altarType) ){
|
||||
amount = min(talismanAmt, min(tiaraAmt, amount));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue