Fixed issue where eating/firemaking/decanting replaced item from incorrect inventory slot

Corrected potion decanting and bank pin interface sounds
This commit is contained in:
Woahscam
2023-08-28 13:08:45 +00:00
committed by Ryan
parent 1d775bd2d3
commit 93082bc94a
9 changed files with 307 additions and 317 deletions
@@ -50,13 +50,14 @@ public abstract class Consumable {
executeConsumptionActions(player);
final int nextItemId = getNextItemId(item.getId());
if(item.getAmount() > 1){
removeItem(player, item.getId(), Container.INVENTORY);
} else removeItem(player, item, Container.INVENTORY);
if (nextItemId != -1) {
addItem(player, nextItemId, 1, Container.INVENTORY);
// STACKABLE + NON-RETURN
if (ids.length == 1) {
replaceSlot(player, item.getSlot(), new Item(item.getId(), (item.getAmount() - 1)), item, Container.INVENTORY);
} else {
// ITEM HAS RETURN
replaceSlot(player, item.getSlot(), new Item(nextItemId, 1), item, Container.INVENTORY);
}
final int initialLifePoints = player.getSkills().getLifepoints();
Consumables.getConsumableById(item.getId()).getConsumable().effect.activate(player);
sendMessages(player, initialLifePoints, item, messages);
@@ -1,7 +1,5 @@
package core.game.interaction
import core.api.forceWalk
import core.api.queueScript
import core.game.event.InteractionEvent
import core.game.event.UseWithEvent
import core.game.node.Node
@@ -218,8 +216,8 @@ object InteractionListeners {
} else {
if(flipped) player.dispatch(UseWithEvent(with.id, used.id))
else player.dispatch(UseWithEvent(used.id, with.id))
if(flipped) method.invoke(player,with,used)
else method.invoke(player,used,with)
if(flipped) return method.invoke(player,with,used)
else return method.invoke(player,used,with)
}
return true
}
@@ -220,36 +220,36 @@ public class BankPinManager {
public void handleConfirmInterface(int button) {
boolean confirm = button != 91;
switch (status) {
case NO_PIN:
if (!confirm) {
toggleConfirmInterface(false);
player.getInterfaceManager().close();
openSettings("No changes made.");
break;
}
openPin();
break;
case PENDING:
if (confirm) {
unlock();
} else {
cancelPin("The PIN has been cancelled", "and will NOT be set.", "", "You still do not have a Bank", "PIN.");
}
break;
case ACTIVE:
if (confirm) {
if (unlocked) {
cancelPin("Your Bank PIN has now been", "deleted.", "", "This means that there is no", "PIN protection on your bank", "account.");
} else {
deleting = true;
openPin();
case NO_PIN:
if (!confirm) {
toggleConfirmInterface(false);
player.getInterfaceManager().close();
openSettings("No changes made.");
break;
}
} else {
openSettings("No changes made.");
}
break;
default:
break;
openPin();
break;
case PENDING:
if (confirm) {
unlock();
} else {
cancelPin("The PIN has been cancelled", "and will NOT be set.", "", "You still do not have a Bank", "PIN.");
}
break;
case ACTIVE:
if (confirm) {
if (unlocked) {
cancelPin("Your Bank PIN has now been", "deleted.", "", "This means that there is no", "PIN protection on your bank", "account.");
} else {
deleting = true;
openPin();
}
} else {
openSettings("No changes made.");
}
break;
default:
break;
}
}
@@ -348,7 +348,7 @@ public class BankPinManager {
return;
} else {
if (!tempPin.equals(pin)) {
playAudio(player, Sounds.PIN_CANCEL_1042);
playAudio(player, Sounds.PILLORY_WRONG_2277);
player.getInterfaceManager().close();
player.sendMessage("The PIN you entered is incorrect.");
if (setTries(getTries() + 1) >= 2) {
@@ -368,6 +368,7 @@ public class BankPinManager {
return;
}
unlock();
playAudio(player, Sounds.PILLORY_SUCCESS_2274);
player.sendMessage("You have correctly entered your PIN.");
}
return;
@@ -440,8 +441,8 @@ public class BankPinManager {
if (stage >= 4) {
stage = stage - 4;
}
setVarp(player, 562, bitValue);
setVarp(player, 563, digits.get(8) | digits.get(9) << 4 | stage << 26);
setVarp(player, 562, bitValue);
setVarp(player, 563, digits.get(8) | digits.get(9) << 4 | stage << 26);
for (int i = 0; i < 9; i++) {
int child = (i > 2 ? i + 1 : i) + 11;
int positionX = 37 + ((i % 3) * 95) + RandomFunction.random(2, 45);
@@ -820,4 +821,4 @@ public class BankPinManager {
public long getPendingDelay() {
return pendingDelay;
}
}
}