Parameter Posted January 3, 2014 Posted January 3, 2014 (edited) We'll have to do with this as long as it's not hooked, I needed this for my script and I decided to share it with you people. public Entity getInteracting(final org.osbot.script.rs2.model.Character<?> character) { try { final ClassLoader loader = provider.bot.I(); final Field field = loader.loadClass("aw").getDeclaredField("ao"); field.setAccessible(true); final int index = field.getInt(character.instance) * 1850266567; final XClient client = provider.client.instance; if (index == -1) { return null; } else if (index > 32767) { final XPlayer[] players = client.getLocalPlayers(); return new Player(players[index - 32768]); } else { final XNPC[] npcs = client.getLocalNpcs(); return new NPC(npcs[index]); } } catch (final Exception e) { provider.log(e.getMessage()); } return null; } Probably self explanatory but it uses the bots classloader to load class aw (entity/character/actor) and retrieve field ao (interacting index). It then changes the modifier of this field to public. If index = -1 (no interacting entity) it returns null, if the index is higher than 32767 (the size of the npc array), the interacting entity is a player and therefor it gets the player array (obviously unmodified) and subtracts 32768 from the index to get the index in the player array. If the index is not higher than 32767 (so 32767 and lower) it'll just get the instance out of the unmodified npc array and return a new NPC. Images: Edited January 3, 2014 by Parameter 2
Just Because Posted January 3, 2014 Posted January 3, 2014 Probably the coolest thing i've seen all week.
XavierM Posted January 3, 2014 Posted January 3, 2014 Useless since this is hooked and working fine 1
HashPlant512 Posted January 3, 2014 Posted January 3, 2014 Useless since this is hooked and working fine ^
Parameter Posted January 3, 2014 Author Posted January 3, 2014 (edited) Useless since this is hooked and working fine No offense but the api is so messy it is very hard to find, please do point me in the right direction. Oh you call it getFacing? Fucking Laz with his weird naming it drives me crazy Edited January 3, 2014 by Parameter 2