using System; using System.ComponentModel; using System.Threading; using robotManager.Helpful; using robotManager.Products; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; public class Main : wManager.Plugin.IPlugin { private bool isRunning; private BackgroundWorker pulseThread; private static WoWLocalPlayer Me = ObjectManager.Me; public uint[] HealthStone = new uint[] { 5510, 5511, 5512, 9421, 19004, 19005, 19006, 19007, 5509, 19008, 19009, 19010, 19011, 19012, 19013 }; public uint[] SoulStone = new uint[] { 5232, 16892, 16893, 16895, 16896}; public void Start() { pulseThread = new BackgroundWorker(); pulseThread.DoWork += Pulse; pulseThread.RunWorkerAsync(); } public void Pulse(object sender, DoWorkEventArgs args) { try { while (isRunning) { if (!Products.InPause && Products.IsStarted) { if (ObjectManager.Me.HealthPercent < 50 && !ObjectManager.Me.IsDead) { foreach (uint HSID in HealthStone) { int i = Convert.ToInt32(HSID); if (ItemsManager.HasItemById(HSID) && !(Bag.GetContainerItemCooldown(i) > 0)) { ItemsManager.UseItem(HSID); Logging.WriteDebug("Warlock Helper DEBUG: Used Healthstone: " + HSID); Thread.Sleep(1000); } } } if (!ObjectManager.Me.IsDead && !ObjectManager.Me.HaveBuff(20764)) { foreach (uint SSID in SoulStone) { int s = Convert.ToInt32(SSID); if (ItemsManager.HasItemById(SSID) && !(Bag.GetContainerItemCooldown(s) > 0)) { ItemsManager.UseItem(SSID); Logging.WriteDebug("Warlock Helper DEBUG: Used SoulStone: " + SSID); Thread.Sleep(1000); } } } } } } catch (Exception ex) { Logging.WriteError("Warlock Helper ERROR: " + ex); } } public void Dispose() { isRunning = false; } public void Initialize() { isRunning = true; EventsLua.AttachEventLua((LuaEventsId)Enum.Parse(typeof(LuaEventsId), "PLAYER_DEAD"), m => { Logging.WriteDebug("Checking for buff"); if (ObjectManager.Me.HaveBuff("Soulstone Resurrection")) { Logging.WriteDebug("Goddamn we're dead and we have that buff! Trying to click on it"); while (ObjectManager.Me.IsDead) { Thread.Sleep(3000); Logging.WriteDebug("Warlock Helper DEBUG: Clicking the button"); Lua.LuaDoString("StaticPopup1Button2:Click()"); Thread.Sleep(500); } } }); Start(); } public void Settings() { // settings go here. Remember to check for settings file if it doesn't exist then create it on Initialize otherwise load and save on dispose! } }