diff --git a/src/Client/JClassPatcher.java b/src/Client/JClassPatcher.java index 11e7a838..d16be5b4 100644 --- a/src/Client/JClassPatcher.java +++ b/src/Client/JClassPatcher.java @@ -1738,6 +1738,25 @@ private void patchClient(ClassNode node) { } } } + + // reset bank drawn flag + insnNodeList = methodNode.instructions.iterator(); + while (insnNodeList.hasNext()) { + AbstractInsnNode insnNode = insnNodeList.next(); + + if (insnNode.getOpcode() == Opcodes.PUTFIELD + && ((FieldInsnNode) insnNode).owner.equals("client") + && ((FieldInsnNode) insnNode).name.equals("Fe") + && ((FieldInsnNode) insnNode).desc.equals("Z")) { + insnNode = insnNode.getNext(); + methodNode.instructions.insertBefore(insnNode, new InsnNode(Opcodes.ICONST_0)); + methodNode.instructions.insertBefore( + insnNode, + new FieldInsnNode(Opcodes.PUTSTATIC, "Game/Client", "bank_interface_drawn", "Z")); + + break; + } + } } if (methodNode.name.equals("a") @@ -4758,6 +4777,54 @@ else if (pos == 1) { } } + // draw bank interface + if (methodNode.name.equals("r") && methodNode.desc.equals("(I)V")) { + Iterator insnNodeList = methodNode.instructions.iterator(); + while (insnNodeList.hasNext()) { + AbstractInsnNode insnNode = insnNodeList.next(); + + // reset bank drawn flag + if (insnNode.getOpcode() == Opcodes.PUTFIELD + && ((FieldInsnNode) insnNode).owner.equals("client") + && ((FieldInsnNode) insnNode).name.equals("Fe") + && ((FieldInsnNode) insnNode).desc.equals("Z")) { + insnNode = insnNode.getNext(); + methodNode.instructions.insertBefore(insnNode, new InsnNode(Opcodes.ICONST_0)); + methodNode.instructions.insertBefore( + insnNode, + new FieldInsnNode(Opcodes.PUTSTATIC, "Game/Client", "bank_interface_drawn", "Z")); + + break; + } + } + + // set bank drawn flag + insnNodeList = methodNode.instructions.iterator(); + while (insnNodeList.hasNext()) { + AbstractInsnNode insnNode = insnNodeList.next(); + if (insnNode.getOpcode() == Opcodes.INVOKEVIRTUAL + && ((MethodInsnNode) insnNode).owner.equals("ba") + && ((MethodInsnNode) insnNode).name.equals("b") + && ((MethodInsnNode) insnNode).desc.equals("(IIIIB)V")) { + insnNode = insnNodeList.next(); + + LabelNode skipLabel = new LabelNode(); + methodNode.instructions.insertBefore( + insnNode, + new FieldInsnNode(Opcodes.GETSTATIC, "Game/Client", "bank_interface_drawn", "Z")); + methodNode.instructions.insertBefore( + insnNode, new JumpInsnNode(Opcodes.IFGT, skipLabel)); + methodNode.instructions.insertBefore(insnNode, new InsnNode(Opcodes.ICONST_1)); + methodNode.instructions.insertBefore( + insnNode, + new FieldInsnNode(Opcodes.PUTSTATIC, "Game/Client", "bank_interface_drawn", "Z")); + methodNode.instructions.insertBefore(insnNode, skipLabel); + + break; + } + } + } + // hookTracer(node, methodNode); } } diff --git a/src/Game/Bank.java b/src/Game/Bank.java index 9eb5bfa1..933bfc61 100644 --- a/src/Game/Bank.java +++ b/src/Game/Bank.java @@ -704,7 +704,7 @@ public static String importBankCsv(File file) { // Draws extra buttons on the side of the bank to control filtering public static void drawBankAugmentations(Graphics2D g2, BufferedMouseClick bufferedMouseClick) { - if (Client.show_bank) { + if (Client.bank_interface_drawn) { if (Settings.SORT_FILTER_BANK.get(Settings.currentProfile)) { // existing bank interface dimensions int bankWidth = 408; diff --git a/src/Game/Client.java b/src/Game/Client.java index 2050b4ff..56eafc33 100644 --- a/src/Game/Client.java +++ b/src/Game/Client.java @@ -154,6 +154,7 @@ public class Client { public static int combat_timer; public static boolean isGameLoaded; public static boolean show_bank; + public static boolean bank_interface_drawn; public static boolean show_duel; public static boolean show_duelconfirm; public static int show_friends; @@ -1509,6 +1510,9 @@ public static boolean gameOpcodeReceivedHook(int opcode, int psize) { // sleep exit packet, restore whatever was in pm pm_enteredText = pm_enteredTextCopy; pm_enteredTextCopy = ""; + } else if (opcode == 203) { + // bank close packet + bank_interface_drawn = false; } if (Bank.processPacket(opcode, psize)) {