eniac86 21 Posted August 21, 2017 Share Posted August 21, 2017 Hey i'm trying to write a plugin that will open crates and clams while fishing. Sadly i have no idea how to send a shift+right-click to an item. Does anyone have an idea how to do that ? this does not work: wManager.Wow.Helpers.ItemsManager.UseItem(item.Name); Lua.LuaDoString("LootButton1:Click()"); this might work but i don't know how to continue: foreach (WoWItem item in items) { if (item.Name.Equals("Heavy Crate") || item.Name.Equals("Big-mouth Clam")) { wManager.Wow.Helpers.Bag.OpenAllBags(); List<int> bagAndSlot = wManager.Wow.Helpers.Bag.GetItemContainerBagIdAndSlot(item.Name); ... x=? y=? robotManager.Helpful.Keyboard.DownKey(wManager.Wow.Memory.WowMemory.Memory.WindowHandle, System.Windows.Forms.Keys.Shift); robotManager.Helpful.Mouse.ClickRight(); robotManager.Helpful.Keyboard.UpKey(wManager.Wow.Memory.WowMemory.Memory.WindowHandle, System.Windows.Forms.Keys.Shift); wManager.Wow.Helpers.Bag.CloseAllBags(); } } Link to comment Share on other sites More sharing options...
reapler 154 Posted August 21, 2017 Share Posted August 21, 2017 (edited) Hello, since you are using vanilla i assume the method doesn't work correctly but i'm not sure("DoString" is obfuscated). You also can't use the "/use <item>" it wasn't implemented on vanilla. So you need to iterate the items in your bag with lua. I tried this on 3.3.5a but since the used api functions is also present on vanilla, it should also work: public void UseItemByName(string name, bool lootItem = true) { if (lootItem) { Task.Run(async delegate { robotManager.Helpful.Keyboard.DownKey(wManager.Wow.Memory.WowMemory.Memory.WindowHandle, System.Windows.Forms.Keys.ShiftKey); await Task.Delay(2000); robotManager.Helpful.Keyboard.UpKey(wManager.Wow.Memory.WowMemory.Memory.WindowHandle, System.Windows.Forms.Keys.ShiftKey); }); } wManager.Wow.Helpers.Lua.LuaDoString( @" for b=0,4 do for s=1,GetContainerNumSlots(b) do if (string.find(tostring(GetContainerItemLink(b,s) or """"), """+wManager.Wow.Helpers.ItemsManager.GetIdByName(name)+@""" )) then UseContainerItem(b,s, onSelf); end end end " ); } Usage: UseItemByName("Hearthstone", false); or UseItemByName("Heavy Crate", true); Edited August 26, 2017 by reapler altered method Seminko 1 Link to comment Share on other sites More sharing options...
eniac86 21 Posted August 26, 2017 Author Share Posted August 26, 2017 Hey thanks for the help. I discovered 2 weird problems: First the lua does not accept the item name "Big-mouth Clam", if you just write "Clam" or "Big" it will work. Seems to be a problem with the "-", but i don't know how to escape it :( Second the keydown function seems to have no effect. Although if you hold down the shift key manually it works fine and will loot the clams. edit: hm weird. tried some things to get the item name with the "-" working but WoW itself seems to have a problem with it's own item name. Link to comment Share on other sites More sharing options...
reapler 154 Posted August 26, 2017 Share Posted August 26, 2017 (edited) I've changed the keys to press & the string to search. It should work now. The requirements to use it successfully are: Wow.exe on foreground(it can reset the key on window switch) and the item must be in cache. Edited August 26, 2017 by reapler Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now