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:
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:
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" :
+ "::hloop 762 100 117 true" + "::hloop 762 120 200 true":
+ "::hloop 762 120 130 false":
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.