/// <summary> /// Supports walk through portals in a way that does not result /// in red error messages in WoW or in the HB log/debug files. /// /// xyz should be a position as close as possible to portal entrance /// without entering. /// /// ##Syntax## /// [Optional] QuestId: The id of the quest (0 is default) /// [Optional] QuestName: The name of the quest. /// [Optional] Timeout: time in milliseconds it allows for completing (10000 is default) /// X,Y,Z: used with current location to create a vector it moves along /// /// ##Example## /// use RunTo to get start position, then GoThruPortal to run throuhg xyz vector /// on way through portal. /// /// <RunTo X="4646.201" Y="-3685.043" Z="954.2496" /> /// <CustomBehavior File="GoThruPortal" X="4656.928" Y="-3685.472" Z="957.185" /> /// /// </summary> public GoThruPortal(Dictionary <string, string> args) : base(args) { try { // QuestRequirement* attributes are explained here... // http://www.thebuddyforum.com/mediawiki/index.php?title=Honorbuddy_Programming_Cookbook:_QuestId_for_Custom_Behaviors // ...and also used for IsDone processing. MovePoint = GetXYZAttributeAsWoWPoint("", true, null) ?? WoWPoint.Empty; QuestId = GetAttributeAsQuestId("QuestId", false, null) ?? 0; QuestRequirementComplete = GetAttributeAsEnum <QuestCompleteRequirement>("QuestCompleteRequirement", false, null) ?? QuestCompleteRequirement.NotComplete; QuestRequirementInLog = GetAttributeAsEnum <QuestInLogRequirement>("QuestInLogRequirement", false, null) ?? QuestInLogRequirement.InLog; Timeout = GetAttributeAsInteger("Timeout", false, 1, 60000, null) ?? 10000; GetAttributeAsString_NonEmpty("QuestName", false, null); // not used - documentation purposes only Timeout += System.Environment.TickCount; MovePoint = WoWMovement.CalculatePointFrom(MovePoint, -15); ZoneText = StyxWoW.Me.ZoneText; } catch (Exception except) { // Maintenance problems occur for a number of reasons. The primary two are... // * Changes were made to the behavior, and boundary conditions weren't properly tested. // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes. // In any case, we pinpoint the source of the problem area here, and hopefully it // can be quickly resolved. UtilLogMessage("error", "BEHAVIOR MAINTENANCE PROBLEM: " + except.Message + "\nFROM HERE:\n" + except.StackTrace + "\n"); IsAttributeProblem = true; } }
private bool MoveToUnit(WoWUnit unit, int howClose) { // slog("MoveToUnit: moving to {0}:{1} thats {2:F2} yds away", unit.IsPlayer ? "player" : "npc", Safe_UnitName(unit), unit.Distance); WoWPoint newPoint = WoWMovement.CalculatePointFrom(unit.Location, howClose); return(MoveTo(unit.Location)); // WoWMovement.ClickToMove(newPoint); }
private static void safeMoveTo(WoWUnit unit, float range) { try { WoWPoint movePoint = WoWMovement.CalculatePointFrom(unit.Location, range); if (Navigator.GeneratePath(Me.Location, movePoint).Length == 0) { Log("Can not generate navigation path to tank. Something wrong with mesh"); errorCount++; if (errorCount > 50) { warningSound(); } } else { errorCount = 0; soundPlayed = false; Navigator.MoveTo(movePoint); Thread.Sleep(100); } } catch (System.Threading.ThreadAbortException) { throw; } catch (Exception c) { Log("This instance has not been meshed yet"); dLog("{0}", c); warningSound(); } }
// Distract public void Distract() { WoWPoint distractPoint = WoWMovement.CalculatePointFrom(Me.CurrentTarget.Location, -4.0f); SpellManager.Cast("Distract"); LegacySpellManager.ClickRemoteLocation(distractPoint); slog("Skill: Distract"); }
static public void findAndPickupObject() { ObjectManager.Update(); List <WoWGameObject> objList = ObjectManager.GetObjectsOfType <WoWGameObject>() .Where(o => (o.Distance <= 150 && (CollectHerbs && o.Entry == 185881 && Me.GetSkill(SkillLine.Herbalism).CurrentValue >= 350) || (CollectOre && o.Entry == 185877 && Me.GetSkill(SkillLine.Mining).CurrentValue >= 350) || (CollectEggs && o.Entry == 185915) )) .OrderBy(o => o.Distance).ToList(); foreach (WoWGameObject o in objList) { MoveToLoc(WoWMovement.CalculatePointFrom(o.Location, -4)); if (inCombat) { if (Me.Mounted) { Mount.Dismount(); } return; } o.Interact(); Thread.Sleep(GetPing * 2 + 250); while (!inCombat && Me.IsCasting) { Thread.Sleep(100); } Stopwatch lootTimer = new Stopwatch(); // wait for loot frame to apear lootTimer.Reset(); lootTimer.Start(); while (LootFrame.Instance == null || !LootFrame.Instance.IsVisible) { if (lootTimer.ElapsedMilliseconds > 5000) { Log("Loot window never showed up!"); return; } Thread.Sleep(100); } Lua.DoString("for i=1,GetNumLootItems() do ConfirmLootSlot(i) LootSlot(i) end"); // wait for lootframe to close lootTimer.Reset(); lootTimer.Start(); Lua.DoString("StaticPopup1Button1:Click()"); while (LootFrame.Instance != null && LootFrame.Instance.IsVisible) { Thread.Sleep(100); if (lootTimer.ElapsedMilliseconds > 5000) { Log(Colors.Red, "looks like you have some addon interfering with loot. Disable any looting addons pls"); return; } } } }
public static void DarkSoil() { if ((StyxWoW.Me.GetReputationWith(1273) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1275) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1276) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1277) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1278) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1279) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1280) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1281) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1282) > MinimumReputationForBestFriends) && (StyxWoW.Me.GetReputationWith(1283) > MinimumReputationForBestFriends) || (StyxWoW.Me.LevelFraction < 90)) { return; } ObjectManager.Update(); var objList = ObjectManager.GetObjectsOfType <WoWGameObject>().Where(darksoil => (darksoil.Distance2D <= Styx.CommonBot.LootTargeting.LootRadius && (darksoil.Entry == 210565) && darksoil.CanUse())) .OrderBy(darksoil => darksoil.Distance).ToList(); foreach (var darksoil in objList) { if (!darksoil.InLineOfSight) { return; } if (StyxWoW.Me.Combat) { return; } WoWMovement.MoveStop(); MoveToLocation(WoWMovement.CalculatePointFrom(darksoil.Location, 3)); if (!StyxWoW.Me.HasAura(40120) && !StyxWoW.Me.HasAura(33943)) { Flightor.MountHelper.Dismount(); } Thread.Sleep(2000); darksoil.Interact(); Thread.Sleep(3000); Lua.DoString("RunMacroText(\"/click StaticPopup1Button1\");"); Logging.Write(LogLevel.Normal, Colors.DarkRed, "[LiquidTreasure 2]: Opened a {0} with ID {1}", darksoil.Name, darksoil.Entry); if (!Flightor.MountHelper.Mounted) { Flightor.MountHelper.MountUp(); } return; } }
private static Composite CreateSummonBlackOxStatueBehavior(UnitSelectionDelegate on) { if (!SpellManager.HasSpell("Summon Black Ox Statue")) { return(new ActionAlwaysFail()); } return(new Throttle( 8, new Decorator( req => !Spell.IsSpellOnCooldown("Summon Black Ox Statue"), new PrioritySelector( ctx => _statue = FindStatue(), new Decorator( req => _statue == null || (Me.GotTarget() && _statue.SpellDistance(on(req)) > 30), new Throttle( 10, new PrioritySelector( ctx => on(ctx), Spell.CastOnGround( "Summon Black Ox Statue", loc => { WoWUnit unit = on(loc); Vector3 locStatue = WoWMovement.CalculatePointFrom(unit.Location, -5); if (locStatue.Distance(Me.Location) > 30) { float needFacing = Styx.Helpers.WoWMathHelper.CalculateNeededFacing(Me.Location, locStatue); locStatue = locStatue.RayCast(needFacing, 30f); } return locStatue; }, req => req != null, false, desc => string.Format("{0:F1} yds from {1}", 5, (desc as WoWUnit).SafeName()) ) ) ) ) ) ) )); }
private static void NavigateToRuneforge() { if (Runeforge == null) { Runeforge = ObjectManager.GetObjectsOfTypeFast <WoWObject>().FirstOrDefault(runeforge => runeforge.IsValid && runeforge.Entry == GetRandomRuneforge()); } if (Runeforge == null || Runeforge.WithinInteractRange) { return; } var runeforgeLocation = WoWMovement.CalculatePointFrom(Runeforge.Location, 7f); Navigator.MoveTo(runeforgeLocation); }
private bool CheckPartyRange() { foreach (var p in StyxWoW.Me.GroupInfo.RaidMembers.Select(a => a.ToPlayer())) { if (p == null) { Logging.Write(Colors.DeepSkyBlue, "[LoadProfileOn]: Can't scan party member, assuming member is too far away"); return(false); } if (p.Name != Me.Name && WoWMovement.CalculatePointFrom(p.Location, 0).DistanceSqr(Me.Location) > p.InteractRange) { return(false); } } return(true); }
private bool CheckPartyRange() { foreach (var p in StyxWoW.Me.GroupInfo.RaidMembers.Select(a => a.ToPlayer())) { if (p == null) { QBCLog.Info("Can't scan party member, assuming member is too far away"); return(false); } if (p.Guid != Me.Guid && WoWMovement.CalculatePointFrom(p.Location, 0).DistanceSqr(Me.Location) > p.InteractRange) { return(false); } } return(true); }
public static void AncientGuoLaiCache() { if (StyxWoW.Me.GetReputationWith(1269) > MinimumReputationForExalted) { return; } ObjectManager.Update(); var objList = ObjectManager.GetObjectsOfType <WoWGameObject>().Where(ancientguolaicache => (ancientguolaicache.Distance2D <= Styx.CommonBot.LootTargeting.LootRadius && (ancientguolaicache.Entry == 214388))) .OrderBy(ancientguolaicache => ancientguolaicache.Distance).ToList(); foreach (var ancientguolaicache in objList) { if (!AncientGuoLaiCacheKey()) { return; } if (!ancientguolaicache.InLineOfSight) { return; } if (StyxWoW.Me.Combat) { return; } WoWMovement.MoveStop(); MoveToLocation(WoWMovement.CalculatePointFrom(ancientguolaicache.Location, 3)); if (!StyxWoW.Me.HasAura(40120) && !StyxWoW.Me.HasAura(33943)) { Flightor.MountHelper.Dismount(); } Thread.Sleep(1000); ancientguolaicache.Interact(); Thread.Sleep(3000); Lua.DoString("RunMacroText(\"/click StaticPopup1Button1\");"); Logging.Write(LogLevel.Normal, Colors.DarkRed, "[LiquidTreasure 2]: Opened a {0} with ID {1}", ancientguolaicache.Name, ancientguolaicache.Entry); if (!Flightor.MountHelper.Mounted) { Flightor.MountHelper.MountUp(); } return; } }
public static void NetherwingEgg() { if (StyxWoW.Me.GetReputationWith(1015) > MinimumReputationForExalted) { return; } ObjectManager.Update(); var objList = ObjectManager.GetObjectsOfType <WoWGameObject>().Where(netherwingegg => (netherwingegg.Distance2D <= Styx.CommonBot.LootTargeting.LootRadius && (netherwingegg.Entry == 185915) && netherwingegg.CanUse())) .OrderBy(netherwingegg => netherwingegg.Distance).ToList(); foreach (var netherwingegg in objList) { if (!netherwingegg.InLineOfSight) { return; } if (StyxWoW.Me.Combat) { return; } WoWMovement.MoveStop(); MoveToLocation(WoWMovement.CalculatePointFrom(netherwingegg.Location, 3)); if (!StyxWoW.Me.HasAura(40120) && !StyxWoW.Me.HasAura(33943)) { Flightor.MountHelper.Dismount(); } Thread.Sleep(1000); netherwingegg.Interact(); Thread.Sleep(2000); Logging.Write(LogLevel.Normal, Colors.DarkRed, "[LiquidTreasure 2]: Opened a {0} with ID {1}", netherwingegg.Name, netherwingegg.Entry); if (!Flightor.MountHelper.Mounted) { Flightor.MountHelper.MountUp(); } return; } }
private static Composite CreateFollowBehavior() { return(new PrioritySelector( new Decorator(ret => !LazyRaiderSettings.Instance.FollowTank, new ActionAlwaysSucceed()), new Decorator(ret => !IsInGroup, new ActionAlwaysSucceed()), new Decorator(ret => Tank.Current == null, new ActionAlwaysSucceed()), new Decorator(ret => Me.CurrentHealth <= 1, // if dead or ghost new ActionAlwaysSucceed()), new Decorator(ret => Tank.Health <= 1, // if dead or ghost new ActionAlwaysSucceed()), new Decorator(ret => NeedToMount(), new Action(delegate { WaitForMount(); })), new Decorator(ret => NeedToDismount(), new Action(delegate { WaitForDismount(); })), new Decorator(ret => Tank.Distance > LazyRaiderSettings.Instance.FollowDistance || (RaFHelper.Leader != null && !RaFHelper.Leader.InLineOfSpellSight), new Action(delegate { WoWPoint pt = Tank.Location; if (pt.DistanceSqr(_lastDest) > 1 || !Me.IsMoving) { _lastDest = pt; WoWPoint newPoint = WoWMovement.CalculatePointFrom(pt, (float)0.85 * LazyRaiderSettings.Instance.FollowDistance); Log("move to tank @ {0:F1} yds", pt.Distance(Me.Location)); if (RaFHelper.Leader != null && RaFHelper.Leader.Mounted && (RaFHelper.Leader.IsFlying || RaFHelper.Leader.IsSwimming)) { Flightor.MoveTo(newPoint); } else { Navigator.MoveTo(newPoint); } botMovement = true; } return RunStatus.Success; })), new Decorator(ret => Me.IsMoving && botMovement, new Action(delegate { botMovement = false; while (IsGameStable() && Me.IsMoving) { WoWMovement.MoveStop(); if (Me.IsMoving) { System.Threading.Thread.Sleep(25); } } return RunStatus.Success; })) )); }
public void findAndTameMob() { if (Rarekiller.Settings.DeveloperLogs) { Logging.WriteDebug("Rarekiller: Scan for Tamer"); } ObjectManager.Update(); List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(o => ( ((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.Dead && !Blacklist.Contains(o.Guid)) { Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller Part Tamer: Found a new Pet {0} ID {1}", o.Name, o.Entry); if (Rarekiller.inCombat) { Logging.Write("Rarekiller Part Tamer: ... but I'm in another Combat :( !!!"); return; } if (Me.Level < o.Level) { Logging.Write("Rarekiller Part Tamer: Mob Level is higher then mine, can't tame the Mob."); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 60 Minutes."); return; } if (Me.IsOnTransport) { Logging.Write("Rarekiller Part Tamer: ... but I'm on a Transport."); return; } while (Me.IsCasting) { Thread.Sleep(100); } if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(o.Entry))) { Logging.Write("Rarekiller Part Tamer: {0} is Member of the BlacklistedMobs.xml", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 15 Minutes."); return; } //Dismiss Pet SpellManager.Cast("Dismiss Pet"); Thread.Sleep(3000); 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 Tamer: playing Soundfile failes"); } } WoWPoint newPoint = WoWMovement.CalculatePointFrom(o.Location, (float)Rarekiller.Settings.Tamedistance); if (o.Entry == 49822) { ForceGround = true; } Logging.Write("Rarekiller Part MoveTo: Move to target"); BlacklistTimer.Reset(); BlacklistTimer.Start(); Place = Me.ZoneId; while (newPoint.Distance(Me.Location) > Rarekiller.Settings.Tamedistance) { if (Rarekiller.Settings.GroundMountMode || ForceGround) { Navigator.MoveTo(newPoint); } else { Flightor.MoveTo(newPoint); } Thread.Sleep(100); if (Rarekiller.inCombat) { return; } if (Rarekiller.Settings.BlacklistCheck && (BlacklistTimer.Elapsed.TotalSeconds > (Convert.ToInt32(Rarekiller.Settings.BlacklistTime)))) { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Tamer: Can't reach Mob {0}, Blacklist and Move on", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); 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 Mob for 5 Minutes."); BlacklistTimer.Reset(); WoWMovement.MoveStop(); return; } } BlacklistTimer.Reset(); Thread.Sleep(300); WoWMovement.MoveStop(); if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } Thread.Sleep(150); o.Target(); if (Rarekiller.Settings.ScreenTamer && Rarekiller.Settings.ScreenFound) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(300); Logging.WriteDebug("Rarekiller Part Tamer: Take Screenshot before tame"); } while (!o.IsPet) { if (o.Dead) { Logging.Write("Rarekiller Part Tamer: Mob was dying, I'm so Sorry !!! "); return; } if (Me.HealthPercent < 10) { Logging.Write("Rarekiller Part Tamer: Health < 10% , Use Feign Death !!! "); SpellManager.Cast("Feign Death"); return; } if (!Me.IsCasting) { WoWMovement.MoveStop(); SpellManager.Cast("Tame Beast"); Logging.Write("Plugin Part The Tamer: Try to tame Beast {0}", o.Name); Thread.Sleep(1500); } } Logging.Write("Rarekiller Part Tamer: Sucessfully tamed Beast {0}", o.Name); if (Rarekiller.Settings.ScreenTamer && Rarekiller.Settings.ScreenSuccess) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(500); Logging.WriteDebug("Rarekiller Part Tamer: Take Screenshot after tame"); } } else if (o.IsPet) { return; } else { Logging.Write("Rarekiller Part Tamer: Find a Mob, but sadly he's dead, blacklistet or not tameable: {0}", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 5 Minutes."); return; } } }
public static Composite CreateSlowMeleeBehavior() { return(new PrioritySelector( ctx => SafeArea.NearestEnemyMobAttackingMe, new Decorator( ret => ret != null, new Throttle(2, new PrioritySelector( Spell.Buff("Void Tendrils", onUnit => (WoWUnit)onUnit, req => true), Spell.Buff("Psychic Horror", onUnit => (WoWUnit)onUnit, req => true), Spell.CastOnGround("Psyfiend", loc => ((WoWUnit)loc).Distance <= 20 ? ((WoWUnit)loc).Location : WoWMovement.CalculatePointFrom(((WoWUnit)loc).Location, (float)((WoWUnit)loc).Distance - 20), req => ((WoWUnit)req) != null, false ) ) ) ) )); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( // done with QB? new Decorator(ret => IsQuestComplete(), new PrioritySelector( new Decorator(ret => Location.Distance(Me.Location) > 3, new Action(ret => Navigator.MoveTo(Location))), new Decorator(ret => !HasAura(Me, 82924) && 1000 < _bombWait.ElapsedMilliseconds && _bombWait.ElapsedMilliseconds > 12000, new Action(ret => _isBehaviorDone = true)), new Action(delegate { TreeRoot.StatusText = "Waiting for Living Bomb - " + Location; if (!_bombWait.IsRunning) { _bombWait.Start(); } }) ) ), // move to safe spot initially new Decorator(ret => !_moveToCoordYet, new PrioritySelector( new Decorator(ret => Location.Distance(Me.Location) < 3, new Action(ret => _moveToCoordYet = true)), new Sequence( new Action(delegate { TreeRoot.StatusText = "Move to start - " + Location; }), new Action(ret => Navigator.MoveTo(Location))) ) ), // have current mob new Decorator(ret => Mob != null, new PrioritySelector( // target quest mob new Decorator(ret => Mob != null && Mob != Me.CurrentTarget, new Action(ret => (Mob as WoWUnit).Target())), // need to move ( timer or aura ) new Decorator(ret => _castTime.ElapsedMilliseconds > 5000 || HasAura(Mob as WoWUnit, AuraId), new PrioritySelector( // if at safe spot then wait new Decorator(ret => Location.Distance(Me.Location) < 3, new Action(delegate { if (!HasAura(Mob as WoWUnit, AuraId)) { TreeRoot.StatusText = "Wait to see - " + Mob.Name; } else { TreeRoot.StatusText = "Wait till clear - " + Mob.Name; _castTime.Reset(); // clear timer now that we see aura } })), new Action(delegate { TreeRoot.StatusText = "Move away to - " + Location; Navigator.MoveTo(Location); })) ), // need to attack new PrioritySelector( new Decorator(ret => Mob.Distance > Range, new Action(delegate { TreeRoot.StatusText = "Moving in - " + Mob.Name; Navigator.MoveTo(WoWMovement.CalculatePointFrom(Mob.Location, (float)(Range - 1))); })), new Decorator(ret => Me.IsMoving, new Action(delegate { WoWMovement.MoveStop(); StyxWoW.SleepForLagDuration(); })), new Decorator(ret => _castTime.IsRunning, new Action(ret => 0)), new Action(delegate { TreeRoot.StatusText = "Using item on - " + Mob.Name; (Mob as WoWUnit).Target(); if (Item == null) { LogMessage("fatal", "Could not locate ItemId({0}) in inventory.", ItemId); return; } WoWMovement.Face(Mob.Guid); Item.UseContainerItem(); _castTime.Start(); StyxWoW.SleepForLagDuration(); }) ) ) ) ) )); }
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; } }
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()))))); }
//degrees = radians * 180 / Math.PI public override void Pull() { try { //if (initialized == false) //{ // Initialize(); //} bgTargetCheck(); getAdds(); slog("Starting Pull"); if (!Me.Combat && Me.GotTarget) { slog("Safe location is saved"); prevPrevSafePoint = prevSafePoint; prevSafePoint = safePoint; safePoint = Me.Location; } slog("PVP Checked"); if (Blacklist.Contains(Me.CurrentTarget.Guid)) { slog("Target is blacklisted"); Styx.Logic.Blacklist.Add(Me.CurrentTarget.Guid, System.TimeSpan.FromSeconds(30)); Me.ClearTarget(); //pullGuid = 0; } if (Me.CurrentTarget.Guid != lastGuid) { slog("Pull starting. Target is new"); pullTimer.Reset(); pullTimer.Start(); lastGuid = Me.CurrentTarget.Guid; if (Me.CurrentTarget.IsPlayer) { slog("Pull: Killing Player at distance " + Math.Round(Me.CurrentTarget.Distance).ToString() + ""); } slog("Pull: Killing " + Me.CurrentTarget.Name + " at distance " + Math.Round(Me.CurrentTarget.Distance).ToString() + ""); pullTimer.Reset(); pullTimer.Start(); } if (!Me.CurrentTarget.IsPlayer && Me.CurrentTarget.CurrentHealth > 95 && 30 * 1000 < pullTimer.ElapsedMilliseconds) { slog(" This " + Me.CurrentTarget.Name + " is a bugged mob. Blacklisting for 1 hour."); Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromHours(1.00)); Me.ClearTarget(); //pullGuid = 0; if (Me.Location.Distance(safePoint) >= 30) { slog("Try to move to safePoint"); SafeMoveToPoint(safePoint, 10000); } else if (Me.Location.Distance(prevSafePoint) >= 30) { slog("Try to move to prevSafePoint"); SafeMoveToPoint(prevSafePoint, 10000); } else if (Me.Location.Distance(prevPrevSafePoint) >= 30) { slog("Try to move to prevPrevSafePoint"); SafeMoveToPoint(prevPrevSafePoint, 10000); } else { slog("Can't move to locations"); } } if (SSSettings.Instance.UseDistract && SpellManager.CanCast("Distract")) { if (Me.IsAlive && Me.GotTarget && !Me.Combat) { if (Me.CurrentTarget.Distance > 4 && Me.CurrentTarget.Distance < 30) { Distract(); } } } if (!Me.Combat && targetDistance > 4 && targetDistance < Styx.Logic.Targeting.PullDistance + 10) { slog("Move to target"); int a = 0; float pullRange = 3.5f + StyxWoW.Me.CurrentTarget.BoundingRadius; while (a < 50 && ObjectManager.Me.IsAlive && ObjectManager.Me.GotTarget && ObjectManager.Me.CurrentTarget.Distance > pullRange) { if (ObjectManager.Me.Combat) { slog("Combat has started. Abandon pull."); break; } WoWMovement.Face(); Navigator.MoveTo(WoWMovement.CalculatePointFrom(ObjectManager.Me.CurrentTarget.Location, 3f /* + Me.CurrentTarget.BoundingRadius */)); StyxWoW.SleepForLagDuration(); ++a; } } else { WoWMovement.MoveStop(); WoWMovement.Face(); } if (Me.GotTarget && targetDistance <= 5 && !Me.IsAutoAttacking) { slog("Final state of pulling"); if (attackPoint != WoWPoint.Empty) { Navigator.MoveTo(attackPoint); } if (!PocketPicked) { if (SSSettings.Instance.UsePickPocket && SpellManager.CanCast("Pick Pocket") && Me.GotTarget && targetDistance <= 5 && !Me.CurrentTarget.IsPlayer) { if (Me.CurrentTarget.CreatureType == WoWCreatureType.Humanoid || Me.CurrentTarget.CreatureType == WoWCreatureType.Undead) { slog("Try to pickpocket"); PickPocket(); Thread.Sleep(1000); PocketPicked = true; } } } if (SSSettings.Instance.PullType.Equals(1)) { if (Me.GotTarget && targetDistance <= 5) { if (SpellManager.CanCast("Cheap Shot")) { CheapShot(); } else { Lua.DoString("StartAttack()"); } } } if (SSSettings.Instance.PullType.Equals(2)) { if (SpellManager.CanCast("Ambush") && Me.GotTarget && targetDistance <= 5) { Ambush(); } else if (SpellManager.CanCast("Backstab") && Me.GotTarget && targetDistance <= 5) { Backstab(); } else { Lua.DoString("StartAttack()"); } } if (SSSettings.Instance.PullType.Equals(3)) { if (Me.GotTarget && targetDistance <= 5) { if (SpellManager.CanCast("Garrote")) { Garrote(); } else { Lua.DoString("StartAttack()"); } } } if (SSSettings.Instance.PullType.Equals(4)) { Lua.DoString("StartAttack()"); } if (SSSettings.Instance.PullType.Equals(5)) { Throw(); Lua.DoString("StartAttack()"); } } } finally { slog("Pull done."); PocketPicked = false; fightTimer.Reset(); fightTimer.Start(); } }
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; } }