@Override
    public int loop() throws Exception {
        if(ctx.inventory.isFull()) {
            if(!ctx.bank.isOpen()) {
                final NPC banker = ctx.npcs.getNearest("Banker");
                if(banker != null) {
                    if(banker.interact("Bank")) {
                        Time.sleep(new Condition() {
                            @Override
                            public boolean evaluate() {
                                return ctx.bank.isOpen();
                            }
                        }, 2000);
                    } else {
                        // misclicked
                    }
                } else {
                    // banker is null
                }
            } else {
                if(ctx.bank.depositAll()) {
                    Time.sleep(new Condition() {
                        @Override
                        public boolean evaluate() {
                            return ctx.inventory.isEmpty();
                        }
                    }, 2000);
                }
            }
        } else {
            if(ctx.bank.isOpen()) {
                if(ctx.bank.close()) {
                    Time.sleep(new Condition() {
                        @Override
                        public boolean evaluate() {
                            return !ctx.bank.isOpen();
                        }
                    }, 2000);
                }
            }
        }
        return 1000;
    }