October 2, 20241 yr 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, 20241 yr by Elexir error
October 11, 20241 yr 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() { } }
Create an account or sign in to comment