using robotManager.Helpful;
using wManager.Wow.Helpers;
using wManager.Plugin;
using Timer = System.Threading.Timer;
public class Main : IPlugin
{
private bool _isEnabled;
public void Initialize()
{
Logging.Write("[JunkRemover] Plugin initialized and activated");
_isEnabled = true;
EventsLua.AttachEventLua("BAG_UPDATE", context => BagUpdateHandler());
}
public void Dispose()
{
_isEnabled = false;
Logging.Write("[JunkRemover] Plugin disposed");
}
private Timer _debounceTimer;
private void BagUpdateHandler()
{
Logging.Write("[JunkRemover] BAG_UPDATE");
if (_debounceTimer != null)
{
_debounceTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
_debounceTimer.Dispose();
}
_debounceTimer = new Timer((state) =>
{
if (_isEnabled)
{
Logging.Write("[JunkRemover] Checking bags for junk");
var needToRunAgain = Lua.LuaDoString<bool>(@"
for i = 0, NUM_BAG_SLOTS do
for j = 1, C_Container.GetContainerNumSlots(i) do
local itemId = C_Container.GetContainerItemID(i, j)
if itemId then
local itemName, _, itemQuality = GetItemInfo(C_Container.GetContainerItemID(i, j))
if itemName and itemQuality == 0 then
print('Deleting ' .. itemName)
C_Container.PickupContainerItem(i, j)
DeleteCursorItem()
return true
end
end
end
end
return false
");
if (needToRunAgain)
{
BagUpdateHandler();
}
}
}, null, 1000, System.Threading.Timeout.Infinite);
}
public void Settings()
{
}
}
JunkRemover.cs
I'm excited to start another year and look forward to continuing to serve you with WRobot.
This year marks a special milestone for us as we celebrate the 10-year anniversary of WRobot.
I'm grateful for your support and look forward to many more years of success together.
Thank you for choosing WRobot, and I hope you have a happy, healthy, and prosperous new year!