Elexir 0 Posted October 2 Share Posted October 2 (edited) Hello, I need to sell more quickly my items from my bag at the hv the idea seemed simple to me basically if I want create a plugin to automatically sell all the green objects at 10 gold at the hv I tested this code but This doesn't work: using System.Threading.Tasks; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; using wManager.Wow.Enums; using wManager.Events; public class AutoSellGreenItems : wManager.Plugin.Plugin { public override void Initialize() { LuaEvents.OnEventsLuaStringWithArgs += OnAuctionHouseShow; } public void OnAuctionHouseShow(string eventName, List<string> args) { if (eventName == "AUCTION_HOUSE_SHOW") { Task.Run(async () => { await Task.Delay(5000); SellGreenItems(); }); } } public void SellGreenItems() { foreach (WoWItem item in Bag.GetBagItems()) { if (item.Quality == WoWItemQuality.Green) { Lua.LuaDoString($@" local bag = {item.BagIndex} local slot = {item.Slot} PickupContainerItem(bag, slot); StartAuction(50000, 50000, 12, 1);"); } } } public override void Dispose() { LuaEvents.OnEventsLuaStringWithArgs -= OnAuctionHouseShow; } } if you could guide me on my errors I would be grateful, thank you in advance! Edited October 5 by Elexir error Link to comment Share on other sites More sharing options...
Droidz 2737 Posted October 11 Share Posted October 11 Hello, Your code can't work it doesn't have the good structure. Here is some code with a correct structure (although I don't think it works, it would need to be debugged): using System.Collections.Generic; using System.Threading; using robotManager.Helpful; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; using wManager.Wow.Enums; public class Main : wManager.Plugin.IPlugin { public void Initialize() { EventsLuaWithArgs.OnEventsLuaStringWithArgs += OnAuctionHouseShow; } private void OnAuctionHouseShow(string eventName, List<string> args) { if (eventName == "AUCTION_HOUSE_SHOW") { Logging.WriteDebug("Auction House is open"); Thread.Sleep(5000); SellGreenItems(); } } public void SellGreenItems() { foreach (WoWItem item in Bag.GetBagItem()) { if (item.GetItemInfo.ItemRarity == (int)WoWItemQuality.Uncommon) { Logging.WriteDebug($"Selling {item.Name}"); Bag.PickupContainerItem(item.Name); Thread.Sleep(1500); AuctionHelpers.StartAuction(50000, 50000, AuctionHelpers.Duration._12H, 1, 1); //Lua.LuaDoString($@"StartAuction(50000, 50000, 12, 1);"); } } } public void Dispose() { EventsLuaWithArgs.OnEventsLuaStringWithArgs -= OnAuctionHouseShow; } public void Settings() { } } TechMecca 1 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