Thread: [Vencillio] Bank Tabs

Results 1 to 7 of 7
  1. #1 [Vencillio] Bank Tabs 
    Registered Member
    Join Date
    Jul 2010
    Posts
    67
    Thanks given
    40
    Thanks received
    10
    Rep Power
    72
    Hey all, the bank tabs on vencillio get messed up when you try to create a new bank tab using the only item in a tab. Also the bank tabs will mess up if you withdraw the only item inside of a tab. I have also noticed that if it is the last existing tab, there are no issues withdrawing the only item inside the bank tab. So, if I have 8 bank tabs and I withdraw the only item inside the 8th tab, it will collapse correctly. I believe the root of the problem has to do with tab collapsing, but I'm not quite sure how to fix it. If anyone has fixed it or can help lead me in the right the direction, I would be very grateful. Thanks!

    Below are some gifs to demonstrate. The first one is withdrawing the only item in the bank tab. The second one is creating a new tab using the only item inside of a tab.
    Attached imageAttached image


    Here are my methods regarding bank tabs:
    Code:
    public void withdraw(int item, int amount) {
    		if (!player.getInterfaceManager().hasBankOpen()) {
    			return;
    		}
    
    		if (!hasItemId(item)) {
    			return;
    		}
    
    		int bankAmount = getItemAmount(item);
    		int bankSlot = getItemSlot(item);
    
    		if (bankAmount < amount) {
    			amount = bankAmount;
    		}
    		int old = item;
    		if (withdrawType == WithdrawTypes.NOTE) {
    			if (!Item.getDefinition(item).canNote())
    				player.getClient().queueOutgoingPacket(new SendMessage("This item cannot be withdrawn as a note."));
    			else {
    				item = Item.getDefinition(item).getNoteId();
    			}
    		}
    
    		int added = player.getInventory().add(item, amount, false);
    
    		if (added > 0) {
    			if (remove(new Item(old, added), true) > 0) {
    				if (added == bankAmount) {
    					int tab = getData(bankSlot, 0);
    					changeTabAmount(tab, -1, tab == 0 && tabAmounts[0] == 1);
    				}
    			}
    		}
    	}
    
    	public void collapse(int tab, int toTab) {
    		if (tab == 0) {
    			Arrays.fill(tabAmounts, 0);
    			tabAmounts[0] = getTakenSlots();
    			shift();
    			update();
    			return;
    		}
    
    		if (toTab == 0) {
    			player.send(new SendConfig(1000, 0));
    			bankTab = 0;
    		}
    
    		if (toTab == tab || tab > 9) {
    			shift();
    			update();
    			return;
    		}
    
    		int itemSlot = getData(tab, 1);
    		int initialTabAmount = tabAmounts[tab];
    
    		for (int fromSlot = 0; fromSlot < initialTabAmount; fromSlot++) {
    			itemToTab(itemSlot, toTab, false);
    		}
    
    		collapse(tab + 1, tab);
    	}
    
    	public int getData(int input, int type) {
    		int totalSlots = 0;
    		for (int tab = 0; tab < (type == 1 ? input + 1 : 10); tab++) {
    			if (type == 0 && input <= totalSlots + tabAmounts[tab] - 1 && input >= totalSlots) {
    				return tab;
    			}
    			totalSlots += tabAmounts[tab];
    		}
    		return totalSlots - 1;
    	}
    
    	public void itemToTab(int slot, int toTab, boolean refresh) {
    		int fromTab = getData(slot, 0);
    
    		if (fromTab == toTab || (toTab > 1 && tabAmounts[toTab - 1] == 0 && tabAmounts[toTab] == 0)) {
    			return;
    		}
    		
    		if (tabAmounts[fromTab] == 0) {
    			return;
    		}
    		
    		
    		changeTabAmount(fromTab, -1, refresh);
    		changeTabAmount(toTab, 1, false);
    		RearrangeTypes temp = rearrangeType;
    		rearrangeType = RearrangeTypes.INSERT;
    		swap(getData(toTab, 1), slot);
    		rearrangeType = temp;
    
    		if (refresh) {
    			update();
    		}
    	}
    
    	public void changeTabAmount(int tab, int amount, boolean collapse) {
    		tabAmounts[tab] += amount;
    		if (tabAmounts[tab] <= 0 && collapse) {
    			collapse(tab, 0);
    		}
    	}
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2016
    Posts
    110
    Thanks given
    8
    Thanks received
    0
    Rep Power
    11
    Anyone have a fix for this?
    Reply With Quote  
     

  3. #3 Just start at @override and paste this in and tell me if it works 
    Registered Member RSPS 2016's Avatar
    Join Date
    Dec 2016
    Posts
    73
    Thanks given
    13
    Thanks received
    13
    Rep Power
    15
    should be from @Override to the bottom paste this in and try it dont forget to compile after it almost looks the same I know









    Code:
    @Override
    	public void clear() {
    		Arrays.fill(tabAmounts, 0);
    		bankTab = 0;
    		setSearching(false);
    		super.clear();
    	}
    
    	public void withdraw(int item, int amount) {
    		if (!player.getInterfaceManager().hasBankOpen()) {
    			return;
    		}
    
    		if (!hasItemId(item)) {
    			return;
    		}
    
    		int bankAmount = getItemAmount(item);
    		int bankSlot = getItemSlot(item);
    
    		if (bankAmount < amount) {
    			amount = bankAmount;
    		}
    		int old = item;
    		if (withdrawType == WithdrawTypes.NOTE) {
    			if (!Item.getDefinition(item).canNote())
    				player.getClient().queueOutgoingPacket(new SendMessage("This item cannot be withdrawn as a note."));
    			else {
    				item = Item.getDefinition(item).getNoteId();
    			}
    		}
    
    		int added = player.getInventory().add(item, amount, false);
    
    		if (added > 0) {
    			if (remove(new Item(old, added), true) > 0) {
    				if (added == bankAmount) {
    					int tab = getData(bankSlot, 0);
    					changeTabAmount(tab, -1, tab == 0 && tabAmounts[0] == 1);
    				}
    			}
    		}
    	}
    
    	public void collapse(int tab, int toTab) {
    		if (tab == 0) {
    			Arrays.fill(tabAmounts, 0);
    			tabAmounts[0] = getTakenSlots();
    			shift();
    			update();
    			return;
    		}
    
    		if (toTab == 0) {
    			player.send(new SendConfig(1000, 0));
    			bankTab = 0;
    		}
    
    		if (toTab == tab || tab > 9) {
    			shift();
    			update();
    			return;
    		}
    
    		int itemSlot = getData(tab, 1);
    		int initialTabAmount = tabAmounts[tab];
    
    		for (int fromSlot = 0; fromSlot < initialTabAmount; fromSlot++) {
    			itemToTab(itemSlot, toTab, false);
    		}
    
    		collapse(tab + 1, tab);
    	}
    
    	public int getData(int input, int type) {
    		int totalSlots = 0;
    		for (int tab = 0; tab < (type == 1 ? input + 1 : 10); tab++) {
    			if (type == 0 && input <= totalSlots + tabAmounts[tab] - 1 && input >= totalSlots) {
    				return tab;
    			}
    			totalSlots += tabAmounts[tab];
    		}
    		return totalSlots - 1;
    	}
    
    	public void itemToTab(int slot, int toTab, boolean refresh) {
    		int fromTab = getData(slot, 0);
    
    		if (fromTab == toTab || (toTab > 1 && tabAmounts[toTab - 1] == 0 && tabAmounts[toTab] == 0)) {
    			return;
    		}
    
    		changeTabAmount(fromTab, -1, refresh);
    		changeTabAmount(toTab, 1, false);
    		RearrangeTypes temp = rearrangeType;
    		rearrangeType = RearrangeTypes.INSERT;
    		swap(getData(toTab, 1), slot);
    		rearrangeType = temp;
    
    		if (refresh) {
    			update();
    		}
    	}
    
    	public void changeTabAmount(int tab, int amount, boolean collapse) {
    		tabAmounts[tab] += amount;
    		if (tabAmounts[tab] <= 0 && collapse) {
    			collapse(tab, 0);
    		}
    	}
    
    	public int getTabAmount(int tab) {
    		return tabAmounts[tab];
    	}
    
    	public int[] getTabAmounts() {
    		return tabAmounts;
    	}
    
    	public void setTabAmounts(int[] tabAmounts) {
    		this.tabAmounts = tabAmounts;
    	}
    
    	public void setBankTab(int bankTab) {
    		this.bankTab = bankTab;
    	}
    
    	public boolean isSearching() {
    		return searching;
    	}
    
    	public void setSearching(boolean searching) {
    		this.searching = searching;
    		if (!isSearching()) {
    			player.send(new SendConfig(1012, 0));
    		} else {
    			player.send(new SendEnterString());
    		}
    		player.send(new OutgoingPacket() {
    			@Override
    			public void execute(Client paramClient) {
    			}
    
    			@Override
    			public int getOpcode() {
    				return 187;
    			}
    		});
    	}
    }
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Dec 2016
    Posts
    110
    Thanks given
    8
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by RSPS 2016 View Post
    should be from @Override to the bottom paste this in and try it dont forget to compile after it almost looks the same I know









    Code:
    @Override
    	public void clear() {
    		Arrays.fill(tabAmounts, 0);
    		bankTab = 0;
    		setSearching(false);
    		super.clear();
    	}
    
    	public void withdraw(int item, int amount) {
    		if (!player.getInterfaceManager().hasBankOpen()) {
    			return;
    		}
    
    		if (!hasItemId(item)) {
    			return;
    		}
    
    		int bankAmount = getItemAmount(item);
    		int bankSlot = getItemSlot(item);
    
    		if (bankAmount < amount) {
    			amount = bankAmount;
    		}
    		int old = item;
    		if (withdrawType == WithdrawTypes.NOTE) {
    			if (!Item.getDefinition(item).canNote())
    				player.getClient().queueOutgoingPacket(new SendMessage("This item cannot be withdrawn as a note."));
    			else {
    				item = Item.getDefinition(item).getNoteId();
    			}
    		}
    
    		int added = player.getInventory().add(item, amount, false);
    
    		if (added > 0) {
    			if (remove(new Item(old, added), true) > 0) {
    				if (added == bankAmount) {
    					int tab = getData(bankSlot, 0);
    					changeTabAmount(tab, -1, tab == 0 && tabAmounts[0] == 1);
    				}
    			}
    		}
    	}
    
    	public void collapse(int tab, int toTab) {
    		if (tab == 0) {
    			Arrays.fill(tabAmounts, 0);
    			tabAmounts[0] = getTakenSlots();
    			shift();
    			update();
    			return;
    		}
    
    		if (toTab == 0) {
    			player.send(new SendConfig(1000, 0));
    			bankTab = 0;
    		}
    
    		if (toTab == tab || tab > 9) {
    			shift();
    			update();
    			return;
    		}
    
    		int itemSlot = getData(tab, 1);
    		int initialTabAmount = tabAmounts[tab];
    
    		for (int fromSlot = 0; fromSlot < initialTabAmount; fromSlot++) {
    			itemToTab(itemSlot, toTab, false);
    		}
    
    		collapse(tab + 1, tab);
    	}
    
    	public int getData(int input, int type) {
    		int totalSlots = 0;
    		for (int tab = 0; tab < (type == 1 ? input + 1 : 10); tab++) {
    			if (type == 0 && input <= totalSlots + tabAmounts[tab] - 1 && input >= totalSlots) {
    				return tab;
    			}
    			totalSlots += tabAmounts[tab];
    		}
    		return totalSlots - 1;
    	}
    
    	public void itemToTab(int slot, int toTab, boolean refresh) {
    		int fromTab = getData(slot, 0);
    
    		if (fromTab == toTab || (toTab > 1 && tabAmounts[toTab - 1] == 0 && tabAmounts[toTab] == 0)) {
    			return;
    		}
    
    		changeTabAmount(fromTab, -1, refresh);
    		changeTabAmount(toTab, 1, false);
    		RearrangeTypes temp = rearrangeType;
    		rearrangeType = RearrangeTypes.INSERT;
    		swap(getData(toTab, 1), slot);
    		rearrangeType = temp;
    
    		if (refresh) {
    			update();
    		}
    	}
    
    	public void changeTabAmount(int tab, int amount, boolean collapse) {
    		tabAmounts[tab] += amount;
    		if (tabAmounts[tab] <= 0 && collapse) {
    			collapse(tab, 0);
    		}
    	}
    
    	public int getTabAmount(int tab) {
    		return tabAmounts[tab];
    	}
    
    	public int[] getTabAmounts() {
    		return tabAmounts;
    	}
    
    	public void setTabAmounts(int[] tabAmounts) {
    		this.tabAmounts = tabAmounts;
    	}
    
    	public void setBankTab(int bankTab) {
    		this.bankTab = bankTab;
    	}
    
    	public boolean isSearching() {
    		return searching;
    	}
    
    	public void setSearching(boolean searching) {
    		this.searching = searching;
    		if (!isSearching()) {
    			player.send(new SendConfig(1012, 0));
    		} else {
    			player.send(new SendEnterString());
    		}
    		player.send(new OutgoingPacket() {
    			@Override
    			public void execute(Client paramClient) {
    			}
    
    			@Override
    			public int getOpcode() {
    				return 187;
    			}
    		});
    	}
    }
    Tabs are all weird now.
    When you remove something from tab 2, tab 3 shows wrong item.
    Reply With Quote  
     

  5. #5  
    Registered Member RSPS 2016's Avatar
    Join Date
    Dec 2016
    Posts
    73
    Thanks given
    13
    Thanks received
    13
    Rep Power
    15
    There is no problem with the section of code i posted it works perfectly for me I would just delete the whole code and redo it and i mean from the top of the page to the bottom
    Reply With Quote  
     

  6. #6  
    Donator


    Join Date
    Jul 2011
    Posts
    921
    Thanks given
    199
    Thanks received
    178
    Rep Power
    189
    Nice find. Here's the fix.

    In the withdraw method change:

    Code:
    changeTabAmount(tab, -1, tab == 0 && tabAmounts[0] == 1);
    to:
    Code:
    changeTabAmount(tab, -1, tabAmounts[tab] == 1);
    Reply With Quote  
     


  7. #7  
    Registered Member
    Join Date
    Dec 2016
    Posts
    110
    Thanks given
    8
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Blaketon View Post
    Nice find. Here's the fix.

    In the withdraw method change:

    Code:
    changeTabAmount(tab, -1, tab == 0 && tabAmounts[0] == 1);
    to:
    Code:
    changeTabAmount(tab, -1, tabAmounts[tab] == 1);
    Thank you very much, but can you also share the pest control/instancing bug?
    All my npc disappear when pest control game finishes
    By the way, nice job on Alos man.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [OSRS] Vencillio - Economy, Bank Tabs, Prestiges, Unique Content.
    By Ashpire in forum Downloads
    Replies: 714
    Last Post: 12-17-2021, 02:37 AM
  2. Buying new bank tabs for vencillio
    By Zahhak in forum Buying
    Replies: 2
    Last Post: 10-06-2016, 01:21 AM
  3. Paying for vencillio bank tabs to be fixed
    By Zahhak in forum Buying
    Replies: 0
    Last Post: 10-05-2016, 09:16 AM
  4. Replies: 1
    Last Post: 06-07-2016, 04:17 PM
  5. Replies: 310
    Last Post: 04-30-2016, 07:26 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •