mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-12 17:40:17 -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
|
@Override
|
||||||
public boolean handle(int interfaceId, int buttonId) {
|
public boolean handle(int interfaceId, int buttonId) {
|
||||||
end();
|
|
||||||
int amt = 0;
|
int amt = 0;
|
||||||
|
// ButtonId 5=1x, 4=5x, 3=MakeX, 2=All
|
||||||
switch (buttonId) {
|
switch (buttonId) {
|
||||||
case 6:
|
case 5:
|
||||||
amt = 1;
|
amt = 1;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 4:
|
||||||
amt = 5;
|
amt = 5;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 3:
|
||||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
end()
|
||||||
player.getPulseManager().run(new EnchantTiaraPulse(player, event.getUsedItem(), Talisman.forItem(event.getUsedItem()).getTiara(), (int) value));
|
; 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 Unit.INSTANCE;
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
case 3:
|
case 2:
|
||||||
amt = player.getInventory().getAmount(event.getUsedItem());
|
amt = player.getInventory().getAmount(event.getUsedItem());
|
||||||
break;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package content.global.skill.runecrafting;
|
||||||
|
|
||||||
import core.game.node.entity.impl.Animator;
|
import core.game.node.entity.impl.Animator;
|
||||||
import core.game.node.entity.player.link.diary.DiaryType;
|
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.Animation;
|
||||||
import core.game.world.update.flag.context.Graphics;
|
import core.game.world.update.flag.context.Graphics;
|
||||||
import core.game.node.entity.skill.SkillPulse;
|
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.entity.player.Player;
|
||||||
import core.game.node.item.Item;
|
import core.game.node.item.Item;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static java.lang.Math.min;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the enchanting of a tiara pulse.
|
* Represents the enchanting of a tiara pulse.
|
||||||
* @author 'Vexia
|
* @author 'Vexia
|
||||||
* @date 02/11/2013
|
|
||||||
*/
|
*/
|
||||||
public class EnchantTiaraPulse extends SkillPulse<Item> {
|
public class EnchantTiaraPulse extends SkillPulse<Item> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the Altar.
|
||||||
|
*/
|
||||||
|
private final Altar altar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the tiara.
|
* Represents the tiara.
|
||||||
*/
|
*/
|
||||||
|
|
@ -39,22 +48,25 @@ public class EnchantTiaraPulse extends SkillPulse<Item> {
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @param node the node.
|
* @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);
|
super(player, node);
|
||||||
this.tiara = tiara;
|
this.tiara = tiara;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
|
this.altar = altar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
super.start();
|
super.start();
|
||||||
int tiaraAmt = player.getInventory().getAmount(TIARA);
|
int tiaraAmt = player.getInventory().getAmount(TIARA); // Plain Silver Tiara
|
||||||
int talsminAmt = player.getInventory().getAmount(node);
|
int talismanAmt = player.getInventory().getAmount(tiara.getTalisman().getTalisman()); // specific talisman being fused, "node" is all various talismans in inventory
|
||||||
if (tiaraAmt > talsminAmt) {
|
String talismanType = tiara.getTalisman().getTalisman().getName().toLowerCase();
|
||||||
amount = talsminAmt;
|
String altarType = altar.getRuin().name().toLowerCase();
|
||||||
} else {
|
// Check that the talisman type and the alter type match
|
||||||
amount = tiaraAmt;
|
if ( talismanType.contains(altarType) ){
|
||||||
|
amount = min(talismanAmt, min(tiaraAmt, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue