public static bool LogOutFor(int mins) { if (ObjectManager.InGame) { PeriodicLogoutActive = true; KeyHelper.ChatboxSendText(Logout); } var t = new Ticker(mins * 60000); while (!t.IsReady) { Thread.Sleep(10000); } return(Relog()); }
public static void DoSell(string unit_name) { try { ProtectedList.Load(); MailList.Load(); KeyHelper.ChatboxSendText("/target " + unit_name); Thread.Sleep(0xbb8); if (LazyLib.Wow.ObjectManager.MyPlayer.Target.Name != unit_name) { Logging.Write("Could not target vendor: " + unit_name, new object[0]); } else { KeyHelper.SendKey("InteractTarget"); MouseHelper.Hook(); MailManager.OpenAllBags(); if (LazySettings.ShouldVendor) { Logging.Write("[Vendor]Going to sell items", new object[0]); Sell(); } if (LazySettings.ShouldRepair) { Repair(); } } } finally { MailManager.CloseAllBags(); MouseHelper.ReleaseMouse(); if (SellFinished != null) { SellFinished("VendorEngine", new EventArgs()); } } }
private static void Ress(PUnit vUnit) { MoveHelper.MoveToUnit(vUnit, 2, false); Thread.Sleep(1000); vUnit.InteractOrTarget(false); Thread.Sleep(1000); if (ObjectManager.MyPlayer.Target != vUnit) { vUnit.InteractOrTarget(false); } Thread.Sleep(1000); if (ObjectManager.MyPlayer.Target != vUnit) { vUnit.InteractOrTarget(false); } Thread.Sleep(1000); if (ObjectManager.MyPlayer.Target != vUnit) { MoveHelper.ReleaseKeys(); Thread.Sleep(100); KeyHelper.ChatboxSendText("/target " + vUnit.Name + " ;"); } Thread.Sleep(1000); vUnit.InteractWithTarget(); Thread.Sleep(1600); Frame frameByName = InterfaceHelper.GetFrameByName("StaticPopup1Button1"); frameByName.LeftClick(); var timeout = new Ticker(5000); while (ObjectManager.MyPlayer.IsGhost && !timeout.IsReady) { Thread.Sleep(10); frameByName = InterfaceHelper.GetFrameByName("StaticPopup1Button1"); frameByName.LeftClick(); Thread.Sleep(1000); } }
public static void Monitor() { if (_stopAfter != null) { if (LazySettings.StopAfterBool) { if (_stopAfter.IsReady && !ObjectManager.ShouldDefend) { LazyForms.MainForm.StopBotting(true); LazyForms.MainForm.ShouldRelog = false; Thread.Sleep(3000); Logging.Write(LogType.Info, "[Engine]Stop after " + Convert.ToDouble(LazySettings.StopAfter) + " minuttes done"); KeyHelper.ChatboxSendText("/logout"); if (LazySettings.Shutdown) { Shutdown.ShutDownComputer(); } } } } }
internal static void CheckFollow() { try { if (Engine.Running && Timer.IsReady) { Timer.Reset(); foreach ( PPlayer player in ObjectManager.GetPlayers.Where( player => player.GUID != ObjectManager.MyPlayer.GUID && player.Name != ObjectManager.MyPlayer.Name) ) { if (player.GUID == ObjectManager.MyPlayer.GUID) { continue; } if (player.Name == ObjectManager.MyPlayer.Name) { continue; } if (player.Location.DistanceToSelf < Distance && !FollowersList.ContainsKey(player.GUID)) { Logging.Write("New player around: " + player.Name); FollowersList.Add(player.GUID, Environment.TickCount); } else if (player.Location.DistanceToSelf >= Distance && FollowersList.ContainsKey(player.GUID)) { Logging.Write("Removed player: " + player.Name); FollowersList.Remove(player.GUID); } else if (player.Location.DistanceToSelf < Distance && FollowersList.ContainsKey(player.GUID) && FollowersList[player.GUID] + (Convert.ToInt32(LazySettings.LogOutOnFollowTime) * 60 * 1000) < Environment.TickCount) { FollowersList[player.GUID] = Environment.TickCount; Logging.Write(LogType.Warning, string.Format(player.Name + " has been following me for {0} minutes !", LazySettings.LogOutOnFollowTime)); if (LazySettings.SoundFollow) { PlayerSound(); } if (LazySettings.LogoutOnFollow) { LazyForms.MainForm.StopBotting(true); Thread.Sleep(3000); KeyHelper.ChatboxSendText("/logout"); break; } } } } } catch { } }
private static void Run() { try { while (Running) { try { if (Paused) { _engine.Pause(); while (Paused) { Thread.Sleep(100); } _engine.Resume(); } while (ChatQueu.QueueCount != 0) { _engine.Pause(); KeyHelper.ChatboxSendText(ChatQueu.GetItem); Thread.Sleep(100); _engine.Resume(); } foreach (MainState state in States.Where(state => state.NeedToRun)) { if (LastState != state) { if (StateChange != null) { StateChange(new object(), new NotifyStateChanged(state.Name())); Logging.Debug("State changed: " + state.Name()); } } state.DoWork(); LastState = state; break; } } catch (ThreadAbortException) { } catch (ThreadStateException h) { Logging.Write("Thread in odd state, restarting: " + h); } catch (Exception e) { if (ObjectManager.InGame) { Logging.Write("[Engine] Exception " + e); } Thread.Sleep(4000); } Thread.Sleep(1); Application.DoEvents(); } } catch (ThreadAbortException) { } catch (Exception e) { Logging.Write("[Engine]Botting error: " + e); } finally { Running = false; } }