public void Move(WoWMovement.MovementDirection direction) { }
protected override Composite CreateBehavior() { return(_root ?? (_root = new Decorator(ret => !_isDone, new PrioritySelector( new Decorator(ret => IsQuestComplete(), new PrioritySelector( new Decorator(ret => Me.IsOnTransport, new Action(delegate { DLog("Quest complete - cancelling Flame Ascendancy"); Lua.DoString("VehicleExit()"); StyxWoW.SleepForLagDuration(); return RunStatus.Success; }) ), new Action(delegate { _isDone = true; StyxWoW.SleepForLagDuration(); return RunStatus.Success; }) ) ), // loop waiting for target only if no buff new Decorator(ret => Target == null, new Action(delegate { StyxWoW.SleepForLagDuration(); return RunStatus.Success; }) ), // loop waiting for CurrentTarget only if no buff new Decorator(ret => Target != Me.CurrentTarget, new Action(delegate { WoWUnit target = Target; target.Target(); StyxWoW.SleepForLagDuration(); return RunStatus.Success; }) ), // use item to get buff (enter vehicle) new Decorator(ret => !Me.IsOnTransport, new Action(delegate { WoWItem item = ObjectManager.GetObjectsOfType <WoWItem>().FirstOrDefault(i => i != null && i.Entry == 42481); if (item == null) { Log("ERROR - quest item Talisman of Flame Ascendancy not in inventory"); TreeRoot.Stop(); } Log("Use: {0}", item.Name); item.Use(true); StyxWoW.SleepForLagDuration(); return RunStatus.Success; }) ), new Decorator(ret => Target.Distance > 5, new Action(delegate { DLog("Moving towards target"); Navigator.MoveTo(Target.Location); return RunStatus.Success; }) ), new Decorator(ret => Target.Distance <= 5 && Me.IsMoving, new Action(delegate { DLog("At target, so stopping"); WoWMovement.MoveStop(); return RunStatus.Success; }) ), new Decorator(ret => !StyxWoW.GlobalCooldown && !Blacklist.Contains(2), new Action(delegate { Log("Cast Flame Shield"); Lua.DoString("RunMacroText(\"/click BonusActionButton4\")"); Blacklist.Add(2, TimeSpan.FromMilliseconds(8000)); return RunStatus.Success; }) ), new Decorator(ret => !StyxWoW.GlobalCooldown && !Blacklist.Contains(1), new Action(delegate { Log("Cast Attack"); Lua.DoString("RunMacroText(\"/click BonusActionButton1\")"); Blacklist.Add(1, TimeSpan.FromMilliseconds(1500)); return RunStatus.Success; }) ), new Action(delegate { DLog("Waiting for Cooldown"); return lastStateReturn; }) ) ) )); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(c => (Counter > NumOfTimes) || Me.IsQuestComplete(QuestId), new Action(c => { TreeRoot.StatusText = "Finished!"; if (GoHomeButton > 0) { Lua.DoString("CastPetAction({0})", GoHomeButton); } _isBehaviorDone = true; return RunStatus.Success; }) ), // Enable combat while not in a vehicle new Decorator(ctx => (LevelBot.BehaviorFlags & BehaviorFlags.Combat) == 0 && !Query.IsInVehicle(), new Action(ctx => LevelBot.BehaviorFlags |= BehaviorFlags.Combat)), // Disable combat while in a vehicle new Decorator(ctx => (LevelBot.BehaviorFlags & BehaviorFlags.Combat) != 0 && Query.IsInVehicle(), new Action(ctx => LevelBot.BehaviorFlags &= ~BehaviorFlags.Combat)), new Decorator(c => NpcVehicleList.Any() && !Query.IsInVehicle(), new Action(c => { if (!NpcVehicleList[0].WithinInteractRange) { Navigator.MoveTo(NpcVehicleList[0].Location); TreeRoot.StatusText = "Moving To Vehicle - " + NpcVehicleList[0].SafeName + " Yards Away: " + NpcVehicleList[0].Location.Distance(Me.Location); } else { NpcVehicleList[0].Interact(); MountedPoint = Me.Location; } }) ), new Decorator(c => SpellType == 1, new ActionRunCoroutine(ctx => TypeOneVehicleBehavior())), new Decorator(c => SpellType == 2, new ActionRunCoroutine(ctx => TypeTwoVehicleBehavior())), new Decorator(c => Query.IsInVehicle() && SpellType == 3, new PrioritySelector( ret => NpcList.OrderBy(u => u.DistanceSqr).FirstOrDefault(u => Me.Transport.IsSafelyFacing(u)), new Decorator( ret => ret != null, new PrioritySelector( new Decorator( ret => Me.CurrentTarget == null || Me.CurrentTarget != (WoWUnit)ret, new Action(ret => ((WoWUnit)ret).Target())), new Decorator( ret => !Me.Transport.IsSafelyFacing(((WoWUnit)ret), 10), new Action(ret => Me.CurrentTarget.Face())), new Sequence( new Action( ctx => { Vector3 v = Vector3.Normalize(Me.CurrentTarget.Location - StyxWoW.Me.Location); Lua.DoString( string.Format( "local pitch = {0}; local delta = pitch - VehicleAimGetAngle(); VehicleAimIncrement(delta); CastPetAction({1});", Math.Asin(v.Z).ToString(CultureInfo.InvariantCulture), AttackButton)); }), new Sleep(WaitTime), new Action(ctx => Counter++)))))), new Decorator(c => SpellType == 4, new Action(c => { if (!Query.IsInVehicle()) { return RunStatus.Failure; } if (Counter > NumOfTimes && QuestId == 0 || Me.IsQuestComplete(QuestId)) { Lua.DoString("VehicleExit()"); _isBehaviorDone = true; return RunStatus.Success; } var target = NpcList.FirstOrDefault(); if (target != null) { if (Me.CurrentTargetGuid != target.Guid) { target.Target(); } WoWMovement.ClickToMove(target.Location); Lua.DoString("CastPetAction({0})", AttackButton); SpellManager.ClickRemoteLocation(target.Location); Counter++; } return RunStatus.Running; })), new Decorator(c => SpellType == 5, new Action(c => { if (!Query.IsInVehicle()) { return RunStatus.Failure; } if (Counter > NumOfTimes && QuestId == 0 || Me.IsQuestComplete(QuestId)) { Lua.DoString("VehicleExit()"); _isBehaviorDone = true; return RunStatus.Success; } var target = NpcList.FirstOrDefault(); if (target != null) { if (Me.CurrentTargetGuid != target.Guid) { target.Target(); } WoWMovement.ConstantFace(Me.CurrentTargetGuid); Lua.DoString("CastPetAction({0})", AttackButton); if (QuestId == 0) { Counter++; } } var target2 = NpcListSecondary.FirstOrDefault(); if (target2 != null) { if (Me.CurrentTargetGuid != target2.Guid) { target2.Target(); } WoWMovement.ConstantFace(Me.CurrentTargetGuid); Lua.DoString("CastPetAction({0})", AttackButton); if (QuestId == 0) { Counter++; } } Lua.DoString("CastPetAction({0})", AttackButton2); return RunStatus.Running; })) ))); }
public override void Combat() { isPulling = false; _combatLoop.Reset(); _combatLoop.Start(); if (_settings.showDebug) { slog("Starting Combat Loop!"); } try { if (Battlegrounds.IsInsideBattleground) { if (Me.GotTarget && Me.CurrentTarget.IsPet) { Blacklist.Add(Me.CurrentTarget, TimeSpan.FromDays(1)); Me.ClearTarget(); return; } } #region bugged mobs if (Me.GotTarget && (!fightTimer.IsRunning || Me.CurrentTarget.Guid != lastGuid)) { fightTimer.Reset(); fightTimer.Start(); lastGuid = Me.CurrentTarget.Guid; slog("Killing " + Me.CurrentTarget.Name + " at distance " + System.Math.Round(targetDistance).ToString() + "."); } if (Me.GotTarget && !Me.CurrentTarget.IsPlayer && fightTimer.ElapsedMilliseconds > 25 * 1000 && Me.CurrentTarget.HealthPercent > 95) { slog(" This " + Me.CurrentTarget.Name + " is a bugged mob. Blacklisting for 1 hour."); Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromHours(1.00)); Me.ClearTarget(); Styx.Helpers.KeyboardManager.PressKey('S'); Thread.Sleep(5 * 1000); Styx.Helpers.KeyboardManager.ReleaseKey('S'); Me.ClearTarget(); lastGuid = 0; return; } #endregion DotEmUp(); // Thanks to CodeNameG SmartTarget(); // TM :P if (Me.GotTarget) { if (isTotem) { slog("Killing totem {0}", Me.CurrentTarget.Name); KillTotem(); // Thread.Sleep(_settings.myLag); } } else { _combatLoop.Stop(); if (_settings.showDebug) { slog("Exiting Combat Loop (NoTarget)! Duration {0}ms", _combatLoop.ElapsedMilliseconds); } return; } //Thread.Sleep(_settings.myLag); if (Me.GotAlivePet) { if (Me.GotTarget && Me.CurrentTarget.CurrentTargetGuid == Me.Guid) { Lua.DoString("PetAttack()"); slog("Target is attacking me, calling {0} to get aggro", Me.Pet.Name); } Lua.DoString("PetAttack()"); } followTimer.Reset(); followTimer.Start(); while (targetDistance > shadowRange + 2) { slog("{0} yard from {1}.", System.Math.Round(targetDistance).ToString(), Me.CurrentTarget.Name); Navigator.MoveTo(attackPoint); //WoWMovement.ClickToMove(Me.CurrentTarget.Location, (float)shadowRange); Thread.Sleep(_settings.myLag); if (followTimer.ElapsedMilliseconds > 20000 && Me.CurrentTarget.IsPlayer) { followTimer.Stop(); slog("Followed for more than 20 secs!"); Me.ClearTarget(); Lua.DoString("PetFollow()"); return; } } followTimer.Stop(); CheckSummon(); while (Me.IsCasting) { Thread.Sleep(_settings.myLag); } if (Me.GotTarget) { CombatDecision(); } if (targetDistance <= 4 && !Me.IsCasting) { WoWMovement.Face(); Thread.Sleep(_settings.myLag); if (!Me.IsAutoAttacking) { Lua.DoString("StartAttack()"); } } } catch (Exception ex) { if (_settings.showDebug) { slog(ex.Source); slog(ex.Message); slog(ex.StackTrace); } } _combatLoop.Stop(); if (_settings.showDebug) { slog("Exiting Combat Loop! Duration {0}ms", _combatLoop.ElapsedMilliseconds); } }
public static void CTM(double x, double y, double z) { WoWMovement.ClickToMove(new WoWPoint(x, y, z)); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new Decorator(ret => !IsDone && (!AllowCombat || !Me.Combat), new PrioritySelector( new Decorator(ret => !Path.Any() && Counter >= NumOfTimes, new Action(delegate { _isBehaviorDone = true; })), new Decorator(ret => !Path.Any(), new Action(delegate { Counter++; ParsePath(); })), new Decorator(ret => Path.Peek().Distance(Me.Location) <= Navigator.PathPrecision, new PrioritySelector( new Decorator(ret => Me.IsMoving && WaitTime > 0, new Action(delegate { WoWMovement.MoveStop(); TreeRoot.GoalText = "RunLikeHell pausing " + WaitTime + " ms"; System.Threading.Thread.Sleep(WaitTime); })), new Decorator(ret => MobId != 0 && Mob.Distance > Range, new Action(delegate { TreeRoot.GoalText = "RunLikeHell wait for " + Mob.Name + " within " + Range + " yds"; })), new Action(delegate { Path.Dequeue(); })) ), new Action(delegate { if (NumOfTimes > 1) { TreeRoot.GoalText = "RunLikeHell[Lap " + Counter + "] to " + Path.Peek().ToString(); } else { TreeRoot.GoalText = "RunLikeHell to " + Path.Peek().ToString(); } if (UseCTM) { WoWMovement.ClickToMove(Path.Peek()); } else { Navigator.MoveTo(Path.Peek()); } return _lastStateReturn; }) ) ) )); }
private Composite CreateRootBehavior() { return(new PrioritySelector( new Decorator( ret => !IsDone && StyxWoW.Me.IsAlive, new PrioritySelector( new Decorator(ret => Counter > NumOfTimes && QuestId == 0, new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isBehaviorDone = true; return RunStatus.Success; })) )), new Decorator(ret => MobList.Count > 0 && !Me.IsCasting && SpellManager.CanCast(SpellId), new Sequence( new DecoratorContinue(ret => MobList[0].Location.Distance(Me.Location) >= MinRange && MobList[0].Location.Distance(Me.Location) <= Range && MobList[0].InLineOfSightOCD, new Sequence( new Action(ret => TreeRoot.StatusText = "Casting Spell - " + SpellId + " On Mob: " + MobList[0].Name + " Yards Away " + MobList[0].Location.Distance(Me.Location)), new Action(ret => WoWMovement.MoveStop()), new Action(ret => Thread.Sleep(300)), new Decorator(c => !Me.IsCasting, CreateSpellBehavior) ) ), new DecoratorContinue(ret => MobList[0].Location.Distance(Me.Location) > Range || !MobList[0].InLineOfSightOCD, new Sequence( new Action(ret => TreeRoot.StatusText = "Moving To Mob - " + MobList[0].Name + " Yards Away: " + MobList[0].Location.Distance(Me.Location)), new Action(ret => Navigator.MoveTo(MobList[0].Location)) ) ), new DecoratorContinue(ret => MobList[0].Location.Distance(Me.Location) < MinRange, new Sequence( new Action(ret => TreeRoot.StatusText = "Too Close, Backing Up"), new Action(ret => MobList[0].Face()), new Action(ret => Thread.Sleep(100)), new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Backwards)), new Action(ret => Thread.Sleep(2000)), new Action(ret => WoWMovement.MoveStop(WoWMovement.MovementDirection.Backwards)) )) )) )))); }
public void findAndKillDormus() { bool CastSuccess = false; if (Rarekiller.Settings.DeveloperLogs) { Logging.WriteDebug("Rarekiller: Scan for Dormus"); } ObjectManager.Update(); List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(o => ((o.Entry == 50245) || ((o.Entry == 47755) && Rarekiller.Settings.TestKillDormus) //Testcase Warlord Ihsenn )) .OrderBy(o => o.Distance).ToList(); foreach (WoWUnit o in objList) { if (!o.Dead) { Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller Part Dormus: Find Dormus."); if (Rarekiller.Settings.Alert) { if (File.Exists(Rarekiller.Settings.SoundfileFoundRare)) { new SoundPlayer(Rarekiller.Settings.SoundfileFoundRare).Play(); } else if (File.Exists(Rarekiller.Soundfile)) { new SoundPlayer(Rarekiller.Soundfile).Play(); } else { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Dormus: playing Soundfile failes"); } } if (RoutineManager.Current.NeedRest) { Logging.Write("Rarekiller Part Dormus: CC says we need rest - Letting it do it before Fight."); RoutineManager.Current.Rest(); } if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } o.Target(); Thread.Sleep(500); while (!Rarekiller.inCombat) { // ------------- Move to Dormus with Klick to Move ------------------- Logging.Write("Rarekiller Part Dormus: Move to Dormus"); while (Me.IsSwimming) { WoWMovement.ClickToMove(o.Location); } WoWMovement.MoveStop(); while (o.Location.Distance(Me.Location) > Convert.ToInt64(Rarekiller.Settings.Range)) { if (Rarekiller.Settings.GroundMountMode) { Navigator.MoveTo(o.Location); } else { Flightor.MoveTo(o.Location); } Thread.Sleep(100); } WoWMovement.MoveStop(); // ------------- pull Dormus ------------------- Logging.WriteDebug("Rarekiller Part Dormus: Distance: {0}", o.Location.Distance(Me.Location)); o.Target(); o.Face(); Thread.Sleep(100); if (Rarekiller.Settings.ScreenCamel && Rarekiller.Settings.ScreenFound) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(500); Logging.WriteDebug("Rarekiller Part Dormus: Take Screenshot before Pull"); } if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, o, true); } else if (SpellManager.HasSpell(Rarekiller.Spells.LowPullspell)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.LowPullspell, o, true); } else { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Dormus: I have no Pullspell"); } if (!CastSuccess && SpellManager.HasSpell("Shoot")) { CastSuccess = RarekillerSpells.CastSafe("Shoot", o, true); } if (CastSuccess) { Logging.Write("Rarekiller Part Dormus: successfully pulled Dormus"); Logging.WriteDebug("Rarekiller Part Dormus: Pull Distance: {0}", o.Location.Distance(Me.Location)); return; } else if (!CastSuccess && Rarekiller.inCombat) { Logging.Write("Rarekiller Part Dormus: got Aggro"); } else { Logging.Write("Rarekiller Part Dormus: Pull Fails - Set Range to 3 for next try"); Rarekiller.Settings.Range = "3"; } } } else { Logging.Write("Rarekiller Part Dormus: Find {0}, but he's dead", o.Name); // ----------------- Loot Helper --------------------- if (o.CanLoot) { if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } o.Target(); // ------------- Move to Corpse with Klick to Move ------------------- Logging.Write("Rarekiller Part Dormus: ... move to him to loot"); while (o.Location.Distance(Me.Location) > 3) { Navigator.MoveTo(o.Location); Thread.Sleep(100); } Thread.Sleep(500); WoWMovement.MoveStop(); if (Rarekiller.Settings.ScreenCamel && Rarekiller.Settings.ScreenSuccess) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(500); Logging.WriteDebug("Rarekiller Part Dormus: Take Screenshot successfully killed {0}", o.Name); } o.Interact(); Thread.Sleep(2000); Lua.DoString("RunMacroText(\"/click StaticPopup1Button1\");"); Thread.Sleep(4000); if (!o.CanLoot) { Logging.Write("Rarekiller Part Dormus: successfuly looted"); } else { Logging.Write("Rarekiller Part Dormus: Loot failed, try again"); } } } } }
public void findAndPickupObject() { bool CastSuccess = false; bool ForceGround = false; bool FirstTry = true; if (Rarekiller.Settings.DeveloperLogs) { Logging.WriteDebug("Rarekiller: Scan for Camel Figurine"); } ObjectManager.Update(); List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(o => ((o.Entry == 50409) || (o.Entry == 50410) || // 50409 might be the porting Camel Figurine ((o.Entry == 48959) && Rarekiller.Settings.TestFigurineInteract) //Testcase rostiger Amboss - Schnotzz Landing )) .OrderBy(o => o.Distance).ToList(); foreach (WoWUnit o in objList) { if (!Blacklist.Contains(o.Guid)) { Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller Part Camel: Find {0} ID {1}", o.Name, o.Entry); if (Rarekiller.inCombat) { Logging.WriteDebug("Rarekiller Part Camel: ... but first I have to finish fighting another Mob."); return; } if (Me.IsOnTransport) { Logging.WriteDebug("Rarekiller Part Camel: ... but I'm on a Transport."); return; } while (Me.IsCasting) { Thread.Sleep(100); } if (Rarekiller.Settings.WispersForBuddyCenter) { Lua.DoString(string.Format("RunMacroText(\"/w {0} found {1}, ID {2}\")", Me.Name, o.Name, o.Entry), 0); } if (Rarekiller.Settings.Alert) { if (File.Exists(Rarekiller.Settings.SoundfileFoundRare)) { new SoundPlayer(Rarekiller.Settings.SoundfileFoundRare).Play(); } else if (File.Exists(Rarekiller.Soundfile)) { new SoundPlayer(Rarekiller.Soundfile).Play(); } else { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Camel: playing Soundfile failes"); } } if (Me.IsFlying && ((o.Location.Distance(ProblemCamel1) < 10) || (o.Location.Distance(ProblemCamel2) < 10) || (o.Location.Distance(ProblemCamel3) < 10) || (o.Location.Distance(ProblemCamel4) < 20))) { Logging.Write("Rarekiller Part MoveTo: Found a Problem Figurine {0} so dismount and walk", o.Entry); while (o.Location.Distance(Me.Location) > 30) { if (Rarekiller.Settings.GroundMountMode || ForceGround) { Navigator.MoveTo(o.Location); } else { Flightor.MoveTo(o.Location); } Thread.Sleep(100); if (Rarekiller.inCombat) { return; } } WoWMovement.MoveStop(); Thread.Sleep(1000); //Descend to Land WoWMovement.Move(WoWMovement.MovementDirection.Descend); Thread.Sleep(2000); WoWMovement.MoveStop(); //Dismount if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } Thread.Sleep(300); ForceGround = true; FirstTry = false; } Logging.Write("Rarekiller Part MoveTo: Move to target"); BlacklistTimer.Reset(); BlacklistTimer.Start(); Place = Me.ZoneId; while (o.Location.Distance(Me.Location) > 4) { if (Rarekiller.Settings.GroundMountMode || ForceGround) { Navigator.MoveTo(o.Location); } else { Flightor.MoveTo(o.Location); } Thread.Sleep(100); if (Rarekiller.inCombat) { return; } if (BlacklistTimer.Elapsed.TotalSeconds > 10 && FirstTry) { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Camel: Can't reach Figurine {0} so dismount and walk", o.Entry); WoWMovement.MoveStop(); Thread.Sleep(1000); //Descend to Land WoWMovement.Move(WoWMovement.MovementDirection.Descend); Thread.Sleep(2000); WoWMovement.MoveStop(); //Walk some Meters to avoid standing on a Tent WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft); Thread.Sleep(500); WoWMovement.MoveStop(); Thread.Sleep(1000); //Dismount if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } Thread.Sleep(300); ForceGround = true; FirstTry = false; BlacklistTimer.Reset(); BlacklistTimer.Start(); } if (Rarekiller.Settings.BlacklistCheck && !FirstTry && (BlacklistTimer.Elapsed.TotalSeconds > (Convert.ToInt32(Rarekiller.Settings.BlacklistTime)))) { Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Camel: Blacklist Figurine for 15 Minutes."); BlacklistTimer.Reset(); WoWMovement.MoveStop(); return; } if (Rarekiller.Settings.ZoneSave && (Me.ZoneId != Place)) { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part MoveTo: Left Zone while move to {0} is not allowed", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Figurine for 5 Minutes."); BlacklistTimer.Reset(); WoWMovement.MoveStop(); return; } } BlacklistTimer.Reset(); Thread.Sleep(500); WoWMovement.MoveStop(); Logging.WriteDebug("Rarekiller Part Camel: Figurine Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z)); Logging.WriteDebug("Rarekiller Part Camel: My Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z)); if (Rarekiller.Settings.ScreenCamel && Rarekiller.Settings.ScreenFound) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(500); Logging.WriteDebug("Rarekiller Part Camel: Take Screenshot before Interact"); } if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } Thread.Sleep(500); o.Interact(); Thread.Sleep(10000); if (o.Entry == 50410) { o.Interact(); } Logging.Write("Rarekiller Part Camel: Interact with Figurine - ID {0}", o.Entry); ForceGround = false; FirstTry = true; if (o.Entry == 50410 && Rarekiller.Settings.Collect) { Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Camel: Blacklist Figurine for 15 Minutes."); } } } }
public static void PickUpBOETreasure() { ObjectManager.Update(); List <WoWGameObject> objList = ObjectManager.GetObjectsOfType <WoWGameObject>() .Where(boe => (boe.Distance2D <= Styx.CommonBot.LootTargeting.LootRadius && (boe.Entry == 176944) || // Old Treasure Chest (Scholomance Instance) (boe.Entry == 179697) || // Arena Treasure Chest (STV Arena) (boe.Entry == 203090) || // Sunken Treaure Chest (boe.Entry == 207472) || // Silverbound Treasure Chest (Zone 1) (boe.Entry == 207473) || // Silverbound Treasure Chest (Zone 2) (boe.Entry == 207474) || // Silverbound Treasure Chest (Zone 3) (boe.Entry == 207475) || // Silverbound Treasure Chest (Zone 4) (boe.Entry == 207476) || // Silverbound Treasure Chest (Zone 5) (boe.Entry == 207477) || // Silverbound Treasure Chest (Zone 6) (boe.Entry == 207478) || // Silverbound Treasure Chest (Zone 7) (boe.Entry == 207479) || // Silverbound Treasure Chest (Zone 8) (boe.Entry == 207480) || // Silverbound Treasure Chest (Zone 9) (boe.Entry == 207484) || // Sturdy Treasure Chest (Zone 1) (boe.Entry == 207485) || // Sturdy Treasure Chest (Zone 2) (boe.Entry == 207486) || // Sturdy Treasure Chest (Zone 3) (boe.Entry == 207487) || // Sturdy Treasure Chest (Zone 4) (boe.Entry == 207488) || // Sturdy Treasure Chest (Zone 5) (boe.Entry == 207489) || // Sturdy Treasure Chest (Zone 6) (boe.Entry == 207492) || // Sturdy Treasure Chest (Zone 7) (boe.Entry == 207493) || // Sturdy Treasure Chest (Zone 8) (boe.Entry == 207494) || // Sturdy Treasure Chest (Zone 9) (boe.Entry == 207495) || // Sturdy Treasure Chest (Zone 10) (boe.Entry == 207496) || // Dark Iron Treasure Chest (Zone 1) (boe.Entry == 207497) || // Dark Iron Treasure Chest (Zone 2) (boe.Entry == 207498) || // Dark Iron Treasure Chest (Zone 3) (boe.Entry == 207500) || // Dark Iron Treasure Chest (Zone 4) (boe.Entry == 207507) || // Dark Iron Treasure Chest (Zone 5) (boe.Entry == 207512) || // Silken Treasure Chest (Zone 1) (boe.Entry == 207513) || // Silken Treasure Chest (Zone 2) (boe.Entry == 207517) || // Silken Treasure Chest (Zone 3) (boe.Entry == 207518) || // Silken Treasure Chest (Zone 4) (boe.Entry == 207519) || // Silken Treasure Chest (Zone 5) (boe.Entry == 207520) || // Maplewood Treasure Chest (Zone 1) (boe.Entry == 207521) || // Maplewood Treasure Chest (Zone 2) (boe.Entry == 207522) || // Maplewood Treasure Chest (Zone 3) (boe.Entry == 207523) || // Maplewood Treasure Chest (Zone 4) (boe.Entry == 207524) || // Maplewood Treasure Chest (Zone 5) (boe.Entry == 207528) || // Maplewood Treasure Chest (Zone 6) (boe.Entry == 207529) || // Maplewood Treasure Chest (Zone 7) (boe.Entry == 207533) || // Runestone Treasure Chest (Zone 1) (boe.Entry == 207534) || // Runestone Treasure Chest (Zone 2) (boe.Entry == 207535) || // Runestone Treasure Chest (Zone 3) (boe.Entry == 207540) || // Runestone Treasure Chest (Zone 4) (boe.Entry == 207542) || // Runestone Treasure Chest (Zone 5) (boe.Entry == 213362) || // Ship's Locker (Contains ~ 96G) (boe.Entry == 213650) || // Virmen Treasure Cache (Contains ~ 100G) (boe.Entry == 213769) || // Hozen Treasure Cache (Contains ~ 100G) (boe.Entry == 213770) || // Stolen Sprite Treasure (Contains ~ 105G) (boe.Entry == 213774) || // Lost Adventurer's Belongings (Contains ~ 100G) (boe.Entry == 213961) || // Abandoned Crate of Goods (Contains ~ 100G) (boe.Entry == 214325) || // Forgotten Lockbox (Contains ~ 10G) (boe.Entry == 214407) || // Mo-Mo's Treasure Chest (Contains ~ 9G) (boe.Entry == 214337) || // Stash of Gems (few green uncut MoP gems and ~ 7G) (boe.Entry == 214337))) // Offering of Rememberance (Contains ~ 30G and debuff turns you grey) .OrderBy(boe => boe.Distance).ToList(); foreach (WoWGameObject boe in objList) { if (!boe.InLineOfSight) { return; } if (StyxWoW.Me.Combat) { return; } WoWMovement.MoveStop(); MoveToLocation(WoWMovement.CalculatePointFrom(boe.Location, 3)); if (!StyxWoW.Me.HasAura(40120) && !StyxWoW.Me.HasAura(33943)) { Flightor.MountHelper.Dismount(); } Thread.Sleep(1000); boe.Interact(); Thread.Sleep(3000); Logging.Write(LogLevel.Normal, Colors.DarkRed, "[LiquidTreasure 2]: Opened a {0} with ID {1}", boe.Name, boe.Entry); if (!Flightor.MountHelper.Mounted) { Flightor.MountHelper.MountUp(); } return; } }
public static void PickUpBOPTreasure() { ObjectManager.Update(); List <WoWGameObject> objList = ObjectManager.GetObjectsOfType <WoWGameObject>() .Where(bop => (bop.Distance2D <= Styx.CommonBot.LootTargeting.LootRadius && (bop.Entry == 213363) || // Wodin's Mantid Shanker (bop.Entry == 213364) || // Ancient Pandaren Mining Pick (bop.Entry == 213366) || // Ancient Pandaren Tea Pot (Grey trash worth 100G) (bop.Entry == 213368) || // Lucky Pandaren Coin (Grey trash worth 95G) (bop.Entry == 213649) || // Cache of Pilfered Goods (bop.Entry == 213653) || // Pandaren Fishing Spear (bop.Entry == 213741) || // Ancient Jinyu Staff (bop.Entry == 213742) || // Hammer of Ten Thunders (bop.Entry == 213748) || // Pandaren Ritual Stone (Grey trash worth 105G) (bop.Entry == 213749) || // Staff of the Hidden Master (bop.Entry == 213750) || // Saurok Stone Tablet (Grey trash worth 100G) (bop.Entry == 213751) || // Sprite's Cloth Chest (bop.Entry == 213765) || // Tablet of Ren Yun (Cooking Recipy) (bop.Entry == 213768) || // Hozen Warrior Spear (bop.Entry == 213771) || // Statue of Xuen (Grey trash worth 100G) (bop.Entry == 213782) || // Terracotta Head (Grey trash worth 100G) (bop.Entry == 213793) || // Riktik's Tiny Chest (Grey trash worth 105G) (bop.Entry == 213842) || // Stash of Yaungol Weapons (bop.Entry == 213844) || // Amber Encased Moth (Grey trash worth 105G) (bop.Entry == 213845) || // The Hammer of Folly (Grey trash worth 100G) (bop.Entry == 213956) || // Fragment of Dread (Grey trash worth 90G) (bop.Entry == 213959) || // Hardened Sap of Kri'vess (Grey trash worth 110G) (bop.Entry == 213960) || // Yaungol Fire Carrier (bop.Entry == 213962) || // Wind-Reaver's Dagger of Quick Strikes (bop.Entry == 213964) || // Malik's Stalwart Spear (bop.Entry == 213966) || // Amber Encased Necklace (bop.Entry == 213967) || // Blade of the Prime (bop.Entry == 213968) || // Swarming Cleaver of Ka'roz (bop.Entry == 213969) || // Dissector's Staff of Mutilation (bop.Entry == 213970) || // Bloodsoaked Chitin Fragment (bop.Entry == 213972) || // Blade of the Poisoned Mind (bop.Entry == 214340) || // Boat-Building Instructions (Grey trash worth 10G) (bop.Entry == 214438) || // Ancient Mogu Tablet (Grey trash worth 95G) (bop.Entry == 214439) || // Barrel of Banana Infused Rum (Cooking Recipy and Rum) (bop.Entry == 218593))) // Trove of the Thunder King (IoTK chest containing a BoP item) .OrderBy(bop => bop.Distance).ToList(); foreach (WoWGameObject bop in objList) { if (!bop.InLineOfSight) { return; } if (StyxWoW.Me.Combat) { return; } WoWMovement.MoveStop(); MoveToLocation(WoWMovement.CalculatePointFrom(bop.Location, 3)); if (!StyxWoW.Me.HasAura(40120) && !StyxWoW.Me.HasAura(33943)) { Flightor.MountHelper.Dismount(); } Thread.Sleep(1000); bop.Interact(); Thread.Sleep(3000); Lua.DoString("RunMacroText(\"/click StaticPopup1Button1\");"); Logging.Write(LogLevel.Normal, Colors.DarkRed, "[LiquidTreasure 2]: Opened a {0} with ID {1}", bop.Name, bop.Entry); if (!Flightor.MountHelper.Mounted) { Flightor.MountHelper.MountUp(); } return; } }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(c => Counter > NumOfTimes, new Action(c => { TreeRoot.StatusText = "Finished!"; if (GoHomeButton > 0) { Lua.DoString("CastPetAction({0})", GoHomeButton); } _isBehaviorDone = true; return RunStatus.Success; }) ), new Decorator(c => NpcVehicleList.Count > 0 && !InVehicle, new Action(c => { if (!NpcVehicleList[0].WithinInteractRange) { Navigator.MoveTo(NpcVehicleList[0].Location); TreeRoot.StatusText = "Moving To Vehicle - " + NpcVehicleList[0].Name + " Yards Away: " + NpcVehicleList[0].Location.Distance(Me.Location); } else { NpcVehicleList[0].Interact(); MountedPoint = Me.Location; } }) ), new Decorator(c => InVehicle && SpellType == 1, new Action(c => { if (NpcList.Count == 0 || NpcList[0].Location.Distance(VehicleList[0].Location) > 15) { TreeRoot.StatusText = "Waiting for Mob to Come Into Range or Appear."; return RunStatus.Running; } else if (NpcList.Count >= 1 && NpcList[0].Location.Distance(VehicleList[0].Location) <= 15) { TreeRoot.StatusText = "Attacking: " + NpcList[0].Name + ", AttackButton: " + AttackButton; NpcList[0].Target(); Lua.DoString("CastPetAction({0})", AttackButton); Thread.Sleep(WaitTime); Counter++; return RunStatus.Success; } return RunStatus.Running; })), new Decorator(c => InVehicle && SpellType == 2, new Action(c => { if (NpcList.Count >= 1) { Thread.Sleep(OftenToUse); TreeRoot.StatusText = "Attacking: " + NpcList[0].Name + ", AttackButton: " + AttackButton + ", Times Used: " + Counter; if ((Counter > NumOfTimes && QuestId == 0) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted&& QuestId > 0)) { Lua.DoString("VehicleExit()"); _isBehaviorDone = true; return RunStatus.Success; } NpcList[0].Target(); Lua.DoString("CastPetAction({0})", AttackButton); SpellManager.ClickRemoteLocation(NpcList[0].Location); Thread.Sleep(WaitTime); Counter++; return RunStatus.Running; } return RunStatus.Running; })), new Decorator(c => InVehicle && SpellType == 3, new PrioritySelector( ret => NpcList.OrderBy(u => u.DistanceSqr).FirstOrDefault(u => Me.Transport.IsSafelyFacing(u)), new Decorator( ret => ret != null, new PrioritySelector( new Decorator( ret => Me.CurrentTarget == null || Me.CurrentTarget != (WoWUnit)ret, new Action(ret => ((WoWUnit)ret).Target())), new Decorator( ret => !Me.Transport.IsSafelyFacing(((WoWUnit)ret), 10), new Action(ret => Me.CurrentTarget.Face())), new Action(ret => { Vector3 v = Me.CurrentTarget.Location - StyxWoW.Me.Location; v.Normalize(); Lua.DoString(string.Format( "local pitch = {0}; local delta = pitch - VehicleAimGetAngle(); VehicleAimIncrement(delta); CastPetAction({1});", Math.Asin(v.Z).ToString(CultureInfo.InvariantCulture), AttackButton)); Thread.Sleep(WaitTime); Counter++; return RunStatus.Success; }))))), new Decorator(c => InVehicle && SpellType == 4, new Action(c => { if (NpcList.Count >= 1) { if ((Counter > NumOfTimes && QuestId == 0) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted&& QuestId > 0)) { Lua.DoString("VehicleExit()"); _isBehaviorDone = true; return RunStatus.Success; } NpcList[0].Target(); WoWMovement.ClickToMove(NpcList[0].Location); Lua.DoString("CastPetAction({0})", AttackButton); SpellManager.ClickRemoteLocation(NpcList[0].Location); Counter++; return RunStatus.Running; } return RunStatus.Running; })), new Decorator(c => InVehicle && SpellType == 5, new Action(c => { if (NpcList.Count >= 1 || NpcListSecondary.Count >= 1) { if ((Counter > NumOfTimes && QuestId == 0) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted&& QuestId > 0)) { Lua.DoString("VehicleExit()"); _isBehaviorDone = true; return RunStatus.Success; } if (NpcList.Count > 0) { NpcList[0].Target(); WoWMovement.ConstantFace(Me.CurrentTargetGuid); Lua.DoString("CastPetAction({0})", AttackButton); } if (NpcListSecondary.Count > 0) { NpcListSecondary[0].Target(); WoWMovement.ConstantFace(Me.CurrentTargetGuid); Lua.DoString("CastPetAction({0})", AttackButton); } Lua.DoString("CastPetAction({0})", AttackButton2); if (QuestId == 0) { Counter++; } return RunStatus.Running; } return RunStatus.Running; })) ))); }
#pragma warning disable 1998 private async void Unstuck() #pragma warning restore 1998 { if (StyxWoW.IsInWorld) { if (Ustart) { Ustart = false; if (Slog) { CLog("STUCK! Unstucking..."); Slog = false; Plog = false; var logStuck = Environment.NewLine + Environment.NewLine + "----- KOM-LOG -----" + Environment.NewLine + $"StuckPoint: {StyxWoW.Me.Location} ({Mpos})" + Environment.NewLine; logStuck = Sp.Distance(Lsp) == 0 ? logStuck + $"LastStuckPoint: {Lp} ({Lpos})" + Environment.NewLine : logStuck + $"DistanceFactor {Df}" + Environment.NewLine + $"MapId: {StyxWoW.Me.MapId}" + Environment.NewLine + $"Zone: {StyxWoW.Me.MapName}, {StyxWoW.Me.RealZoneText}, {StyxWoW.Me.MinimapZoneText}" + Environment.NewLine + $"Profile: {ProfileManager.CurrentProfile.Name}" + Environment.NewLine + $"BotPoi: {BotPoi.Current}" + Environment.NewLine + $"TreeRoot: {TreeRoot.GoalText}" + Environment.NewLine + "----- KOM-LOG -----" + Environment.NewLine + Environment.NewLine; Logging.WriteDiagnostic(logStuck); WoWMovement.Move(WoWMovement.MovementDirection.AutoRun); Left = Rnd.Next(2) == 1 ? true : false; Turnleft = Left == false ? true : false; } if ((St >= BeginUnstuck || Motionless) && St < 9) { if (!Plog) { CLog("Stage 1"); Plog = true; } if (StyxWoW.Me.IsFlying || StyxWoW.Me.IsSwimming) { switch (Up) { case true: WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(1000)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.Descend, TimeSpan.FromMilliseconds(1000)); break; } } else { WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(50)); } Pause = 300 * (6.2 / Df * 0.3 + Sp.Distance(StyxWoW.Me.Location) / (Df * 7) + Ltp.Distance(StyxWoW.Me.Location) / 3); if (DateTime.Now.Subtract(Lt).TotalMilliseconds > Pause) { switch (!Turnleft) { case true: WoWMovement.Move(WoWMovement.MovementDirection.TurnLeft, TimeSpan.FromMilliseconds(30)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.TurnRight, TimeSpan.FromMilliseconds(30)); break; } Lt = DateTime.Now; } Ltp = StyxWoW.Me.Location; switch (Left) { case true: WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft, TimeSpan.FromMilliseconds(500)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.StrafeRight, TimeSpan.FromMilliseconds(500)); break; } } if (St >= 9 && St < 15) { if (Plog) { CLog("Stage 2"); Plog = false; } if (StyxWoW.Me.IsFlying || StyxWoW.Me.IsSwimming) { switch (!Up) { case true: WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(1000)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.Descend, TimeSpan.FromMilliseconds(1000)); break; } } else { WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(50)); } Pause = 200 * (6.2 / Df * 0.3 + Sp.Distance(StyxWoW.Me.Location) / (Df * 7) + Ltp.Distance(StyxWoW.Me.Location) / 3); if (DateTime.Now.Subtract(Lt).TotalMilliseconds > Pause) { switch (Turnleft) { case true: WoWMovement.Move(WoWMovement.MovementDirection.TurnLeft, TimeSpan.FromMilliseconds(30)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.TurnRight, TimeSpan.FromMilliseconds(30)); break; } Lt = DateTime.Now; } Ltp = StyxWoW.Me.Location; switch (Left) { case true: WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft, TimeSpan.FromMilliseconds(500)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.StrafeRight, TimeSpan.FromMilliseconds(500)); break; } } if (St >= 15 && St < 25) { if (!Plog && St < 20) { CLog("Stage 3"); Plog = true; } if (StyxWoW.Me.IsFlying || StyxWoW.Me.IsSwimming) { switch (Up) { case true: WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(2000)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.Descend, TimeSpan.FromMilliseconds(2000)); break; } } else { WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(50)); } Pause = 100 * (6.2 / Df * 0.3 + Sp.Distance(StyxWoW.Me.Location) / (Df * 7) + Ltp.Distance(StyxWoW.Me.Location) / 3); if (DateTime.Now.Subtract(Lt).TotalMilliseconds > Pause) { switch (!Turnleft) { case true: WoWMovement.Move(WoWMovement.MovementDirection.TurnLeft, TimeSpan.FromMilliseconds(30)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.TurnRight, TimeSpan.FromMilliseconds(30)); break; } Lt = DateTime.Now; } Ltp = StyxWoW.Me.Location; switch (Left) { case true: WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft, TimeSpan.FromMilliseconds(2000)); break; case false: WoWMovement.Move(WoWMovement.MovementDirection.StrafeRight, TimeSpan.FromMilliseconds(2000)); break; } } if (St >= 20) { if (Plog && St < 25) { CLog("Stage 4"); Plog = false; } Left = Left ? false : true; Turnleft = Turnleft ? false : true; Up = false; } if (St >= 25) { if (!Plog) { CLog("Stage 5"); Plog = true; } if (!Stopped) { WoWMovement.MoveStop(); Stopped = true; } if (StyxWoW.Me.IsFlying || StyxWoW.Me.IsSwimming) { WoWMovement.Move(WoWMovement.MovementDirection.Backwards, TimeSpan.FromMilliseconds(1000)); } else { WoWMovement.Move(WoWMovement.MovementDirection.Backwards, TimeSpan.FromMilliseconds(2000)); } } if (St >= 33) { if (Plog && St < 43) { CLog("Stage 6"); Plog = false; } CLog("Reload profile..."); Reset = true; Rs = DateTime.Now; if (ProfileManager.XmlLocation.ToLower().Contains("questing profile pack")) { _kickz = false; for (var i = 0; i <= _qdirs.Length - 1; i++) { if (ProfileManager.XmlLocation.ToLower().Contains(_qdirs[i])) { ProfileManager.LoadNew( Path.Combine(Path.GetDirectoryName(ProfileManager.XmlLocation), "..\\Auto Loader - v2.xml")); _kickz = true; } } if (!_kickz) { ProfileManager.LoadNew(ProfileManager.XmlLocation); } } else { ProfileManager.LoadNew(ProfileManager.XmlLocation); } } if (St >= 43) { if (!Plog) { CLog("Stage 7"); Plog = true; } CLog("Using Hearthstone(s)..."); Hearth = true; } Ustart = true; } //await CommonCoroutines.SleepForLagDuration(); } }
public static void CoPulse() { if (Me.CurrentTarget.Distance < 3 && SpellManager.CanCast("Blink")) { WoWMovement.Move(WoWMovement.MovementDirection.Backwards); SpellManager.Cast("Blink"); return; } _target = Me.CurrentTarget; // Strafe Left if (GetDegree <= 180 && GetDegree >= Cone) { var vectorA = Calculators._obj1ToObj2(Me, Me.CurrentTarget); var B = Calculators._B(vectorA, System.Math.PI / 2); if (!Me.IsFacing(new WoWPoint(B.X, B.Y, B.Z)) && Me.CurrentTarget.Distance < 10) { WoWMovement.Move(WoWMovement.MovementDirection.TurnLeft); } if (Me.IsFacing(new WoWPoint(B.X, B.Y, B.Z))) { WoWMovement.MoveStop(WoWMovement.MovementDirection.TurnLeft); } if (Me.CurrentTarget.Distance < 10) { WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft); } if (Me.CurrentTarget.Distance >= 20) { WoWMovement.MoveStop(WoWMovement.MovementDirection.StrafeLeft); } } // Strafe right if (GetDegree >= 180 && GetDegree <= (360 - Cone)) { var vectorA = Calculators._obj1ToObj2(Me, Me.CurrentTarget); var B = Calculators._B(vectorA, -(System.Math.PI / 2)); if (!Me.IsFacing(new WoWPoint(B.X, B.Y, B.Z)) && Me.CurrentTarget.Distance < 10) { WoWMovement.Move(WoWMovement.MovementDirection.TurnRight); } if (Me.IsFacing(new WoWPoint(B.X, B.Y, B.Z))) { WoWMovement.MoveStop(WoWMovement.MovementDirection.TurnRight); } if (Me.CurrentTarget.Distance < 10) { WoWMovement.Move(WoWMovement.MovementDirection.StrafeRight); } if (Me.CurrentTarget.Distance >= 20) { WoWMovement.MoveStop(WoWMovement.MovementDirection.StrafeRight); } } return; }
private static Composite MovingFacingBehavior(CLU.UnitSelection onUnit) // TODO: Check if we have an obstacle in our way and clear it ALSO need a mounted CHECK!!. { var badStuff = ObjectManager.GetObjectsOfType <WoWUnit>(false, false).Where(q => q.CreatedByUnitGuid != Me.Guid && q.FactionId == 14 && !q.Attackable && q.Distance < 8).OrderBy(u => u.DistanceSqr).FirstOrDefault(); return(new Sequence( // No Target? // Targeting Enabled? // Aquire Target new DecoratorContinue(ret => (onUnit == null || onUnit(ret) == null || onUnit(ret).IsDead || onUnit(ret).IsFriendly) && CLUSettings.Instance.EnableTargeting, new PrioritySelector( ctx => { // Clear our current target if its Dead or is Friendly. if (ctx != null && (onUnit(ctx).IsDead || onUnit(ctx).IsFriendly)) { CLULogger.TroubleshootLog(" Target Appears to be dead or a Friendly. Clearing Current Target [" + CLULogger.SafeName((WoWUnit)ctx) + "]"); Me.ClearTarget(); } // Aquires a target. if (Unit.EnsureUnitTargeted != null) { // Clear our current target if its blacklisted. if (Blacklist.Contains(Unit.EnsureUnitTargeted.Guid) || Unit.EnsureUnitTargeted.IsDead) { CLULogger.TroubleshootLog(" EnsureUnitTargeted Appears to be dead or Blacklisted. Clearing Current Target [" + CLULogger.SafeName(Unit.EnsureUnitTargeted) + "]"); Me.ClearTarget(); } return Unit.EnsureUnitTargeted; } return null; }, new Decorator( ret => ret != null, //checks that the above ctx returned a valid target. new Sequence( //new Action(ret => SysLog.DiagnosticLog(" CLU targeting activated. Targeting " + SysLog.SafeName((WoWUnit)ret))), // pending spells like mage blizard cause targeting to fail. //new DecoratorContinue(ctx => StyxWoW.Me.CurrentPendingCursorSpell != null, // new Action(ctx => Lua.DoString("SpellStopTargeting()"))), new Action(ret => ((WoWUnit)ret).Target()), new WaitContinue(2, ret => onUnit(ret) != null && onUnit(ret) == (WoWUnit)ret, new ActionAlwaysSucceed()))))), // Are we Facing the target? // Is the Target in line of site? // Face Target new DecoratorContinue(ret => onUnit(ret) != null && !Me.IsSafelyFacing(onUnit(ret), 45f) && onUnit(ret).InLineOfSight, new Sequence( new Action(ret => WoWMovement.Face(onUnit(ret).Guid)))), // Target in Line of site? // We are not casting? // We are not channeling? // Move to Location new DecoratorContinue(ret => onUnit(ret) != null && !onUnit(ret).InLineOfSight&& !Me.IsCasting && !Spell.PlayerIsChanneling, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Target not in LoS. Moving closer.")), new Action(ret => Navigator.MoveTo(onUnit(ret).Location)))), // Blacklist targets TODO: check this. new DecoratorContinue(ret => onUnit(ret) != null && !Me.IsInInstance && Navigator.GeneratePath(Me.Location, onUnit(ret).Location).Length <= 0, new Action(delegate { Blacklist.Add(Me.CurrentTargetGuid, TimeSpan.FromDays(365)); CLULogger.MovementLog("[CLU] " + CLU.Version + ": Failed to generate path to: {0} blacklisted!", Me.CurrentTarget.Name); return RunStatus.Success; })), // Move away from bad stuff new DecoratorContinue(ret => badStuff != null, new Sequence( new Action(ret => CLULogger.MovementLog("[CLU Movement] Movin out of bad Stuff.")), new Action(ret => { if (badStuff != null) { CLULogger.MovementLog("[CLU Movement] Movin out of {0}.", badStuff); Navigator.MoveTo(WoWMovement.CalculatePointFrom(badStuff.Location, 10)); } }))), // Move Behind Target enabled? // Target is Alive? // Target is not Moving? // Are we behind the target? // We are not casting? // We are not the tank? // We are not channeling? // Move Behind Target new DecoratorContinue(ret => CLUSettings.Instance.EnableMoveBehindTarget && onUnit(ret) != null && onUnit(ret) != Me && // && !onUnit(ret).IsMoving onUnit(ret).InLineOfSight&& onUnit(ret).IsAlive&& !onUnit(ret).MeIsBehind&& !Me.IsCasting && !Spell.PlayerIsChanneling && Unit.DistanceToTargetBoundingBox() >= 10, // && (Unit.Tanks != null && Unit.Tanks.Any(x => x.Guid != Me.Guid)) new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Not behind the target. Moving behind target.")), new Action(ret => Navigator.MoveTo(CalculatePointBehindTarget())))), // Target is greater than CombatMinDistance? // Target is Moving? // We are not moving Forward? // Move Forward to wards target new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() >= CLU.Instance.ActiveRotation.CombatMinDistance && onUnit(ret).IsMoving&& !Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight&& !IsFlyingUnit, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too far away from moving target (T[{0}] >= P[{1}]). Moving forward.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMinDistance)), new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Forward)))), // Target is less than CombatMinDistance? // Target is Moving? // We are moving Forward // Stop Moving Forward new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() < CLU.Instance.ActiveRotation.CombatMinDistance && onUnit(ret).IsMoving&& Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too close to target (T[{0}] < P[{1}]). Movement Stopped.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMinDistance)), new Action(ret => WoWMovement.MoveStop()))), // Target is not Moving? // Target is greater than CombatMaxDistance? // We are not Moving? // Move Forward new DecoratorContinue(ret => onUnit(ret) != null && !onUnit(ret).IsMoving&& Unit.DistanceToTargetBoundingBox() >= CLU.Instance.ActiveRotation.CombatMaxDistance && onUnit(ret).InLineOfSight, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too far away from non moving target (T[{0}] >= P[{1}]). Moving forward.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMaxDistance)), new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Forward, new TimeSpan(99, 99, 99))))), // Target is less than CombatMaxDistance? // We are Moving? // We are moving Forward? // Stop Moving new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() < CLU.Instance.ActiveRotation.CombatMaxDistance && Me.IsMoving && Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too close to target (T[{0}] < P[{1}]). Movement Stopped", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMaxDistance)), new Action(ret => WoWMovement.MoveStop()))))); }
protected override Composite CreateBehavior_CombatMain() { return(new PrioritySelector( // If we are following the path to the destination... new Decorator(context => State_MainBehavior == StateType_MainBehavior.FollowingPathToDestination, new PrioritySelector( // If no path specified, we're done... new Decorator(context => !FollowPath.Waypoints.Any(), new Action(context => { State_MainBehavior = StateType_MainBehavior.BehaviorDone; })), // If Mob_ToAvoid is too close, abandon current ingress, and find egress path back to safespot... new Decorator(context => Mob_ToAvoid != null, new Decorator(context => ((Mob_ToAvoid.Distance < FollowPath.EgressDistance) || Me.Combat) && (Path_Egress == null), new Action(context => { LogInfo("Moving back to safespot due to {0}.", Me.Combat ? "combat" : string.Format("{0} too close (dist: {1:F1})", Mob_ToAvoid.Name, Mob_ToAvoid.Distance)); Path_Ingress = null; Path_Egress = FollowPath.FindPath_Egress(Mob_ToAvoid); })) ), // If we are egressing, follow the Yellow Brick Road... new Decorator(context => Path_Egress != null, new PrioritySelector( // If we've come to the end of our egress path, move back to safe spot... new Decorator(context => !Path_Egress.Any(), new Action(context => { State_MainBehavior = StateType_MainBehavior.MovingToSafespot; })), // If we've arriaved at the current waypoint, dequeue it... new Decorator(context => Me.Location.Distance(Path_Egress.Peek().Location) <= Navigator.PathPrecision, new Action(context => { Path_Egress.Dequeue(); })), UtilityBehaviorPS_MoveTo(context => Path_Egress.Peek().Location, context => "safe spot") )), // If we don't have a current ingress path to follow, build it... new Decorator(context => ((Mob_ToAvoid == null) || (Mob_ToAvoid.Distance > AvoidDistance)) && (Path_Ingress == null), new Action(context => { Path_Egress = null; Path_Ingress = FollowPath.FindPath_Ingress(); FollowPath.DismissPetIfNeeded(); })), // If we've an Ingress path to follow, use it... new Decorator(context => Path_Ingress != null, new PrioritySelector( // If we've consumed our ingress path, we're done... new Decorator(context => !Path_Ingress.Any(), new Action(context => { State_MainBehavior = StateType_MainBehavior.BehaviorDone; })), new Switch <SafePathType.StrategyType>(context => FollowPath.Strategy, #region State: DEFAULT new Action(context => // default case { LogMaintenanceError("FollowPathStrategyType({0}) is unhandled", FollowPath.Strategy); TreeRoot.Stop(); State_MainBehavior = StateType_MainBehavior.BehaviorDone; }), #endregion #region Strategy: Stalk Mob at Avoid Distance Strategy new SwitchArgument <SafePathType.StrategyType>(SafePathType.StrategyType.StalkMobAtAvoidDistance, new Decorator(context => (Mob_ToAvoid != null) && (Mob_ToAvoid.Distance < AvoidDistance), new PrioritySelector( new Decorator(context => Me.IsMoving, new Action(context => { WoWMovement.MoveStop(); })), new ActionAlwaysSucceed() ))), #endregion #region Strategy: Wait for Avoid Distance new SwitchArgument <SafePathType.StrategyType>(SafePathType.StrategyType.WaitForAvoidDistance, new PrioritySelector( // No addition action needed to implement strategy for now )) #endregion ), // If we've arrived at the current ingress waypoint, dequeue it... new Decorator(context => Me.Location.Distance(Path_Ingress.Peek().Location) <= Navigator.PathPrecision, new Action(context => { Path_Ingress.Dequeue(); })), // Follow the prescribed ingress path... UtilityBehaviorPS_MoveTo(context => Path_Ingress.Peek().Location, context => "follow ingress path") )) )) )); }
public override void Pulse() { if (Styx.Logic.BehaviorTree.TreeRoot.StatusText.ToLower().Contains("loading tile")) { return; } if (!TimeToAlertTimer.IsRunning) { TimeToAlertTimer.Start(); } if (TimeToAlertTimer.Elapsed.Minutes >= 15) { TotalBaseTime(); TimeToAlertTimer.Reset(); TimeToAlertTimer.Start(); } if (IsNotSafe()) { return; } /*if (System.Math.Round((DateTime.Now - _TotalStartTime).TotalMinutes) != 0 && Convert.ToInt32((DateTime.Now - _TotalStartTime).TotalMinutes) % 2 == 0) * { Log(string.Format("Total time since originally started; Hours:{0} Mins:{1}", (DateTime.Now - _TotalStartTime).TotalHours.ToString(), (DateTime.Now - _TotalStartTime).TotalMinutes.ToString())); } * if (System.Math.Round((DateTime.Now - _BaseStartTime).TotalMinutes) != 0 && Convert.ToInt32((DateTime.Now - _BaseStartTime).TotalMinutes) % 2 == 0) * { Log(string.Format("Total time since Group {0} started; Hours:{1} Mins:{2}",_CurrentProfile.ToString(), (DateTime.Now - _BaseStartTime).TotalHours.ToString(), (DateTime.Now - _BaseStartTime).TotalMinutes.ToString())); } */ if (!LoadedFirst) { _CurrentProfile = 0; /*if (!BotManager.Current.Name.Contains(_Manager.BotBase[_CurrentProfile]) || _Manager.FilePath[_CurrentProfile].Contains(Styx.Logic.Profiles.ProfileManager.XmlLocation))*/ LoadedFirst = true; StartChanger(); } if (_Manager.LoopAfter && !IsNotSafe() && ((DateTime.Now - _TotalStartTime).TotalMinutes >= ((_Manager.LoopHours * 60) + _Manager.LoopMinutes))) { TotalRunningTime(); Log("Total Time to loop has been reached. Sending 'ForceQuit()' to WoW."); Styx.Helpers.InactivityDetector.ForceLogout(true); TreeRoot.Stop(); } if (EXITNOW) { TotalRunningTime(); Log("ExitNow set to true. Sending 'ForceQuit()' to WoW."); Styx.Helpers.InactivityDetector.ForceLogout(true); TreeRoot.Stop(); } #region NeedHearth if (NeedHearth) { Stopwatch HearthTimer = new Stopwatch(); bool HasHeartStone = false; ObjectManager.Update(); WoWItem stone; SpellManager.StopCasting(); if (Me.IsFlying) { Log("Landing."); Navigator.PlayerMover.MoveStop(); StyxWoW.SleepForLagDuration(); while (Me.IsFlying) { WoWMovement.Move(WoWMovement.MovementDirection.Descend, TimeSpan.FromSeconds(5)); } WoWMovement.MoveStop(); Log("Landed."); } Styx.Logic.Mount.Dismount(); Navigator.PlayerMover.MoveStop(); StyxWoW.SleepForLagDuration(); Thread.Sleep(500); /*if (Me.Class == WoWClass.Mage) * { * SpellManager.StopCasting(); * Styx.Logic.Mount.Dismount(); * Navigator.PlayerMover.MoveStop(); * StyxWoW.SleepForLagDuration(); * if (SpellManager.CanCast(3567)) * { * SpellManager.Cast(3567); * Thread.Sleep(2500); * while (Me.IsCasting || !StyxWoW.IsInWorld) * { * Log("Sleeping while casting", null); * Thread.Sleep(5000); * } * Log("End of Sleep 1, Sleep additional 5 seconds.", null); * Thread.Sleep(5000); * } * } * else * {*/ Log("Looking for Hearthstone!."); foreach (WoWItem _item in ObjectManager.GetObjectsOfType <WoWItem>().Where(o => o.BagSlot != 1 && o.Entry == 6948)) { HasHeartStone = true; Log("Has a Stone."); if (_item.Cooldown < 1) { Log("Not on cooldown!"); DidUseHearth = true; stone = _item; Thread.Sleep(1000); _item.Use(); HearthTimer.Start(); Thread.Sleep(2000); while (Me.IsCasting) { Log("Sleep while Casting."); Thread.Sleep(100); } Thread.Sleep(500); if (HearthTimer.Elapsed.Seconds >= 9) { HearthTimer.Reset(); NeedHearth = false; Log("Hearthstone worked!"); } else { HearthTimer.Reset(); NeedHearth = true; Log("Something Interrupted Hearthstone!"); return; } } } if (!HasHeartStone) { Log("You don't have a HearthStone idiot. GO GET ONE! ExitNow!"); EXITNOW = true; return; } return; } #endregion #region AfterHearth if (AfterHearth && !NeedHearth) { WoWPoint Outside = new WoWPoint(0, 0, 0); Log("Sleepy for 5 seconds. At Home City."); Thread.Sleep(5000); ObjectManager.Update(); foreach (WoWUnit iKeeper in ObjectManager.GetObjectsOfType <WoWUnit>().Where(o => (o.Entry == 6929 || o.Entry == 46642 || o.Entry == 44235 || o.Entry == 6740) && o.Location.Distance(Me.Location) < 30)) { if (iKeeper.Entry == 6929) { Outside = new WoWPoint(1558.945, -4385.643, 16.88019); Log("Hearth set to Valley of Strength."); } if (iKeeper.Entry == 46642) { Outside = new WoWPoint(1935.14, -4696.542, 35.96473); Log("Hearth set to Valley of Honor."); } if (iKeeper.Entry == 44235) { Outside = new WoWPoint(-8380.801, 618.5749, 95.62397); Log("Hearth set to Dwarven district."); } if (iKeeper.Entry == 6740) { Outside = new WoWPoint(-8853.698, 656.3289, 96.68601); Log("Hearth set to Trade district."); } break; } Log("Moving Outside to prevent flying stucks."); while (Outside.Distance(Me.Location) >= 3) { Navigator.MoveTo(Outside); } AfterHearth = false; return; } #endregion if (!NeedHearth && !AfterHearth && NeedToRepairMailSell) { RepairSellMail(_Manager.Repair, _Manager.Sell, _Manager.Mail); return; } #region IsNewZone if (!SitAtHearth && !NeedHearth && !AfterHearth && !NeedToRepairMailSell && IsNewZone) { WoWPoint PortalsHorde = new WoWPoint(2055.473, -4378.082, 98.84528); WoWPoint PortalsAlly = new WoWPoint(-8209.668, 428.5376, 118.0617); if (Me.IsHorde) { //if (RepairAtHearth) { } //Embedded if sell at hearth //if (MailAtHearth) { } ObjectManager.Update(); while (PortalsHorde.Distance(Me.Location) > 5) { if (!Flightor.MountHelper.Mounted && Flightor.MountHelper.CanMount) { Flightor.MountHelper.MountUp(); StyxWoW.SleepForLagDuration(); Thread.Sleep(500); while (Me.IsCasting) { Thread.Sleep(100); } } Log("Mounted and flying to Org Portals!"); Flightor.MoveTo(PortalsHorde); Thread.Sleep(250); } Log("Dismounting."); Flightor.MountHelper.Dismount(); StyxWoW.SleepForLagDuration(); WoWMovement.MoveStop(WoWMovement.MovementDirection.All); Navigator.PlayerMover.MoveStop(); Log("Sleep a little bit at portals."); Thread.Sleep(ranNum(10000, 10000)); Thread.Sleep(10000); //if (!DidReturnForFly) { DidReturnForFly = true; return; } ObjectManager.Update(); uint Portal = 0; foreach (KeyValuePair <uint, string> check in _Manager.ZonePairHorde) { if (check.Value.ToLower() == _Manager.Zone[_CurrentProfile].ToLower()) { Portal = check.Key; Log("Portal Id is: ", check.Key.ToString()); } } foreach (WoWGameObject _portal in ObjectManager.GetObjectsOfType <WoWGameObject>().Where(o => o.Entry == Portal)) { while (_portal.Location.Distance(Me.Location) > _portal.InteractRange) { Navigator.MoveTo(_portal.Location); Log(string.Format("Moving towards: {0}.", _portal.Name)); Thread.Sleep(100); } Navigator.PlayerMover.MoveStop(); WoWMovement.MoveStop(WoWMovement.MovementDirection.All); WoWMovement.MoveStop(); Thread.Sleep(ranNum(500, 2000)); _portal.Interact(); Thread.Sleep(1000); IsNewZone = false; } } if (Me.IsAlliance) { ObjectManager.Update(); while (PortalsAlly.Distance(Me.Location) > 5) { if (!Flightor.MountHelper.Mounted && Flightor.MountHelper.CanMount) { Flightor.MountHelper.MountUp(); StyxWoW.SleepForLagDuration(); Thread.Sleep(500); while (Me.IsCasting) { Thread.Sleep(100); } } Log("Mounted and flying to Storm Portals!"); Flightor.MoveTo(PortalsAlly); Thread.Sleep(250); } Log("Dismounting."); Flightor.MountHelper.Dismount(); StyxWoW.SleepForLagDuration(); WoWMovement.MoveStop(WoWMovement.MovementDirection.All); Navigator.PlayerMover.MoveStop(); Log("Sleep a little bit at portals."); Thread.Sleep(ranNum(10000, 20000)); ObjectManager.Update(); uint Portal = 0; foreach (KeyValuePair <uint, string> check in _Manager.ZonePairAlly) { if (check.Value.ToLower() == _Manager.Zone[_CurrentProfile].ToLower()) { Portal = check.Key; Log("Portal Id is: ", check.Key.ToString()); } } foreach (WoWGameObject _portal in ObjectManager.GetObjectsOfType <WoWGameObject>().Where(o => o.Entry == Portal)) { while (_portal.Location.Distance(Me.Location) > _portal.InteractRange) { Navigator.MoveTo(_portal.Location); Log(string.Format("Moving towards: {0}.", _portal.Name)); Thread.Sleep(100); } Navigator.PlayerMover.MoveStop(); WoWMovement.MoveStop(WoWMovement.MovementDirection.All); WoWMovement.MoveStop(); Thread.Sleep(ranNum(500, 2000)); _portal.Interact(); Thread.Sleep(1000); IsNewZone = false; } //Need someone to get the Innkeepers and XYZs! /*outside the inn <Hotspot X="-8858.316" Y="658.7656" Z="96.58434" /> *<Vendor Name="Innkeeper Allison" Entry="6740" Type="Food" X="-8867.786" Y="673.6729" Z="97.90324" /> *[12:45:57 PM] codenamegamma1: Potal to Blasted Lands - ID 195141 * * [12:48:55 PM] codenamegamma1: Portal to Tol Barad - ID 206594 - Location <Hotspot X="-8208.711" Y="450.1579" Z="117.7044" /> * * */ } if (IsNewZone) { Log("Failed to find the portal. This will cause HB to endlessly loop. Will instead ExitNow."); EXITNOW = true; return; } else { Log("Sent your toon through the portal to :", _Manager.Zone[_CurrentProfile]); } DidUsePortal = true; return; } #endregion if (DidUsePortal) { MoveAfterPortal(); } #region NeedToFly if (NeedToFly && !NeedHearth && !IsNewZone && !SitAtHearth) { Log("Sleepy for 5 seconds."); Thread.Sleep(5000); //Need a returnBool from Lua IsFlyableArea() ObjectManager.Update(); if (_Manager.BotBase[_CurrentProfile] == "Grind Bot") { Log("BotBase is 'Grind Bot'. Flying started."); //StopWatch GrindTimer = new StopWatch(); //GrindTimer.Start() Styx.Logic.Profiles.ProfileManager.CurrentProfile.GrindArea.GetNextHotspot(); Styx.Logic.AreaManagement.Hotspot hotspot = Styx.Logic.Profiles.ProfileManager.CurrentProfile.GrindArea.CurrentHotSpot; while (hotspot.Position.Distance(Me.Location) > 30 && !IsNotSafe()) { if (!Flightor.MountHelper.Mounted && Flightor.MountHelper.CanMount) { Flightor.MountHelper.MountUp(); StyxWoW.SleepForLagDuration(); Thread.Sleep(250); while (Me.IsCasting) { Thread.Sleep(100); } } Log("Mounted and flying to HotSpot!"); Flightor.MoveTo(hotspot.Position); Thread.Sleep(100); //if (GrindTimer.Elapsed.Minutes > 5) { Log("Took over 5 minutes to attempt flying to first hotspot.\nBreaking while loop."); whileTimer.Reset(); break; } } if (hotspot.Position.Distance(Me.Location) <= 30) { Log("Landing."); Navigator.PlayerMover.MoveStop(); StyxWoW.SleepForLagDuration(); WoWMovement.Move(WoWMovement.MovementDirection.Descend, TimeSpan.FromSeconds(1)); WoWMovement.MoveStop(); Flightor.MountHelper.Dismount(); Navigator.Clear(); Log("Landed at HotSpot. Thread released."); NeedToFly = false; } } //Questing is not currently supported. Lot of shit to look at with this. if (_Manager.BotBase[_CurrentProfile] == "Questing") { Stopwatch QuestTimer = new Stopwatch(); if (!QuestTimer.IsRunning) { QuestTimer.Start(); return; } QuestTimer.Reset(); WoWPoint POI_ = Styx.Logic.POI.BotPoi.Current.Location; while (POI_.Distance(Me.Location) > 30 && !IsNotSafe()) { if (!Flightor.MountHelper.Mounted && Flightor.MountHelper.CanMount) { Flightor.MountHelper.MountUp(); StyxWoW.SleepForLagDuration(); Thread.Sleep(250); while (Me.IsCasting) { Thread.Sleep(100); } } Log("Mounted and flying to first POI!"); Flightor.MoveTo(POI_); Thread.Sleep(100); //if (whileTimer.Elapsed.Minutes > 5) { Log("Took over 5 minutes to attempt flying to first hotspot.\nBreaking while loop."); whileTimer.Reset(); break; } } if (POI_.Distance(Me.Location) <= 30) { Log("Landing."); Navigator.PlayerMover.MoveStop(); StyxWoW.SleepForLagDuration(); while (Me.IsFlying) { WoWMovement.Move(WoWMovement.MovementDirection.Descend, TimeSpan.FromSeconds(1)); } WoWMovement.MoveStop(); Log("Landed at POI. Thread released."); NeedToFly = false; } } } #endregion if (!NeedToFly && DidJustRestart) { Log("We're done here for now. Awaiting something to do :) "); DidJustRestart = false; } if (ItemCheck(6948).Cooldown <= 5) { return; } if (_Manager.HearthRMS && ((Me.BagsFull || Me.FreeBagSlots <= (Styx.Logic.Profiles.ProfileManager.CurrentProfile.MinFreeBagSlots + 1) && _Manager.Sell) || (Styx.Logic.POI.BotPoi.Current.Type == Styx.Logic.POI.PoiType.Mail && _Manager.Mail) || (Styx.Logic.POI.BotPoi.Current.Type == Styx.Logic.POI.PoiType.Sell && _Manager.Sell) || (Styx.Logic.POI.BotPoi.Current.Type == Styx.Logic.POI.PoiType.Repair && _Manager.Repair))) { _CurrentProfile++; Log("Found HB needs to Mail/Sell/Repair."); ForcedSRM = true; Log(string.Format("Profile {0} completed", _CurrentProfile.ToString())); TotalRunningTime(); if (_CurrentProfile >= 2) { if (!_Manager.ThreeEnabled && _Manager.FourEnabled) { _CurrentProfile = 3; } if (!_Manager.ThreeEnabled && !_Manager.FourEnabled && _Manager.LoopAfter) { _CurrentProfile = 0; } if (!_Manager.ThreeEnabled && !_Manager.FourEnabled && !_Manager.LoopAfter && _Manager.LogOutAfter) { EXITNOW = true; return; } } StartChanger(); } if ((DateTime.Now - _BaseStartTime).TotalMinutes >= ((_Manager.Hours[_CurrentProfile] * 60) + _Manager.Mins[_CurrentProfile])) { _CurrentProfile++; Log(string.Format("Profile {0} completed", _CurrentProfile.ToString())); TotalRunningTime(); if (_CurrentProfile >= 2) { if (!_Manager.ThreeEnabled && _Manager.FourEnabled) { _CurrentProfile = 3; } if (!_Manager.ThreeEnabled && !_Manager.FourEnabled && _Manager.LoopAfter) { _CurrentProfile = 0; } if (!_Manager.ThreeEnabled && !_Manager.FourEnabled && !_Manager.LoopAfter && _Manager.LogOutAfter) { EXITNOW = true; return; } } StartChanger(); } }//End of Pulse
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => Counter > 0, new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isBehaviorDone = true; return RunStatus.Success; })) )), new Decorator(ret => Query.IsInVehicle(), new Action(ret => Counter++)), new Decorator(ret => VehicleList.Count == 0, new Sequence( new Action(ret => TreeRoot.StatusText = "Moving To Location - X: " + Location.X + " Y: " + Location.Y), new Action(ret => Navigator.MoveTo(Location)), new Sleep(300) ) ), new Decorator(ret => VehicleList.Count > 0, new Sequence( new DecoratorContinue(ret => VehicleList[0].WithinInteractRange, new Sequence( new Action(ret => TreeRoot.StatusText = "Mounting Vehicle - " + VehicleList[0].SafeName), new Action(ret => WoWMovement.MoveStop()), new Action(ret => VehicleList[0].Interact()) ) ), new DecoratorContinue(ret => !VehicleList[0].WithinInteractRange, new Sequence( new Action(ret => TreeRoot.StatusText = "Moving To Vehicle - " + VehicleList[0].SafeName + " X: " + VehicleList[0].X + " Y: " + VehicleList[0].Y + " Z: " + VehicleList[0].Z + " Yards Away: " + VehicleList[0].Location.Distance(Me.Location)), new Action(ret => Navigator.MoveTo(VehicleList[0].Location)), new Sleep(300) )) )) ))); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => me.QuestLog.GetQuestById(12255) != null && me.QuestLog.GetQuestById(12255).IsCompleted, new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isDone = true; return RunStatus.Success; })))), new Decorator(ret => !InVehicle, new Action(ret => { if (flylist.Count == 0) { Navigator.MoveTo(flyloc); Thread.Sleep(1000); } if (flylist.Count > 0 && flylist[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(flylist[0].Location); Thread.Sleep(1000); } if (flylist.Count > 0 && flylist[0].Location.Distance(me.Location) <= 5) { WoWMovement.MoveStop(); flylist[0].Interact(); Thread.Sleep(1000); Lua.DoString("SelectGossipOption(1)"); Thread.Sleep(1000); } })), new Decorator(ret => InVehicle, new Action(ret => { if (!InVehicle) { return RunStatus.Success; } if (me.QuestLog.GetQuestById(12255).IsCompleted) { if (me.Location.Distance(endloc) > 15) { WoWMovement.ClickToMove(endloc); Thread.Sleep(5000); } Lua.DoString("VehicleExit()"); return RunStatus.Success; } if (objmob.Count == 0) { WoWMovement.ClickToMove(startloc); Thread.Sleep(1000); } if (objmob.Count > 0) { objmob[0].Target(); WoWMovement.ClickToMove(objmob[0].Location); Thread.Sleep(100); Lua.DoString("UseAction(122, 'target', 'LeftButton')"); Lua.DoString("UseAction(121, 'target', 'LeftButton')"); } return RunStatus.Running; } )), new DecoratorContinue(ret => !Obj1Done && objmob[0].Location.Distance(me.Location) <= 20, new Sequence( new Action(ret => TreeRoot.StatusText = "PWNing " + objmob[0].Name), new Action(ret => Lua.DoString("VehicleMenuBarActionButton2:Click()")), //new Action(ret => Thread.Sleep(1500)), //new Action(ret => Lua.DoString("VehicleMenuBarActionButton3:Click()")), new Action(ret => Lua.DoString("VehicleMenuBarActionButton1:Click()")), new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Backwards)), new Action(ret => StyxWoW.SleepForLagDuration()), new Action(ret => WoWMovement.MoveStop(WoWMovement.MovementDirection.Backwards)), new Action(ret => StyxWoW.SleepForLagDuration()), new Action(ret => objmob[0].Face()), new Action(ret => Thread.Sleep(500)) ) ) ) )); }
public static void DoDestroyJunk() { if (LastUpdate + 2000 < (uint)Environment.TickCount) { LastUpdate = (uint)Environment.TickCount; } else { return; } WoWSpell mount = null; uint FNBS = Me.FreeNormalBagSlots; // Logging.Write("SpellManager.HasSpell(61425):" + SpellManager.HasSpell(61425)); if (Mount.CanMount() && ((uint)Environment.TickCount - LastSellTry > 30000) && (FNBS <= 2)) { if (Me.Mounted) // optional { Mount.Dismount(); Thread.Sleep(4400); // Gnimo does not disappear instantly } // if () // Sell to mamoth { mount = WoWSpell.FromId(61425); mount.Cast(); Thread.Sleep(500); if (Me.IsCasting) { Thread.Sleep(2500); ObjectManager.Update(); } } LastSellTry = (uint)Environment.TickCount; if (Me.Mounted) { // todo: debug sell procedure IsDone = false; SellDone = false; while (!SellDone && ((uint)Environment.TickCount - LastSellTry < 8000)) { Logging.Write("attempting trade..." + (uint)Environment.TickCount); SellDone = InteractAndSell(32639, SellItemActionType.Whites, 0, 0); // SellItemActionType.Whites Thread.Sleep(1000); } } } else { List <WoWItem> targetItems = ObjectManager.Me.BagItems; uint TotalCount = 0; for (int a = targetItems.Count - 1; a >= 0; a--) { if (targetItems[a] != null && targetItems[a].IsValid) { ItemInfo info = ItemInfo.FromId(targetItems[a].Entry); WoWItemQuality quality = targetItems[a].Quality; if (!ProtectedItems.Contains(targetItems[a].Entry) && (quality == WoWItemQuality.Uncommon && (info.Level < 290) || quality == WoWItemQuality.Common || quality == WoWItemQuality.Poor)) { WoWMovement.MoveStop(); Logging.Write("[Allrounder] Destroying " + targetItems[a].Entry + " \"" + targetItems[a].Name + "\"..."); Lua.DoString("UseItemByName(\"" + targetItems[a].Name + "\")"); // Lua.DoString("UseContainerItem({0}, {1})", targetItems[a].BagIndex + 1, targetItems[a].BagSlot + 1); Lua.DoString("PickupContainerItem({0}, {1})", targetItems[a].BagIndex + 1, targetItems[a].BagSlot + 1); Thread.Sleep(900); Lua.DoString("DeleteCursorItem();"); } } } } }
public override void Pull() { isPulling = true; while (Me.IsMoving) { WoWMovement.MoveStop(); } _pulLoop.Reset(); _pulLoop.Start(); if (_settings.showDebug) { slog("Starting Pull Loop!"); } dismountTimer.Start(); while ((dismountTimer.ElapsedMilliseconds < 5000 && dismountTimer.IsRunning) && !Me.GotAlivePet) { if (_settings.showDebug) { slog("Wait for pet or 5s - now {0} ms! {1}", dismountTimer.ElapsedMilliseconds, dismountTimer.IsRunning); slog("PetAlive {0}!", Me.GotAlivePet); } Thread.Sleep(_settings.myLag); } if (_settings.showDebug) { slog("Wait ends!"); } if (combatChecks) { if (Battlegrounds.IsInsideBattleground && Me.CurrentTarget.Mounted) { Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromSeconds(30)); Me.ClearTarget(); return; } if (Me.CurrentTarget.Guid != lastGuid) { fightTimer.Reset(); lastGuid = Me.CurrentTarget.Guid; slog("Killing " + Me.CurrentTarget.Name + " at distance " + System.Math.Round(targetDistance).ToString() + "."); pullTimer.Reset(); pullTimer.Start(); } else { if (pullTimer.ElapsedMilliseconds > 30 * 1000) { slog("Cannot pull " + Me.CurrentTarget.Name + " now. Blacklist for 30 minutes."); Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromMinutes(30)); } } if (Me.GotAlivePet && Me.GotTarget) { if (!Me.Pet.IsAutoAttacking && Me.Level > 10) { // Me.Pet. Lua.DoString("PetAttack()"); slog("Let " + Me.Pet.Name + " gain aggro."); Thread.Sleep(_settings.petAttackDelay); } } // if (!Me.IsAutoAttacking) // { // Lua.DoString("StartAttack()"); // Thread.Sleep(_settings.myLag); // } while (targetDistance > shadowRange + 2) { slog("{0} yard from {1}.", Math.Round(targetDistance).ToString(), Me.CurrentTarget.Name); Navigator.MoveTo(attackPoint); //WoWMovement.ClickToMove(Me.CurrentTarget.Location, (float)shadowRange); Thread.Sleep(_settings.myLag); if (pullTimer.ElapsedMilliseconds > 10000) { Me.ClearTarget(); Lua.DoString("PetFollow()"); return; } } while (!Me.CurrentTarget.InLineOfSightOCD && targetDistance > 2) { slog("Not in LOS, closing the target"); Navigator.MoveTo(Me.CurrentTarget.Location); //WoWMovement.ClickToMove(Me.CurrentTarget.Location, (float)(targetDistance - 1) ); Thread.Sleep(_settings.myLag * 2); if (pullTimer.ElapsedMilliseconds > 12000) { Me.ClearTarget(); Lua.DoString("PetFollow()"); return; } } while (Me.IsMoving) { WoWMovement.MoveStop(); } CombatDecision(); _pulLoop.Stop(); if (_settings.showDebug) { slog("Exiting Pull Loop! Duration {0}ms", _pulLoop.ElapsedMilliseconds); } } }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => me.QuestLog.GetQuestById(25066) != null && me.QuestLog.GetQuestById(25066).IsCompleted, new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isDone = true; return RunStatus.Success; })))), new Decorator(ret => !InVehicle, new Action(ret => { if (flylist.Count == 0) { Navigator.MoveTo(flyloc); Thread.Sleep(1000); } if (flylist.Count > 0 && flylist[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(flylist[0].Location); Thread.Sleep(1000); } if (flylist.Count > 0 && flylist[0].Location.Distance(me.Location) <= 5) { WoWMovement.MoveStop(); flylist[0].Interact(); Thread.Sleep(1000); Lua.DoString("SelectGossipOption(1)"); Thread.Sleep(1000); } })), new Decorator(ret => InVehicle, new Action(ret => { if (!InVehicle) { return RunStatus.Success; } if (me.QuestLog.GetQuestById(25066).IsCompleted) { while (me.Location.Distance(endloc) > 10) { WoWMovement.ClickToMove(endloc); Thread.Sleep(1000); } Lua.DoString("VehicleExit()"); return RunStatus.Success; } if (objmob.Count == 0) { WoWMovement.ClickToMove(startloc); Thread.Sleep(1000); } if (objmob.Count > 0) { objmob[0].Target(); WoWMovement.ClickToMove(objmob[0].Location); Thread.Sleep(100); Lua.DoString("UseAction(122, 'target', 'LeftButton')"); Lua.DoString("UseAction(121, 'target', 'LeftButton')"); } return RunStatus.Running; } )) ) )); }
public override void Rest() { WoWMovement.MoveStop(); Thread.Sleep(_settings.myLag); if (Me.Combat) { return; } while (Me.Auras.ContainsKey("Drink") && Me.ManaPercent < 100) { Thread.Sleep(_settings.myLag); } while (Me.Auras.ContainsKey("Food") && Me.HealthPercent < 100) { Thread.Sleep(_settings.myLag); } //slog("Resting!"); Thread.Sleep(_settings.myLag); if (NeedLifeTap) { LifeTap(); Thread.Sleep(_settings.myLag); } CheckSummon(); if (NeedBuffs) { BuffMe(); } // if (soulShardCount > 0 && Equals(null, myFirestone) && SpellManager.CanCast("Create Firestone")) // { // CreateFirestone(); // Thread.Sleep(_settings.myLag); // } if (!Me.Auras.ContainsKey("Recently Bandaged") && Me.HealthPercent < 60 && HaveItemCheck(bandageEID) != null) { UseBandage(); } if (Me.CurrentSoulShards < Me.MaxSoulShards && CanCast("Soul Harvest")) { SafeCast("Soul Harvest", false); Thread.Sleep(2000); while (GotBuff("Soul Harvest") && (Me.CurrentSoulShards < Me.MaxSoulShards)) { slog("Harvesting Souls!"); Thread.Sleep(_settings.myLag); } return; } Styx.Logic.Common.Rest.Feed(); }
public Composite CreateBehavior_KillGnomereganStealthFighter() { WoWUnit attackTarget = null; WoWUnit PrideofKezan = null; WaitTimer WildWeaselRocketsTimer = WaitTimer.FiveSeconds; return(new Decorator(r => !Me.IsQuestComplete(QuestId) && Query.IsInVehicle() && (PrideofKezan = Me.CharmedUnit) != null, new PrioritySelector(ctx => attackTarget = GetAttackTarget(), new Decorator(ctx => attackTarget != null, new PrioritySelector( new ActionSetActivity("Moving to Attack"), new Decorator(ctx => Me.CurrentTargetGuid != attackTarget.Guid, new ActionFail(ctx => attackTarget.Target())), new Decorator(ctx => !Me.IsSafelyFacing(attackTarget) || !PrideofKezan.IsSafelyFacing(attackTarget), new ActionFail(ctx => attackTarget.Face())), // cast 'Wild Weasel Rockets' ability new Decorator( ctx => PrideofKezan.Location.DistanceSqr(attackTarget.Location) < 25 * 25 && WildWeaselRocketsTimer.IsFinished, new Sequence( new Action(ctx => Lua.DoString("CastPetAction(2)")), new Action(ctx => WildWeaselRocketsTimer.Reset()))), // cast 'Machine Gun' ability new Decorator( ctx => PrideofKezan.Location.DistanceSqr(attackTarget.Location) <= 25 * 25, new Sequence( new Action(ctx => Lua.DoString("CastPetAction(1)")))), new Decorator(ctx => PrideofKezan.Location.DistanceSqr(attackTarget.Location) > 25 * 25, new Action(ctx => WoWMovement.ClickToMove(attackTarget.Location))))), new Decorator( ctx => attackTarget == null, new PrioritySelector( new Decorator( ctx => PrideofKezan.Location.DistanceSqr(_waitPoint) > 10 * 10, new Sequence( new Action(ctx => WoWMovement.ClickToMove(_waitPoint)))), new ActionSetActivity("No viable targets, waiting."))), new ActionAlwaysSucceed()))); }
public static bool FollowTarget() { string fnname = "FTWCore.FollowTarget"; MyTimer.Start(fnname); LocalPlayer Me = StyxWoW.Me; WoWUnit followtarget = null; double maxDist = FTWProps.range; bool retval = false; bool followtank = false; if (Styx.CommonBot.BotManager.Current.Name == "Grind Bot" && FTWProps.tank.IsDead == false && FTWProps.tank.Guid != StyxWoW.Me.Guid) { followtank = true; } else { followtank = false; } // Leave early if they don't want movement and facing. if (FTWUtils.MovementDisabled()) { FTWLogger.log(Color.Violet, "Movement disabled, not following"); } else if (DateTime.Now < FTWProps.MovementCooldown || StyxWoW.Me.IsCasting || StyxWoW.Me.IsChanneling) { //log(Color.Violet, "Casting, not following"); } else if (BotPoi.Current.Type == PoiType.Loot) { FTWLogger.log(Color.Violet, "Looting, not following"); } else if (FTWProps.mode == "@PULL") { // Just follow whoever is targeted followtarget = StyxWoW.Me.CurrentTarget; } else if (FTWProps.mode == "@COMBAT") { // In combat, follow target preferentially followtarget = StyxWoW.Me.CurrentTarget; if (StyxWoW.Me.IsHealer() || (followtarget == null || !followtarget.IsValidUnit() ) && followtank) { followtarget = FTWProps.tank; maxDist = 10; } } else if (FTWProps.mode == "@REST") { // Out of combat, follow tank preferentially if (followtank) { followtarget = FTWProps.tank; maxDist = 15; } } else { FTWLogger.log(Color.Red, "UNKNOWN MODE {0}", FTWProps.mode); } if (followtarget == null) { //log(Color.Violet, "No target in FollowTarget"); } else if (followtarget.IsDead) { //log(Color.Violet, "Target is dead in FollowTarget"); } else if (followtarget.DistanceCalc() <= maxDist && followtarget.InLineOfSpellSight) { // If close enough, leave WoWMovement.MoveStop(); if (followtarget.IsValidUnit() && !StyxWoW.Me.IsSafelyFacing(followtarget)) { Face(followtarget); } } else { // Keep following FTWLogger.log("Keep following {0} (dist {1:0.00}, InLineOfSight = {2}, InLineOfSpellSight = {3})", followtarget.SafeName(), followtarget.DistanceCalc(), followtarget.InLineOfSight, followtarget.InLineOfSpellSight); WoWPoint loc = followtarget.Location; // Get to right under the mob, if it's flying if (!Navigator.CanNavigateFully(StyxWoW.Me.Location, followtarget.Location)) { //List<float> heights = Navigator.FindHeights(loc.X, loc.Y); //if (heights.Count > 0) // loc.Z = heights.Max(); Styx.WoWInternals.WoWMovement.ClickToMove(loc); } else { // Move to the mob's location Navigator.MoveTo(loc); } retval = true; } MyTimer.Stop(fnname); return(retval); }
/// <summary> /// Function to Find and Tame Mobs /// </summary> public void findAndTameMob() { if (Me.Class != WoWClass.Hunter && !Rarekiller.Settings.TestcaseTamer) { return; } ObjectManager.Update(); List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(o => (!Blacklist.Contains(o.Guid, Rarekiller.Settings.Flags) && ( ((Rarekiller.Settings.TameDefault && Rarekiller.TameableMobsList.ContainsKey(Convert.ToInt32(o.Entry))) || (Rarekiller.Settings.TameByID && (o.Entry == Convert.ToInt64(Rarekiller.Settings.TameMobID)))) && !o.IsPet && o.IsTameable))) .OrderBy(o => o.Distance).ToList(); foreach (WoWUnit o in objList) { if (!o.IsDead) { Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Found a new Pet {0} ID {1}", o.Name, o.Entry); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Unit Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z)); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Find {0} ID {1}')", o.Name, o.Entry); } #region don't tame if // Don't tame the Rare if ... if (Me.IsFlying && Me.IsOutdoors && o.IsIndoors) { Logging.Write(Colors.MediumPurple, "Rarekiller: Unit is Indoors and I fly Outdoors, so blacklist him to prevent Problems"); Logging.Write(Colors.MediumPurple, "Rarekiller: You have to place me next to the Spawnpoint, if you want me to hunt this Unit."); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, " Part TamerRarekiller: Blacklist Unit for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC is Indoors')", o.Name); } return; } if (Me.Level < o.Level) { Logging.Write(Colors.MediumPurple, "Rarekiller: Unit Level is higher then mine, can't tame the Unit."); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Unit for 60 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC Level is to high to tame')", o.Name); } return; } if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(o.Entry))) { Logging.Write(Colors.MediumPurple, "Rarekiller: {0} is Member of the BlacklistedMobs.xml", o.Name); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Unit for 15 Minutes."); return; } if (Rarekiller.DontInteract) { return; } #endregion //Dismiss Pet if (Me.Class == WoWClass.Hunter && Me.Pet != null) { RarekillerSpells.CastSafe("Dismiss Pet", Me, false); //SpellManager.Cast("Dismiss Pet"); Thread.Sleep(3000); } if (Rarekiller.Settings.Alert) { Rarekiller.Alert(); } #region Move to tameable Unit if (!Rarekiller.MoveTo(o, 20, false)) { return; } if (Me.IsFlying) { if (!Rarekiller.DescendToLand(o)) { return; } } Rarekiller.Dismount(); #endregion o.Target(); if (Me.Class == WoWClass.Hunter) { #region Tame while (!o.IsPet) { if (o.IsDead) { Logging.Write(Colors.MediumPurple, "Rarekiller: Oh no, I accidently killed him !!! "); return; } if (Me.HealthPercent < 10) { Logging.Write(Colors.MediumPurple, "Rarekiller: Health < 10% , Use Feign Death !!! "); if (SpellManager.CanCast("Feign Death")) { RarekillerSpells.CastSafe("Feign Death", Me, false); } //SpellManager.Cast("Feign Death"); return; } if (!(Me.CastingSpellId == 1515)) { WoWMovement.MoveStop(); RarekillerSpells.CastSafe("Tame Beast", o, true); //SpellManager.Cast(1515); Logging.Write(Colors.MediumPurple, "Rarekiller: Try to tame Beast {0}", o.Name); Thread.Sleep(500); } } Logging.Write(Colors.MediumPurple, "Rarekiller: Sucessfully tamed Beast {0}", o.Name); #endregion } else { #region Testcase for my Shammi while (!o.IsDead) { Logging.Write(Colors.MediumPurple, "Rarekiller Test: Try to tame Beast", o.Name); Thread.Sleep(1500); } #endregion } } else if (o.IsPet) { return; } else if (Blacklist.Contains(o.Guid, Rarekiller.Settings.Flags)) { return; } else { Logging.Write(Colors.MediumPurple, "Rarekiller: Find a Unit, but sadly he's dead or not tameable: {0}", o.Name); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(Colors.MediumPurple, "Rarekiller: Blacklist Unit for 5 Minutes."); return; } } }
private WoWPoint touchdown;// = new WoWPoint(4566.125,-402.532,305.2783); //kill <Vendor Name="dsada" Entry="0" Type="Repair" X="4584.85" Y="-359.2484" Z="301.6123" /> //private WoWPoint touchdown = new WoWPoint(4566.125, -402.532, 305.2783); protected override Composite CreateBehavior() { return(_root ?? (_root = new Decorator(ret => !_isBehaviorDone, new PrioritySelector(DoneYet, //new Decorator(r => HookDone, new Action(r => TreeHooks.Instance.RemoveHook("Combat_OOC", Hook))), new Decorator(r => StyxWoW.Me.IsCasting, new ActionAlwaysSucceed()), new Decorator(r => Firewall != null && Firewall.Distance < 10, new Action(r => { Navigator.PlayerMover.MoveStop(); ClawThing.Use(); })), new Decorator(r => !touched && touchdown.Distance(StyxWoW.Me.Location) < 5, new Action(r => touched = true)), new Decorator(r => !touched, new Action(r => WoWMovement.ClickToMove(touchdown))) )))); }
protected override RunStatus Run(object context) { if (!IsDone) { if (TrainerFrame.Instance == null || !TrainerFrame.Instance.IsVisible || !ObjectManager.Me.GotTarget || (ObjectManager.Me.GotTarget && ObjectManager.Me.CurrentTarget.Entry != NpcEntry)) { WoWPoint movetoPoint = _loc; WoWUnit unit = ObjectManager.GetObjectsOfType <WoWUnit>().Where(o => o.Entry == NpcEntry). OrderBy(o => o.Distance).FirstOrDefault(); if (unit != null) { movetoPoint = WoWMathHelper.CalculatePointFrom(Me.Location, unit.Location, 3); } else if (movetoPoint == WoWPoint.Zero) { movetoPoint = MoveToAction.GetLocationFromDB(MoveToAction.MoveToType.NpcByID, NpcEntry); } if (movetoPoint != WoWPoint.Zero && ObjectManager.Me.Location.Distance(movetoPoint) > 4.5) { Util.MoveTo(movetoPoint); } else if (unit != null) { if (Me.IsMoving) { WoWMovement.MoveStop(); } unit.Target(); unit.Interact(); } if (GossipFrame.Instance != null && GossipFrame.Instance.IsVisible && GossipFrame.Instance.GossipOptionEntries != null) { foreach (GossipEntry ge in GossipFrame.Instance.GossipOptionEntries) { if (ge.Type == GossipEntry.GossipEntryType.Trainer) { GossipFrame.Instance.SelectGossipOption(ge.Index); return(RunStatus.Success); } } } return(RunStatus.Success); } if (_trainWaitTimer.IsFinished) { using (new FrameLock()) { Lua.DoString("SetTrainerServiceTypeFilter('available', 1)"); // check if there is any abilities to that need training. var numOfAvailableAbilities = Lua.GetReturnVal <int>( "local a=0 for n=GetNumTrainerServices(),1,-1 do if select(3,GetTrainerServiceInfo(n)) == 'available' then a=a+1 end end return a ", 0); if (numOfAvailableAbilities == 0) { IsDone = true; Professionbuddy.Log("Done training"); return(RunStatus.Failure); } Lua.DoString("BuyTrainerService(0) "); _trainWaitTimer.Reset(); } } return(RunStatus.Success); } return(RunStatus.Failure); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => (Counter > NumberOfTimes && QuestId == 0) || (me.QuestLog.GetQuestById(QuestId) != null && me.QuestLog.GetQuestById(QuestId).IsCompleted), new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isDone = true; return RunStatus.Success; })) )), new Decorator(ret => _timer != null && !_timer.IsFinished, new Sequence( new Action(ret => TreeRoot.StatusText = "UseItemOn - WaitTimer: " + _timer.TimeLeft.Seconds + " Seconds Left"), new Action(delegate { return RunStatus.Success; }) ) ), new Decorator(ret => _timer != null && _timer.IsFinished, new Sequence( new Action(ret => _timer.Reset()), new Action(ret => _timer = null), new Action(delegate { return RunStatus.Success; }) ) ), new Decorator(c => npcList.Count == 0, new Action(c => { if (!me.IsIndoors && !me.Mounted && me.Level > 19) { TreeRoot.StatusText = "Mounting!"; Styx.Logic.Mount.MountUp(); } TreeRoot.StatusText = "Moving To Location - X: " + Location.X + " Y: " + Location.Y + " Z: " + Location.Z; Navigator.MoveTo(Location); }) ), new Decorator(c => npcList.Count > 0 && InCombatHPUse > 0, new Action(c => { if (npcList[0].Location.Distance(me.Location) <= Range && InCombatHPUse > 0 && !me.IsCasting) { if (npcList[0].HealthPercent > InCombatHPUse) { TreeRoot.StatusText = "Attacking Mob - Current Health %:" + npcList[0].HealthPercent + " Attacking Until: " + InCombatHPUse; WoWMovement.MoveStop(); if (me.CurrentTarget == npcList[0]) { npcList[0].Target(); npcList[0].Face(); Thread.Sleep(300); } SpellManager.Cast(RangeSpell); return RunStatus.Running; } else { TreeRoot.StatusText = "Using Item - " + wowItem.Name + " On Mob: " + npcList[0].Name; WoWMovement.MoveStop(); npcList[0].Target(); npcList[0].Face(); Thread.Sleep(300); wowItem.Interact(); Counter++; return RunStatus.Success; } } return RunStatus.Failure; })), new Decorator(c => npcList.Count > 0 && InCombatHPUse == 0, new Action(c => { if (npcList[0].Location.Distance(me.Location) < Range) { TreeRoot.StatusText = "Using Item - " + wowItem.Name + " On Mob: " + npcList[0].Name; WoWMovement.MoveStop(); Thread.Sleep(300); npcList[0].Target(); npcList[0].Face(); Thread.Sleep(300); wowItem.Interact(); Counter++; _timer = new Timer(new TimeSpan(0, 0, 0, 0, WaitTime)); _timer.Reset(); return RunStatus.Success; } else { TreeRoot.StatusText = "Moving To Mob - " + npcList[0].Name + " Yards Away: " + npcList[0].Location.Distance(me.Location); Navigator.MoveTo(npcList[0].Location); return RunStatus.Running; } })) ))); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => !_waitTimer.IsFinished, new Sequence( new Action(ret => AntiAfk()), new Action(ret => TreeRoot.StatusText = "Waiting for the story to end"), new ActionAlwaysSucceed()) ), new Decorator(ret => HighWarlordDarion != null && HighWarlordDarion.CanGossip, new PrioritySelector( new Decorator(ret => !HighWarlordDarion.WithinInteractRange, new Sequence( new Action(ret => TreeRoot.StatusText = "Moving to High Warlord Darion"), new Action(ret => Navigator.MoveTo(HighWarlordDarion.Location)))), new Sequence( new Action(ret => TreeRoot.StatusText = "Talking to High Warlord Darion"), new DecoratorContinue(ret => Me.IsMoving, new Sequence( new Action(ret => WoWMovement.MoveStop()), new Action(ret => StyxWoW.SleepForLagDuration()) )), new Action(ret => HighWarlordDarion.Interact()), new WaitContinue(5, ret => GossipFrame.Instance.IsVisible, new Sequence( new DecoratorContinue(ret => GossipFrame.Instance.GossipOptionEntries == null, new Action(ret => _waitTimer.Reset()) ), new DecoratorContinue(ret => GossipFrame.Instance.GossipOptionEntries != null, new Sequence( new Action(ret => GossipFrame.Instance.SelectGossipOption(0)), new Action(ret => StyxWoW.SleepForLagDuration()) ))) )))), new Action(ret => _waitTimer.Reset()) ))); }
public void Move(WoWMovement.MovementDirection direction) { Logger.WriteDebug("~MoveTrace({0}): {1}", direction, StackCaller(5)); Instance.Prev.Move(direction); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => me.QuestLog.GetQuestById(24695) != null && me.QuestLog.GetQuestById(24695).IsCompleted, new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isDone = true; return RunStatus.Success; })) )), new Decorator(ret => !Obj1Done, new Action(ret => { if (Obj1Done) { return RunStatus.Success; } if (!InVehicle) { if (obj1lever.Count > 0 && obj1lever[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(obj1lever[0].Location); return RunStatus.Running; } WoWMovement.MoveStop(); obj1lever[0].Interact(); Thread.Sleep(5000); return RunStatus.Running; } if (InVehicle) { if (obj1mob.Count > 0 && obj1mob[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(obj1mob[0].Location); obj1mob[0].Target(); return RunStatus.Running; } if (obj1mob.Count > 0 && obj1mob[0].Location.Distance(me.Location) <= 5) { WoWMovement.MoveStop(); if (!OnCooldown2) { Lua.DoString("UseAction(122, 'target', 'LeftButton')"); } if (!obj1mob[0].HasAura("Bloodpetal Poison")) { Lua.DoString("UseAction(123, 'target', 'LeftButton')"); } return RunStatus.Running; } return RunStatus.Running; } return RunStatus.Running; } )), new Decorator(ret => !Obj2Done, new Action(ret => { if (Obj2Done) { return RunStatus.Success; } if (!InVehicle) { if (obj2lever.Count > 0 && obj2lever[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(obj2lever[0].Location); return RunStatus.Running; } WoWMovement.MoveStop(); obj2lever[0].Interact(); Thread.Sleep(5000); return RunStatus.Running; } if (InVehicle) { if (!me.HasAura("Bony Armor")) { Lua.DoString("UseAction(123, 'target', 'LeftButton')"); } if (obj2mob.Count > 0 && obj2mob[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(obj2mob[0].Location); return RunStatus.Running; } if (obj2mob.Count > 0 && obj2mob[0].Location.Distance(me.Location) <= 5) { obj2mob[0].Target(); WoWMovement.MoveStop(); Lua.DoString("UseAction(122, 'target', 'LeftButton')"); return RunStatus.Running; } return RunStatus.Running; } return RunStatus.Running; } )), new Decorator(ret => !Obj3Done, new Action(ret => { if (Obj3Done) { return RunStatus.Success; } if (!InVehicle) { if (obj3lever.Count > 0 && obj3lever[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(obj3lever[0].Location); return RunStatus.Running; } WoWMovement.MoveStop(); obj3lever[0].Interact(); Thread.Sleep(5000); return RunStatus.Running; } if (InVehicle) { if (obj3mob.Count == 0) { if (me.Location.Distance(obj3loc1) < 5) { locreached = true; } if (me.Location.Distance(obj3loc2) < 5) { locreached = false; } if (!locreached) { Navigator.MoveTo(obj3loc1); return RunStatus.Running; } if (locreached) { Navigator.MoveTo(obj3loc2); } } if (obj3mob.Count > 0 && ((me.HasAura("Stomper Knowledge") && obj3mob[0].Entry == 6513 || me.HasAura("Thunderer Knowledge") && obj3mob[0].Entry == 6516 || me.HasAura("Gorilla Knowledge") && obj3mob[0].Entry == 6514))) { LocalBlacklist.Add(obj3mob[0].Entry); return RunStatus.Running; } if (obj3mob.Count > 0 && obj3mob[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(obj3mob[0].Location); return RunStatus.Running; } if (obj3mob.Count > 0 && obj3mob[0].Location.Distance(me.Location) <= 5) { obj3mob[0].Target(); Thread.Sleep(100); obj3mob[0].Interact(); Thread.Sleep(2000); Lua.DoString("SelectGossipOption(1)"); Thread.Sleep(2000); Lua.DoString("SelectGossipOption(1)"); Thread.Sleep(2000); return RunStatus.Running; } return RunStatus.Running; } return RunStatus.Running; } )), new Decorator(ret => !Obj4Done, new Action(ret => { if (Obj4Done) { return RunStatus.Success; } if (!InVehicle) { if (obj4lever.Count > 0 && obj4lever[0].Location.Distance(me.Location) > 5) { Navigator.MoveTo(obj4lever[0].Location); return RunStatus.Running; } WoWMovement.MoveStop(); obj4lever[0].Interact(); Thread.Sleep(5000); return RunStatus.Running; } if (InVehicle) { WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend); if (!OnCooldown2) { Lua.DoString("UseAction(122, 'target', 'LeftButton')"); } return RunStatus.Running; } return RunStatus.Success; } )) ) )); }