public static void MoveBackward(bool start, bool redo = false) { if (start && !UseLUAToMove) { CloseChatFrameEditBox(); } if (UseLUAToMove) { Lua.LuaDoString(start ? "MoveBackwardStart();" : "MoveBackwardStop();"); } else { if (start) { Keybindings.DownKeybindings(Enums.Keybindings.MOVEBACKWARD); } else { Keybindings.UpKeybindings(Enums.Keybindings.MOVEBACKWARD); } } if (redo) { MoveBackward(!start); } }
public static void UpdateLastHardwareAction() { if (Memory.WowMemory.IsGameFrameLocked || !_lastHardwareActionDone || !InGame || IsLoading) { return; } _lastHardwareActionDone = false; // The below Memory Write update LastHardwareAction with the current WoW.GetTime(). // However, it wont get you out of AFK Status if you was already AFK upon starting TheNoobBot. // To remove the AFK Status, you need to call CGGameUI__UpdatePlayerAFK right after updating LastHardwareAction. // Memory.WowMemory.Memory.WriteUInt(Memory.WowProcess.WowModule + (uint)Addresses.GameInfo.LastHardwareAction, Memory.WowProcess.WowModule + (uint)Addresses.GameInfo.GetTime); // The below code use LUA to get a key that is not binded in World of Warcraft. // It will then press it and let WoW handle the "LastHardwareAction + UpdatePlayerAFK" task at once. if (String.IsNullOrEmpty(AfkKeyPress) || AfkKeyPress == "B") { Thread.Sleep(10); AfkKeyPress = Keybindings.GetAFreeKey(true); AfkTimer.Reset(); } if (!AfkTimer.IsReady) { _lastHardwareActionDone = true; return; } Keyboard.DownKey(Memory.WowProcess.MainWindowHandle, AfkKeyPress); Thread.Sleep(10); Keyboard.UpKey(Memory.WowProcess.MainWindowHandle, AfkKeyPress); AfkTimer.Reset(); _lastHardwareActionDone = true; }
public static void Descend(bool start, bool redo = false, bool forceLUA = false) { if (start && !UseLUAToMove) { CloseChatFrameEditBox(); } if (UseLUAToMove || forceLUA) { Lua.LuaDoString(start ? "SitStandOrDescendStart();" : "DescendStop();"); } else { if (start) { Keybindings.DownKeybindings(Enums.Keybindings.SITORSTAND); } else { Keybindings.UpKeybindings(Enums.Keybindings.SITORSTAND); } } if (redo) { Descend(!start); } }
public static void Ascend(bool start, bool redo = false, bool forceLUA = false) { if (start && !UseLUAToMove) { CloseChatFrameEditBox(); } if (UseLUAToMove || forceLUA) { Lua.LuaDoString(start ? "JumpOrAscendStart();" : "AscendStop();"); } else { if (start) { Keybindings.DownKeybindings(Enums.Keybindings.JUMP); } else { Keybindings.UpKeybindings(Enums.Keybindings.JUMP); } } if (redo) { Ascend(!start); } }
public static void StrafeRight(bool start, bool redo = false) { if (start && !UseLUAToMove) { CloseChatFrameEditBox(); } if (UseLUAToMove) { Lua.LuaDoString(start ? "StrafeRightStart();" : "StrafeRightStop();"); } else { if (start) { Keybindings.DownKeybindings(Enums.Keybindings.STRAFERIGHT); } else { Keybindings.UpKeybindings(Enums.Keybindings.STRAFERIGHT); } } if (redo) { StrafeRight(!start); } }
public static void LaunchSpellById(UInt32 spellId) { try { string slotKeySpell = GetSlotBarBySpellId(spellId); if (slotKeySpell == "") { UInt32 spellIdTemps = Memory.WowMemory.Memory.ReadUInt(Memory.WowProcess.WowModule + (uint)Addresses.BarManager.startBar); Memory.WowMemory.Memory.WriteUInt( Memory.WowProcess.WowModule + (uint)Addresses.BarManager.startBar, spellId); Keybindings.PressBarAndSlotKey("1;1"); Memory.WowMemory.Memory.WriteUInt( Memory.WowProcess.WowModule + (uint)Addresses.BarManager.startBar, spellIdTemps); } else { Keybindings.PressBarAndSlotKey(slotKeySpell); } } catch (Exception exception) { Logging.WriteError("LaunchSpellById(UInt32 spellId): " + exception); } }
public override void GCDCycle() { if (ObjectManager.Target.IsValid && !ObjectManager.Target.IsDead && !ObjectManager.Me.HaveBuff(212096)) { if (FireBallCastTimer.IsReady && MeteorStormTimer.IsReady && MeteorStorm.IsHostileDistanceGood) { KeybindingsHelper.PressKeybindings(KeybindingsEnum.ACTIONBUTTON2); MeteorStormTimer = new Timer(1000 * 10 + 100); return; } if (FireBallCastTimer.IsReady && Fireball.IsHostileDistanceGood) { KeybindingsHelper.PressKeybindings(KeybindingsEnum.ACTIONBUTTON1); FireBallCastTimer = new Timer(1000); FacingTimer = new Timer(500); return; } // Try to face the mob // TODO: Improve this if (FacingTimer.IsReady && !FireBallCastTimer.IsReady && !ObjectManager.Me.IsCast && !CurrentVehicle.IsCast) { List <Point> facingPoints = new List <Point> { new Point(ObjectManager.Me.Position.X + 1.2f, ObjectManager.Me.Position.Y, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X + 0.9f, ObjectManager.Me.Position.Y + 0.3f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X + 0.9f, ObjectManager.Me.Position.Y + 0.3f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X + 0.6f, ObjectManager.Me.Position.Y + 0.6f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X + 0.3f, ObjectManager.Me.Position.Y + 0.9f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X, ObjectManager.Me.Position.Y + 1.2f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X - 1.2f, ObjectManager.Me.Position.Y, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X - 0.9f, ObjectManager.Me.Position.Y - 0.3f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X - 0.9f, ObjectManager.Me.Position.Y - 0.3f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X - 0.6f, ObjectManager.Me.Position.Y - 0.6f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X - 0.3f, ObjectManager.Me.Position.Y - 0.9f, ObjectManager.Me.Position.Z), new Point(ObjectManager.Me.Position.X, ObjectManager.Me.Position.Y - 1.2f, ObjectManager.Me.Position.Z) }; MovementManager.Go(new List <Point> { ObjectManager.Me.Position, facingPoints[NextFacingPoint] }); FacingTimer = new Timer(1000); FireBallCastTimer = new Timer(0); NextFacingPoint = ++NextFacingPoint >= facingPoints.Count ? 0 : NextFacingPoint; return; } } }
public static void LaunchSpellByName(string spellName) { try { string slotKeySpell = GetSlotBarBySpellName(spellName); if (slotKeySpell == "") { CastSpellByNameLUA(spellName); } else { Keybindings.PressBarAndSlotKey(slotKeySpell); } } catch (Exception exception) { Logging.WriteError("LaunchSpellByName(string spellName): " + exception); } }