mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-13 01:51:37 -07:00
Fixed bug that could cause bank to throw index out of bounds and vanish items when rearranging tabs with completely full bank
This commit is contained in:
parent
2846ff7172
commit
f94fb24608
1 changed files with 8 additions and 0 deletions
|
|
@ -39,6 +39,14 @@ public class SlotSwitchPacket implements IncomingPacket {
|
|||
int tabIndex = BankContainer.getArrayIndex(withChildId);
|
||||
if (tabIndex > -1) {
|
||||
secondSlot = tabIndex == 10 ? player.getBank().freeSlot() : player.getBank().getTabStartSlot()[tabIndex] + player.getBank().getItemsInTab(tabIndex);
|
||||
|
||||
Item inSlot = player.getBank().get(slot);
|
||||
|
||||
if (secondSlot == -1 && player.getBank().remove(inSlot)) {
|
||||
player.getBank().add(inSlot);
|
||||
return;
|
||||
}
|
||||
|
||||
childId = player.getBank().getTabByItemSlot(slot);
|
||||
if (secondSlot > slot) {
|
||||
player.getBank().insert(slot, secondSlot - 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue