PDA

View Full Version : Closing shop interface



Neelix
June 18th, 2010, 15:39
When I close my shop interface, my inventory tab and all other tabs return. But when I open a shop, my tabs disappear (which is normal and good, like real rs), but when i click on main map for walking away without closing the X button, my tabs do not return.

Who knows what to do? Adding setInterfaces(p) doesn't help because it gives lagg.

Faab234
June 18th, 2010, 15:50
Do you know the packet for Main map Walking, Add this in that case:


if (p.interfaceId != -1) {
p.frames.removeShownInterface(p);
p.frames.restoreInventory(p);
}
if (p.chatboxInterfaceId != -1) {
p.frames.removeChatboxInterface(p);
}

Neelix
June 18th, 2010, 16:53
Could you post your restoreInventory void?

Break
June 18th, 2010, 16:56
Neelix, Faab gave you the solution.
Do you still need help?

If you do, I got other way to fix this.

Neelix
June 18th, 2010, 16:59
Already found the answer:



/**
* Set the inventory.
* @param p The Player which the frame should be created for.
* @param childId The interface to display on the inventory.
*/
public void restoreTabs(Player p) {
for (int b = 16; b <= 21; b++) {
setInterfaceConfig(p, 548, b, false);
}
for (int a = 32; a <= 38; a++) {
setInterfaceConfig(p, 548, a, false);
}
p.calculateEquipmentBonus();
setInterfaceConfig(p, 548, 14, false);
setInterfaceConfig(p, 548, 31, false);
setInterfaceConfig(p, 548, 63, false);
setInterfaceConfig(p, 548, 72, false);
}

/**
* Set the inventory.
* @param p The Player which the frame should be created for.
* @param childId The interface to display on the inventory.
*/
public void hideTabs(Player p) {
for (int b = 16; b <= 21; b++) {
setInterfaceConfig(p, 548, b, true);
}
for (int a = 32; a <= 38; a++) {
setInterfaceConfig(p, 548, a, true);
}
p.calculateEquipmentBonus();
setInterfaceConfig(p, 548, 14, true);
setInterfaceConfig(p, 548, 31, true);
setInterfaceConfig(p, 548, 63, true);
setInterfaceConfig(p, 548, 72, true);
}

/**
* Set the inventory.
* @param p The Player which the frame should be created for.
* @param childId The interface to display on the inventory.
*/
public void setInventory(Player p, int childId) {
setInterface(p, 0, 548, 71, childId);
hideTabs(p);
}

/**
* Restore the inventory.
* @param p The Player which the frame should be created for.
* @param childId The interface to display on the inventory.
*/
public void restoreInventory(Player p) {
setInterface(p, 1, 548, 71, 56);
restoreTabs(p);
}

You have to place restoreInventory(p) at packet 138 where you can main walk.

thanks and thread can close :)