Thread: [876 Matrix] Fixing bank equipment panel

Results 1 to 3 of 3
  1. #1 [876 Matrix] Fixing bank equipment panel 
    Registered Member
    Join Date
    Apr 2017
    Posts
    16
    Thanks given
    8
    Thanks received
    6
    Rep Power
    18
    This tutorial is about how to fix not working buttons and similiar things in 876 matrix version, I'll show as example the bank equipment panel.

    THIS TUTORIAL IS FOR THIS VERSION: https://www.rune-server.ee/runescape...eoneering.html

    First check that there are debug strings that printed on some events such as button click, packet recieve, etc.

    In our case the panel looks like this:
    Attached image

    When clicking on item there is no debug string printed in ButtonHandler.Java - that's a sign that the component isn't 'connected' to the server, therefore we need to find the component id and 'connect' the component (see unlockButtons in Bank.java for simlar components).

    1. We want to find the component id of the slots in that equipment panel, It's known that the interface id of the bank is 762 (look at Bank.java, you can find it yourself with some commands for showing interfaces) so we will use that to hide components in this interface and find the exact component id.

    First use compdump command to get the number of components:
    Attached image
    Attached image
    Then start using ::hloop (hide/show many components) and ::hidec (hide single component) until you have the correct omponent id.
    For example "::hloop 762 200 349 true" :
    Attached image
    + "::hloop 762 100 117 true" + "::hloop 762 120 200 true":
    Attached image
    + "::hloop 762 120 130 false":
    Attached image

    After some more commands we will get that 136 is the right component id (be careful with that hide method because 134/118 also hides the item slots, they are probably some containers of the item slots).

    2. We need to 'connect' these item slots to the server, add that line to unlockButtons() method at Bank.java:
    Code:
    player.getPackets().sendIComponentSettings(762, 136, 0, 18, 15302654);
    After that you should see some debug strings printed when clicking on item (be sure that something is printed at ButtonHandler.java), something like that:
    Code:
    762, 136, 4
    Action Button: InterfaceId = 762, ChildId = 136, SlotId = 4, SlotId2 = 1127
    3. We need to add logic to the server to handle that button click, here is code for deposit, it's very similar with withdraw:
    Add that to Bank.Java and remove previous functions with that name:
    Code:
    	public void depositItem(int invSlot, int quantity, boolean refresh) {
    		depositItem(invSlot, quantity, refresh, false);
    	}
    	public void depositItem(int invSlot, int quantity, boolean refresh, boolean equip) {
    		if (quantity < 1 || invSlot < 0 || invSlot > 27)
    			return;
    		if(Settings.DEBUG)
    		{
    			System.out.println("Deposit: "+" invSlot= "+invSlot+", quantity= "+quantity+", refresh="+Boolean.toString(refresh));
    		}
    		// get item
    		Item item = null;
    		if(!equip) item = player.getInventory().getItem(invSlot);
    		else item = player.getEquipment().getItem(invSlot);
    		if (item == null)
    			return;
    		
    		// get amount
    		if(!equip) {
    			int amt = player.getInventory().getItems().getNumberOf(item);
    			if (amt < quantity)
    				item = new Item(item.getId(), amt, /* item.getDegrade() */0);
    			else
    				item = new Item(item.getId(), quantity, /* item.getDegrade() */0);
    		}
    		ItemDefinitions defs = item.getDefinitions();
    		int originalId = item.getId();
    		if (defs.isNoted() && defs.getCertId() != -1)
    			item.setId(defs.getCertId());
    		Item bankedItem = getItem(item.getId());
    		if (bankedItem != null) {
    			if (bankedItem.getAmount() + item.getAmount() <= 0) {
    				item.setAmount(Integer.MAX_VALUE - bankedItem.getAmount());
    				player.getPackets().sendGameMessage("Not enough space in your bank.");
    			} else if (bankedItem.getAmount() + item.getAmount() >= Integer.MAX_VALUE) {
    				player.getPackets().sendGameMessage("Could not bank your " + item.getName());
    				return;
    			}
    		} else if (!hasBankSpace()) {
    			player.getPackets().sendGameMessage("Not enough space in your bank.");
    			return;
    		}
    		if(!equip) player.getInventory().deleteItem(invSlot, new Item(originalId, item.getAmount(), /* item.getDegrade() */0));
    		else player.getEquipment().deleteItem(item.getId(), item.getAmount());
    		addItem(item, refresh);
    	}
    Add that to ButtonHandler.Java under "else if (interfaceId == 762)" (the if for the Bank interface) in handleButtons() method :
    Code:
    else if(componentId == 136){
    	if (packetId == WorldPacketsDecoder.ACTION_BUTTON1_PACKET)
    		player.getBank().depositItem(slotId, 1, true, true);
    }
    Now the equipment item slots should work.
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Nov 2015
    Age
    24
    Posts
    1,980
    Thanks given
    334
    Thanks received
    1,051
    Rep Power
    5000
    nice contribution i guess
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Jul 2011
    Posts
    1,767
    Thanks given
    493
    Thanks received
    425
    Rep Power
    0
    good job, I like that you put some information in there will surely help some1
    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. Replies: 14
    Last Post: 01-12-2018, 09:40 PM
  2. (876 matrix) cant equip some items
    By Ikrim in forum Help
    Replies: 0
    Last Post: 03-23-2017, 01:51 AM
  3. Matrix 718 Bank/Equipment interface bug
    By NovaGTX in forum Help
    Replies: 2
    Last Post: 09-29-2016, 06:12 AM
  4. Replies: 6
    Last Post: 09-09-2008, 03:28 AM
  5. Fixing 2h Equips With shield
    By sarah101 in forum Tutorials
    Replies: 10
    Last Post: 06-20-2007, 09:56 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •