Fixed a bug where depositing the full inventory doesn't work when the bank is full and there's noted items in the player's inventory

This commit is contained in:
Sam Marder
2026-05-30 14:29:50 +00:00
committed by Ryan
parent 501b75aa22
commit 50eb7582dd
2 changed files with 24 additions and 14 deletions
@@ -1,13 +1,10 @@
package core.game.container.impl; package core.game.container.impl;
import core.api.IfaceSettingsBuilder;
import core.game.container.access.InterfaceContainer;
import kotlin.Unit;
import kotlin.ranges.IntRange;
import org.rs09.consts.Vars;
import core.ServerConstants; import core.ServerConstants;
import core.api.IfaceSettingsBuilder;
import core.game.component.Component; import core.game.component.Component;
import core.game.container.*; import core.game.container.*;
import core.game.container.access.InterfaceContainer;
import core.game.node.entity.player.Player; import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.IronmanMode; import core.game.node.entity.player.link.IronmanMode;
import core.game.node.item.Item; import core.game.node.item.Item;
@@ -16,8 +13,8 @@ import core.game.world.GameWorld;
import core.net.packet.PacketRepository; import core.net.packet.PacketRepository;
import core.net.packet.context.ContainerContext; import core.net.packet.context.ContainerContext;
import core.net.packet.out.ContainerPacket; import core.net.packet.out.ContainerPacket;
import kotlin.ranges.IntRange;
import java.nio.ByteBuffer; import org.rs09.consts.Vars;
import static core.api.ContentAPIKt.*; import static core.api.ContentAPIKt.*;
@@ -201,14 +198,9 @@ public final class BankContainer extends Container {
} }
item = new Item(item.getId(), amount, item.getCharge()); item = new Item(item.getId(), amount, item.getCharge());
boolean unnote = !item.getDefinition().isUnnoted(); Item add = item.toUnnotedItem();
Item add = unnote ? new Item(item.getDefinition().getNoteId(), amount, item.getCharge()) : item; int maxCount = getMaximumAdd(add);
if (unnote && !add.getDefinition().isUnnoted()) {
add = item;
}
int maxCount = super.getMaximumAdd(add);
if (amount > maxCount) { if (amount > maxCount) {
add.setAmount(maxCount); add.setAmount(maxCount);
item.setAmount(maxCount); item.setAmount(maxCount);
@@ -474,6 +466,11 @@ public final class BankContainer extends Container {
return open; return open;
} }
@Override
public int getMaximumAdd(Item item) {
return super.getMaximumAdd(item.toUnnotedItem());
}
/** /**
* Listens to the bank container. * Listens to the bank container.
* @author Emperor * @author Emperor
@@ -135,6 +135,19 @@ public class Item extends Node{
return getId(); return getId();
} }
/**
* Converts noted items into unnoted items.
*
* @return The unnoted version of the item. Returns the original Item if already unnoted.
*/
public Item toUnnotedItem() {
if (definition.isUnnoted()) {
return this;
} else {
return new Item(definition.getNoteId(), getAmount(), getCharge());
}
}
/** /**
* @return the id * @return the id
*/ */