Deffiliate Posted May 24, 2014 Share Posted May 24, 2014 So, the recent OSBot update made it so that we can't view the equipment we're wearing unless we open the tab. This amended Equipment class will retrieve the equipment shown in the equipment tab the last time you opened it. So just to be clear, you need to re-open the equipment tab yourself any time you want to get an updated list of items equipped. The only benefit of this class over OSB's class is that this doesn't require you to open the tab ea time you want a list of equipped items. package def.api.equipment; import java.util.ArrayList; import org.osbot.script.rs2.Client; import org.osbot.script.rs2.model.Item; import org.osbot.script.rs2.ui.EquipmentSlot; import org.osbot.script.rs2.ui.RS2InterfaceChild; public class Equipment { public static Item[] getEquipment(Client client){ ArrayList<Item> items = new ArrayList<Item>(); for(EquipmentSlot slot: EquipmentSlot.values()){ for(RS2InterfaceChild slotChild : client.getInterface(387).getChild(slot.childId).getChildren()){ if(slotChild!=null){ if(slotChild.getItemId()!=-1){ items.add(new Item(slotChild.getItemId(),slotChild.getItemAmount())); } } } } Item[] itemA = new Item[items.size()]; return items.toArray(itemA); } public static EquipmentSlot getSlotForId(Client client, int id){ for(EquipmentSlot slot: EquipmentSlot.values()){ for(RS2InterfaceChild slotChild : client.getInterface(387).getChild(slot.childId).getChildren()){ if(slotChild!=null){ if(slotChild.getItemId()==id){ return slot; } } } } return null; } public static Item getItemInSlot(Client client,EquipmentSlot slot){ for(RS2InterfaceChild slotChild : client.getInterface(387).getChild(slot.childId).getChildren()){ if(slotChild!=null){ if(slotChild.getItemId()!=-1){ return new Item(slotChild.getItemId(),slotChild.getItemAmount()); } } } return null; } } 3 Link to comment Share on other sites More sharing options...
PolishCivil Posted May 24, 2014 Share Posted May 24, 2014 You can also check if you are wearing weapon w/o opening equip interface. But current api doesnt provide required thing : interface settings. int[] interfaceSettings = (int[]) Class.forName("es", false, client.instance.getClass().getClassLoader()).getField("a").get(null); interfaceSettings[843] != 0; Also i bet we can get everything else like cape, helm... Cuz model renderer must have this info. 3 Link to comment Share on other sites More sharing options...
Deffiliate Posted May 24, 2014 Author Share Posted May 24, 2014 You can also check if you are wearing weapon w/o opening equip interface. But current api doesnt provide required thing : interface settings. int[] interfaceSettings = (int[]) Class.forName("es", false, client.instance.getClass().getClassLoader()).getField("a").get(null); interfaceSettings[843] != 0; Also i bet we can get everything else like cape, helm... Cuz model renderer must have this info. Yeah bro! I posted this in the Bug Tracker thing. I remember there being a hook for this in an old EOC client. Was called getAppearance(), the only downfall was that you can't get the id for worn rings or ammo (Since these aren't visible). You should post a suggestion for this with all the info needed in the tracker Link to comment Share on other sites More sharing options...
Th3 Posted May 24, 2014 Share Posted May 24, 2014 (edited) There must be some way to force load the items. Otherwise they'll do this shit to inventory too. Edited May 24, 2014 by Th3 Link to comment Share on other sites More sharing options...
PolishCivil Posted May 24, 2014 Share Posted May 24, 2014 There must be some way to force load the items. Otherwise they'll do this shit to inventory too. Nah, I bet fagex just simply sends actions and child's data with equipmeint interface request. Link to comment Share on other sites More sharing options...
Dog_ Posted May 24, 2014 Share Posted May 24, 2014 (edited) You can also check if you are wearing weapon w/o opening equip interface. But current api doesnt provide required thing : interface settings. int[] interfaceSettings = (int[]) Class.forName("es", false, client.instance.getClass().getClassLoader()).getField("a").get(null);interfaceSettings[843] != 0;Also i bet we can get everything else like cape, helm... Cuz model renderer must have this info.Can pull all the equipment from the player definition except boots and ring. and I'm p sure the equipment is always in the item def Cache, as well as other peoples equipment and bank (if the bank was opened in the current region) Edited May 24, 2014 by Rawr Link to comment Share on other sites More sharing options...
Pug Posted June 1, 2014 Share Posted June 1, 2014 i decided to test your class out tonight and it worked when i tried it in a test script that returned whether or not there is an item in the ring slot. I implemented it into my script. tested it. didnt work. re-ran the test script and that is also not working now. It doesnt return the item in question just a 6 alphanumeric combination that changes between three combinations upon reading the item in the slot. so it never reads null. After retestign a few times ive discovered that after you wear the ring and have it test for a ring for it to come back true. If you then change tab to inventory and re-open equipment tab take off the ring and go back to inventory again and re-test its not updating the players items being worn. If you logout and then back in and retest it will work once more. any suggestions? code: // upon arriving in bank i call: checkRing(); // check ring method (horrible i know) public void checkRing() throws InterruptedException { log("open inventory tab."); selectInterfaceOption(548, 50, "Inventory"); sleep(1000 + random(100,200)); log("checking if wearing ring"); if(currentTab() != Tab.EQUIPMENT) { log("open equipment tab."); this.equipmentTab.open(); log("sleeping"); sleep(1000 + random(100,120)); log("checking ring."); } if(Equipment.getItemInSlot(client, EquipmentSlot.RING) != null) { log("Have a Ring"); havering = true; } if(Equipment.getItemInSlot(client, EquipmentSlot.RING) == null) { log("No Ring"); havering = false; } } i have my paint display what item your method is churning out and it shows this now: Link to comment Share on other sites More sharing options...