Code:
public void bankItemWithouthReq(int itemId, int amount) {
int toBankSlot = 0;
boolean alreadyInBank = false;
for (int i=700; i<Config.BANK_SIZE; i++) {
if (c.bankItems[i] == itemId + 1) {
alreadyInBank = true;
toBankSlot = i;
i=Config.BANK_SIZE+1;
}
}
while (amount > 0) {
if (alreadyInBank) {
c.bankItemsN[toBankSlot] += 1;
amount--;
} else {
c.bankItems[toBankSlot] = itemId + 1;
c.bankItemsN[toBankSlot] += 1;
amount--;
}
}
resetTempItems();
resetBank();
}
this is a method to automatically bank an item given but the problem is that it replaces and item in the slot i set it for. how can i make it so it automatically goes to the next available slot in the bank?