Beispiel #1
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(


                                     new Decorator(ret => me.QuestLog.GetQuestById(12259) != null && me.QuestLog.GetQuestById(12259).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(12259).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))
                                                               )
                                                           )
                                     )
                             ));
        }
Beispiel #2
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(

                                     new Decorator(ret => Counter >= NumOfTimes,
                                                   new Action(ret => _isBehaviorDone = true)),

                                     new PrioritySelector(

                                         new Decorator(ret => CurrentObject != null && CurrentObject.Location.DistanceSqr(Me.Location) > Range * Range,
                                                       new Sequence(
                                                           new Action(ret => { TreeRoot.StatusText = "Moving to interact with - " + CurrentObject.Name; }),
                                                           new Action(ret => Navigator.MoveTo(CurrentObject.Location))
                                                           )
                                                       ),

                                         new Decorator(ret => CurrentObject != null && CurrentObject.Location.DistanceSqr(Me.Location) <= Range * Range,
                                                       new Sequence(
                                                           new DecoratorContinue(ret => StyxWoW.Me.IsMoving,
                                                                                 new Action(ret =>
            {
                WoWMovement.MoveStop();
                StyxWoW.SleepForLagDuration();
            })),

                                                           new Action(ret =>
            {
                TreeRoot.StatusText = "Interacting with - " + CurrentObject.Name;
                CurrentObject.Interact();
                _npcBlacklist.Add(CurrentObject.Guid);

                Thread.Sleep(2000);
                Counter++;
            }),

                                                           new DecoratorContinue(
                                                               ret => GossipOptions.Length > 0,
                                                               new Action(ret =>
            {
                foreach (var gos in GossipOptions)
                {
                    GossipFrame.Instance.SelectGossipOption(gos);
                    Thread.Sleep(1000);
                }
            })),

                                                           new DecoratorContinue(
                                                               ret => Loot && LootFrame.Instance.IsVisible,
                                                               new Action(ret => LootFrame.Instance.LootAll())),

                                                           new DecoratorContinue(
                                                               ret => BuyItemId != 0 && MerchantFrame.Instance.IsVisible,
                                                               new Action(ret =>
            {
                var items = MerchantFrame.Instance.GetAllMerchantItems();
                var item = items.FirstOrDefault(i => i.ItemId == BuyItemId && (i.BuyPrice * (ulong)BuyItemCount) <= Me.Copper && (i.NumAvailable >= BuyItemCount || i.NumAvailable == -1));

                if (item != null)
                {
                    MerchantFrame.Instance.BuyItem(item.Index, BuyItemCount);
                    Thread.Sleep(1500);
                }
            })),

                                                           new DecoratorContinue(
                                                               ret => BuySlot != -1 && BuyItemId == 0 && MerchantFrame.Instance.IsVisible,
                                                               new Action(ret =>
            {
                var item = MerchantFrame.Instance.GetMerchantItemByIndex(BuySlot);
                if (item != null && (item.BuyPrice * (ulong)BuyItemCount) <= Me.Copper && (item.NumAvailable >= BuyItemCount || item.NumAvailable == -1))
                {
                    MerchantFrame.Instance.BuyItem(BuySlot, BuyItemCount);
                    Thread.Sleep(1500);
                }
            })),
                                                           new DecoratorContinue(
                                                               ret => Me.CurrentTarget != null && Me.CurrentTarget == CurrentObject,
                                                               new Action(ret => Me.ClearTarget())),

                                                           new Action(ret => Thread.Sleep(WaitTime))

                                                           )),

                                         new Decorator(
                                             ret => Location.DistanceSqr(Me.Location) > 2 * 2,
                                             new Sequence(
                                                 new Action(ret => { TreeRoot.StatusText = "Moving towards - " + Location; }),
                                                 new Action(ret => Navigator.MoveTo(Location)))),

                                         new Decorator(
                                             ret => !WaitForNpcs && CurrentObject == null,
                                             new Action(ret => _isBehaviorDone = true)),

                                         new Action(ret => TreeRoot.StatusText = "Waiting for object to spawn")

                                         ))));
        }
Beispiel #3
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =

                                 new PrioritySelector(
                                     // If we've arrived at the destination, we're done...
                                     new Decorator(ret => ((EscortUntil == EscortUntilType.DestinationReached) &&
                                                           (Me.Location.Distance(EscortDestination) <= DestinationTolerance)),
                                                   new Action(delegate
            {
                TreeRoot.StatusText = "Finished!";
                _isBehaviorDone = true;
            })),

                                     // If quest is completed, we're done...
                                     new Decorator(ret => ((EscortUntil == EscortUntilType.QuestComplete) && IsQuestComplete()),
                                                   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,
                                                   new Sequence(
                                                       new Action(ret => TreeRoot.StatusText = "Moving To Location - X: " + Location.X + " Y: " + Location.Y),
                                                       new Action(ret => Navigator.MoveTo(Location)),
                                                       new Action(ret => Thread.Sleep(300))
                                                       )
                                                   ),

                                     new Decorator(ret => Me.CurrentTarget != null && Me.CurrentTarget.IsFriendly,
                                                   new Action(ret => Me.ClearTarget())),

                                     new Decorator(
                                         ret => MobList.Count > 0 && MobList[0].IsHostile,
                                         new PrioritySelector(
                                             new Decorator(
                                                 ret => Me.CurrentTarget != MobList[0],
                                                 new Action(ret =>
            {
                MobList[0].Target();
                StyxWoW.SleepForLagDuration();
            })),
                                             new Decorator(
                                                 ret => !Me.Combat,
                                                 new PrioritySelector(
                                                     new Decorator(
                                                         ret => RoutineManager.Current.PullBehavior != null,
                                                         RoutineManager.Current.PullBehavior),
                                                     new Action(ret => RoutineManager.Current.Pull()))))),


                                     new Decorator(
                                         ret => MobList.Count > 0 && (!Me.Combat || Me.CurrentTarget == null || Me.CurrentTarget.Dead) &&
                                         MobList[0].CurrentTarget == null && MobList[0].DistanceSqr > 5f * 5f,
                                         new Sequence(
                                             new Action(ret => TreeRoot.StatusText = "Following Mob - " + MobList[0].Name + " At X: " + MobList[0].X + " Y: " + MobList[0].Y + " Z: " + MobList[0].Z),
                                             new Action(ret => Navigator.MoveTo(MobList[0].Location)),
                                             new Action(ret => Thread.Sleep(100))
                                             )
                                         ),

                                     new Decorator(ret => MobList.Count > 0 && (Me.Combat || MobList[0].Combat),
                                                   new PrioritySelector(
                                                       new Decorator(
                                                           ret => Me.CurrentTarget == null && MobList[0].CurrentTarget != null,
                                                           new Sequence(
                                                               new Action(ret => MobList[0].CurrentTarget.Target()),
                                                               new Action(ret => StyxWoW.SleepForLagDuration()))),
                                                       new Decorator(
                                                           ret => !Me.Combat,
                                                           new PrioritySelector(
                                                               new Decorator(
                                                                   ret => RoutineManager.Current.PullBehavior != null,
                                                                   RoutineManager.Current.PullBehavior),
                                                               new Action(ret => RoutineManager.Current.Pull())))))

                                     )
                             ));
        }
Beispiel #4
0
        /// <summary>
        /// A Queue for npc's we need to talk to
        /// </summary>
        //private WoWUnit CurrentUnit { get { return ObjectManager.GetObjectsOfType<WoWUnit>().FirstOrDefault(unit => unit.Entry == VehicleId); } }

        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(

                                     new Decorator(ret => (QuestId != 0 && Me.QuestLog.GetQuestById((uint)QuestId) != null &&
                                                           Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted),
                                                   new Action(ret => _isBehaviorDone = true)),

                                     new Decorator(ret => Counter >= 1,
                                                   new Action(ret => _isBehaviorDone = true)),

                                     new PrioritySelector(

                                         new Decorator(ret => IsMounted != true && _vehicleList == null,
                                                       new Action(ctx =>
            {
                WoWPoint destination1 = new WoWPoint(LocationMount.X, LocationMount.Y, LocationMount.Z);
                WoWPoint[] pathtoDest1 = Styx.Logic.Pathing.Navigator.GeneratePath(Me.Location, destination1);

                foreach (WoWPoint p1 in pathtoDest1)
                {
                    while (!Me.Dead && p1.Distance(Me.Location) > 3)
                    {
                        Thread.Sleep(100);
                        WoWMovement.ClickToMove(p1);
                    }
                }

                ObjectManager.Update();
                _vehicleList = ObjectManager.GetObjectsOfType <WoWUnit>()
                               .Where(ret => (ret.Entry == VehicleId) && !ret.Dead).OrderBy(ret => ret.Location.Distance(Me.Location)).ToList();
            })
                                                       ),

                                         new Decorator(ret => _vehicleList[0] != null && !_vehicleList[0].WithinInteractRange && IsMounted != true,
                                                       new Action(ret => Navigator.MoveTo(_vehicleList[0].Location))
                                                       ),

                                         new Decorator(ret => StyxWoW.Me.IsMoving,
                                                       new Action(ret =>
            {
                WoWMovement.MoveStop();
                StyxWoW.SleepForLagDuration();
            })
                                                       ),

                                         new Decorator(ret => IsMounted != true,
                                                       new Action(ctx =>
            {
                MountedPoint = Me.Location;
                _vehicleList[0].Interact();
                StyxWoW.SleepForLagDuration();
                IsMounted = true;

                ObjectManager.Update();
                _vehicleList = ObjectManager.GetObjectsOfType <WoWUnit>()
                               .Where(ret => (ret.Entry == VehicleId) && !ret.Dead).OrderBy(ret => ret.Location.Distance(MountedPoint)).ToList();
                Thread.Sleep(3000);
            })
                                                       ),

                                         new Decorator(ret => IsMounted = true,
                                                       new Action(ret =>
            {
                WoWPoint destination = new WoWPoint(LocationDest.X, LocationDest.Y, LocationDest.Z);
                WoWPoint[] pathtoDest = Styx.Logic.Pathing.Navigator.GeneratePath(_vehicleList[0].Location, destination);

                foreach (WoWPoint p in pathtoDest)
                {
                    while (!_vehicleList[0].Dead && p.Distance(_vehicleList[0].Location) > 3)
                    {
                        Thread.Sleep(100);
                        WoWMovement.ClickToMove(p);
                    }
                }

                Lua.DoString("CastSpellByID(" + SpellCastId + ")");

                Counter++;
            })
                                                       ),

                                         new Action(ret => LogMessage("debug", string.Empty))
                                         )
                                     )));
        }
        public override void Combat()
        {
            if (!StyxWoW.Me.IsInInstance)
            {
                NeedEmergencyHeals();
            }
            if (HandnavisTankadinSettings.Instance.UseTaunt)
            {
                WoWUnit TauntTarget = FindTauntTarget();

                //Credits to fiftypence for basic taunt logic
                if (TauntTarget != null)
                {
                    WoWUnit AlliedTauntTarget = TauntTarget.CurrentTarget;
                    StyxWoW.SleepForLagDuration();
                    if (EnemyUnitsTauntable.Count == 1)
                    {
                        if (TauntTarget.Distance2D <= 30 &&
                            SpellManager.CanCast("Hand of Reckoning"))
                        {
                            SpellManager.Cast("Hand of Reckoning", TauntTarget);
                            Logging.Write(Color.Red, "Hand of Reckoning on " + TauntTarget.Name);
                            return;
                        }
                    }

                    else if (TauntTarget.Distance2D <= 40 &&
                             SpellManager.CanCast("Righteous Defense", AlliedTauntTarget) &&
                             !TauntTarget.HasAura("Hand of Reckoning"))
                    {
                        if (AlliedTauntTarget != null)
                        {
                            SpellManager.Cast("Righteous Defense", AlliedTauntTarget);
                            Logging.Write(Color.Red, "Righteous Defense on " + AlliedTauntTarget.Name);
                            return;
                        }
                    }
                    if (TauntTarget.Distance2D <= 30 &&
                        SpellManager.CanCast("Hand of Reckoning"))
                    {
                        SpellManager.Cast("Hand of Reckoning", TauntTarget);
                        Logging.Write(Color.Red, "Hand of Reckoning on " + TauntTarget.Name);
                        return;
                    }
                }
            }



            adds = detectAdds();
            saveLives();
            if ((Me.CurrentTarget != null && !Me.CurrentTarget.IsFriendly && Me.CurrentTarget.IsAlive == true && adds.Count == 1 && Me.Mounted == false) /*|| (Me.CurrentTarget != null && !Me.CurrentTarget.IsFriendly && Me.CurrentTarget.IsAlive == true && adds.Count == 2 && Me.Mounted == false)*/) //1-2 Mobs
            {
                saveLives();

                if ((HandnavisTankadinSettings.Instance.Faceing == 1 && !StyxWoW.Me.IsInInstance) || HandnavisTankadinSettings.Instance.Faceing == 2)
                {
                    StyxWoW.Me.CurrentTarget.Face();
                }

                if (Me.HealthPercent < 40 && Me.CurrentHolyPower == 3)
                {
                    if (CastSpell("Word of Glory") == true)
                    {
                        Logging.Write(Color.Lime, "Word of Glory");
                    }
                }


                if (StyxWoW.Me.Rooted == true)
                {
                    if (CastSpell("Hand of Freedom") == true)
                    {
                        Logging.Write(Color.Lime, "Hand of Freedom");
                    }
                }


                if (Me.CurrentTarget.IsCasting)
                {
                    if (CastSpell("Rebuke") == true)
                    {
                        Logging.Write(Color.Lime, "Rebuke");
                    }
                }

                if (Me.CurrentTarget.Fleeing)
                {
                    if (CastSpell("Hammer of Justice") == true)
                    {
                        Logging.Write(Color.Lime, "Hammer of Justice");
                    }
                }

                if (Me.CurrentTarget.HealthPercent > 50 && (!Me.IsInInstance || Me.CurrentTarget.Elite))
                {
                    if (CastSpell("Avenging Wrath") == true)
                    {
                        Logging.Write(Color.Lime, "Avenging Wrath");
                    }
                }

                if (Me.CurrentHolyPower == 3 && Me.Auras.ContainsKey("Sacred Duty"))
                {
                    if (StyxWoW.Me.Auras["Sacred Duty"].Duration >= 1)
                    {
                        if (CastSpell("Shield of the Righteous") == true)
                        {
                            Logging.Write(Color.Lime, "Shield of Righteous");
                        }
                    }
                }
                if (Me.CurrentHolyPower == 3)
                {
                    if (CastSpell("Shield of the Righteous") == true)
                    {
                        Logging.Write(Color.Lime, "Shield of Righteous");
                    }
                }


                if (CastSpell("Crusader Strike") == true)
                {
                    Logging.Write(Color.Lime, "Crusader Strike");
                }

                if (Me.Auras.ContainsKey("Grand Crusader"))
                {
                    if (StyxWoW.Me.Auras["Grand Crusader"].Duration >= 1)
                    {
                        if (CastSpell("Avenger's Shield") == true)
                        {
                            Logging.Write(Color.Lime, "Avenger's Shield");
                        }
                    }
                }

                if (CastSpell("Judgement") == true)
                {
                    Logging.Write(Color.Lime, "Judgement");
                }

                if (CastSpell("Avenger's Shield") == true)
                {
                    Logging.Write(Color.Lime, "Avenger's Shield");
                }

                if (Me.CurrentTarget.HealthPercent < 20)
                {
                    if (CastSpell("Hammer of Wrath") == true)
                    {
                        Logging.Write(Color.Lime, "Hammer of Wrath");
                    }
                }
                if (Me.ManaPercent > 50 && Me.CurrentTarget.Distance < 10)
                {
                    if (CastSpell("Holy Wrath") == true)
                    {
                        Logging.Write(Color.Lime, "Holy Wrath");
                    }
                }

                if (Me.ManaPercent > 90 && Me.CurrentTarget.Distance < 5)
                {
                    if (CastSpell("Consecration") == true)
                    {
                        Logging.Write(Color.Lime, "Consecration");
                    }
                }

                if ((HandnavisTankadinSettings.Instance.Movement == 1 && !StyxWoW.Me.IsInInstance) || HandnavisTankadinSettings.Instance.Movement == 2)
                {
                    while (Me.CurrentTarget.Distance > Me.CurrentTarget.InteractRange)
                    {
                        Navigator.MoveTo(Me.CurrentTarget.Location + 0.9f);
                    }
                    Navigator.PlayerMover.MoveStop();
                }
            }

            if (Me.CurrentTarget != null && !Me.CurrentTarget.IsFriendly && Me.CurrentTarget.IsAlive == true && adds.Count > 1 && Me.Mounted == false) //3+ Mobs
            {
                saveLives();
                if ((HandnavisTankadinSettings.Instance.Faceing == 1 && !StyxWoW.Me.IsInInstance) || HandnavisTankadinSettings.Instance.Faceing == 2)
                {
                    StyxWoW.Me.CurrentTarget.Face();
                }

                if (Me.HealthPercent < 40 && Me.CurrentHolyPower == 3)
                {
                    if (CastSpell("Word of Glory") == true)
                    {
                        Logging.Write(Color.Lime, "Word of Glory");
                    }
                }

                if (Me.CurrentTarget.IsCasting)
                {
                    if (CastSpell("Rebuke") == true)
                    {
                        Logging.Write(Color.Lime, "Rebuke");
                    }
                }

                if (Me.CurrentTarget.HealthPercent > 50 && (!Me.IsInInstance || Me.CurrentTarget.Elite))
                {
                    if (CastSpell("Avenging Wrath") == true)
                    {
                        Logging.Write(Color.Lime, "Avenging Wrath");
                    }
                }

                if (Me.CurrentTarget.Fleeing)
                {
                    if (CastSpell("Hammer of Justice") == true)
                    {
                        Logging.Write(Color.Lime, "Hammer of Justice");
                    }
                }

                if (CastSpell("Hammer of the Righteous") == true)
                {
                    Logging.Write(Color.Lime, "Hammer of the Righteous");
                }

                if (!Me.Auras.ContainsKey("Inquisition"))
                {
                    if (CastSpell("Inquisition") == true)
                    {
                        Logging.Write(Color.Lime, "Inquisition");
                    }
                }


                if (Me.ManaPercent > 75 && Me.CurrentTarget.Distance < 5)
                {
                    if (CastSpell("Consecration") == true)
                    {
                        Logging.Write(Color.Lime, "Consecration");
                    }
                }

                if (Me.ManaPercent > 50 && Me.CurrentTarget.Distance < 10)
                {
                    if (CastSpell("Holy Wrath") == true)
                    {
                        Logging.Write(Color.Lime, "Holy Wrath");
                    }
                }

                if (Me.CurrentHolyPower == 3 && Me.Auras.ContainsKey("Inquisition"))
                {
                    if (CastSpell("Shield of the Righteous") == true)
                    {
                        Logging.Write(Color.Lime, "Shield of Righteous");
                    }
                }

                if (CastSpell("Avenger's Shield") == true)
                {
                    Logging.Write(Color.Lime, "Avenger's");
                }

                if (Me.CurrentTarget.HealthPercent < 20)
                {
                    if (CastSpell("Hammer of Wrath") == true)
                    {
                        Logging.Write(Color.Lime, "Hammer of Wrath");
                    }
                }

                if ((HandnavisTankadinSettings.Instance.Movement == 1 && !StyxWoW.Me.IsInInstance) || HandnavisTankadinSettings.Instance.Movement == 2)
                {
                    while (Me.CurrentTarget.Distance > Me.CurrentTarget.InteractRange)
                    {
                        Navigator.MoveTo(Me.CurrentTarget.Location + 0.9f);
                    }
                    Navigator.PlayerMover.MoveStop();
                }
            }
        }
Beispiel #6
0
 protected override Composite CreateBehavior()
 {
     return(_root ?? (_root =
                          new PrioritySelector(
                              new Decorator(
                                  ret => !_wasOnWaitLocation,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => WaitAtLocation.Distance(Me.Location) > 2,
                                          new Sequence(
                                              new Action(ret => TreeRoot.StatusText = "Moving to wait location"),
                                              new Action(ret => Navigator.MoveTo(WaitAtLocation)))),
                                      new Sequence(
                                          new Action(ret => Navigator.PlayerMover.MoveStop()),
                                          new Action(ret => Mount.Dismount()),
                                          new Action(ret => _wasOnWaitLocation = true),
                                          new Action(ret => TreeRoot.StatusText = "Waiting for transport")))),
                              new Decorator(
                                  ret => TransportLocation != WoWPoint.Empty && TransportLocation.Distance(EndLocation) < 2 && _usedTransport,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => Me.Location.Distance(GetOffLocation) > 2,
                                          new Sequence(
                                              new Action(ret => TreeRoot.StatusText = "Moving out of transport"),
                                              new Action(ret => Navigator.PlayerMover.MoveTowards(GetOffLocation)),
                                              new Action(ret => StyxWoW.SleepForLagDuration()),
                                              new DecoratorContinue(
                                                  ret => Me.IsOnTransport,
                                                  new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(50)))))),
                                      new Action(ret => _isBehaviorDone = true))),
                              new Decorator(
                                  ret => Me.IsOnTransport && StandLocation != WoWPoint.Empty && !_usedTransport,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => Me.Location.Distance2D(StandLocation) > 2,
                                          new Sequence(
                                              new Action(ret => TreeRoot.StatusText = "Moving to stand location"),
                                              new Action(ret => Navigator.PlayerMover.MoveTowards(StandLocation)))),
                                      new Sequence(
                                          new Action(ret => _usedTransport = true),
                                          new Action(ret => Navigator.PlayerMover.MoveStop()),
                                          new Action(ret => TreeRoot.StatusText = "Waiting for the end location"))
                                      )),
                              new Decorator(
                                  ret => TransportLocation != WoWPoint.Empty && TransportLocation.Distance(StartLocation) < 2 && !_usedTransport,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => Me.Location.Distance2D(TransportLocation) > 2,
                                          new Sequence(
                                              new Action(ret => TreeRoot.StatusText = "Moving inside transport"),
                                              new Action(ret => Navigator.PlayerMover.MoveTowards(TransportLocation)),
                                              new Action(ret => StyxWoW.SleepForLagDuration()),
                                              new DecoratorContinue(
                                                  ret => !Me.IsOnTransport,
                                                  new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(50)))))),
                                      new Sequence(
                                          new Action(ret => _usedTransport = true),
                                          new Action(ret => Navigator.PlayerMover.MoveStop()),
                                          new Action(ret => TreeRoot.StatusText = "Waiting for the end location"))))
                              )));
 }
Beispiel #7
0
        public override void Pull()
        {
            // Quick Target check to see if ok to pull
            if (Utils.SafeChecks.TargetSafe == false)
            {
                return;
            }

            WoWUnit Target = Me.CurrentTarget;

            // Move closer,  Sap distance is 10ft
            if (Target.Distance > 10 && !Spell.HasMyAura("Sap", StyxWoW.Me.CurrentTarget))
            {
                Managers.NavMan.MoveBehind(Target);
                return;
            }

            // We need to face
            if ((!Me.IsSafelyFacing(Target, 90)) && (!Me.IsMoving))
            {
                Target.Face();
                return;
            }

            // Wait for full energy b4 we burst
            if (StyxWoW.Me.EnergyPercent != 100)
            {
                return;
            }

            // Next we will need to get a sap off to stop the person from moving
            // We have to check if his in combat some how,
            if (ClassSettings._Instance.GeneralToSap)
            {
                if (Target.Combat == false)
                {
                    if ((SpellManager.CanCast("Sap")) && (!Spell.HasMyAura("Sap", Target)) && (Target.IsHumanoid))
                    {
                        if (Spell.Cast("Sap", Target))
                        {
                            StyxWoW.SleepForLagDuration();   // Some reason energy isnt working properly? great..... -> bandade..
                            return;
                        }
                    }
                }
            }

            // We need to check if we are behind and have correct distance.
            if ((!Target.IsPlayerBehind) || !Target.IsWithinMeleeRange)
            {
                Managers.NavMan.MoveBehind(Target);
                return;
            }

            // Do what we need to!
            switch (Managers.Spec.CurrentSpec)
            {
            case eSpec.Subtlety:
                Spec.Subtlety.Pull.Pulse();
                break;
            }
        }
Beispiel #8
0
        public override void Pulse()
        {
            try
            {
                while (IsGameStable() && Styx.Logic.BehaviorTree.TreeRoot.IsRunning && Battlegrounds.IsInsideBattleground)
                {
                    if (Me.CurrentHealth <= 1 || Me.Combat || Me.IsCasting || Battlegrounds.Finished)
                    {
                        return;
                    }

                    if (!haveInitialized)
                    {
                        Initialize();
                    }

                    if (Battlegrounds.Current == BattlegroundType.IoC || Battlegrounds.Current == BattlegroundType.SotA)
                    {
                        slog("battleground '{0}' not supported, running profile only", Battlegrounds.Current.ToString());
                        return;
                    }

                    // during prep period of bg let bot handle buffs, timing, etc
                    if (Me.Auras.ContainsKey("Preparation"))
                    {
                        while (IsGameStable() && Me.CurrentHealth > 1 && RoutineManager.Current.NeedPullBuffs)
                        {
                            slog("Applying Pull Buffs");
                            RoutineManager.Current.PullBuff();
                            StyxWoW.SleepForLagDuration();
                        }

                        while (IsGameStable() && Me.CurrentHealth > 1 && RoutineManager.Current.NeedPreCombatBuffs)
                        {
                            slog("Applying Pre-Combat Buffs");
                            RoutineManager.Current.PreCombatBuff();
                            StyxWoW.SleepForLagDuration();
                        }

                        return;
                    }

                    // battleground is running, so validate our leader
                    if (leader != null)
                    {
                        if (!ObjectManager.ObjectList.Contains(leader) || !leader.IsValid)
                        {
                            slog("leader is no longer in group");
                            leader = null;
                        }
                        else if (leader.CurrentHealth <= 1)
                        {
                            slog("leader died");
                            leader = null;
                        }
                        else if (leader.OnTaxi)
                        {
                            slog("leader is hitching a ride");
                            leader = null;
                        }
                        else if (leader.IsStealthed)
                        {
                            slog("leader is stealthed");
                            leader = null;
                        }
                        else if (leader.Distance > (SquireSettings.Instance.LeaderScanRange + SquireSettings.Instance.LeaderOutOfRange))
                        {
                            slog("leader out of range at {0:F1} yds", leader.Distance);
                            leader = null;
                        }
                    }

                    // no leader? then find one
                    if (leader == null)
                    {
                        if (lastLeadCheck.IsRunning && lastLeadCheck.ElapsedMilliseconds < 2000)
                        {
                            return;
                        }

                        lastLeadCheck.Reset();
                        lastLeadCheck.Start();

                        leader = FindLeader();
                        SetFocus(leader);       // null clears focus
                        if (leader == null)
                        {
                            slog(">>> no leader found, running profile till we find one...");
                            return;
                        }

                        lastLeadMovement = System.Environment.TickCount + (SquireSettings.Instance.StillTimeout * 1000);
                    }

                    // update movement timeout if they are doing something
                    if (leader.IsMoving || leader.IsCasting)
                    {
                        lastLeadMovement = System.Environment.TickCount + (SquireSettings.Instance.StillTimeout * 1000);
                    }

                    // TODO:  check if near an objective, since its okay to wait there in a group
                    // if they havent done anything, bail on the current leader
                    if (lastLeadMovement < System.Environment.TickCount)
                    {
                        slog("leader still for {0} seconds, blacklisting for {1} seconds", SquireSettings.Instance.StillTimeout, SquireSettings.Instance.BlacklistTime);
                        Blacklist.Add(leader, TimeSpan.FromSeconds(SquireSettings.Instance.BlacklistTime));
                        leader = null;
                        continue;
                    }

                    if ((leader.Mounted || leader.Distance > 50) && Me.IsOutdoors && !Me.Mounted && Mount.CanMount())
                    {
                        WaitForMount();
                    }

                    WoWUnit target = null;

                    if (!IsUnitInRange(leader, Me.IsIndoors ? 10 : followDistance))
                    {
                        // slog("leader out of range, moving towards now...");
                        if (movePointDelay.ElapsedMilliseconds > SquireSettings.Instance.MoveDelayMS || (!Me.IsMoving && leader.IsMoving))
                        {
                            movePointDelay.Reset();
                            movePointDelay.Start();
                            if (!MoveToUnit(leader, 5))
                            {
                                slog("Unable to move to leader {0}, resetting...", Safe_UnitName(leader));
                                Blacklist.Add(leader, TimeSpan.FromSeconds(10));
                                leader = null;
                            }
                        }

                        if (!Me.Mounted)
                        {
                            target = FindTarget();
                        }

                        if (target == null)
                        {
                            continue;   // moving now, so just loop and check again in awhile
                        }
                    }

                    if (!leader.Mounted && Me.Mounted)
                    {
                        slog("leader not mounted, dismounting...");
                        WaitForDismount();
                    }


                    if (!leader.Combat && !leader.IsMoving && Me.IsMoving)
                    {
                        slog("leader not moving, stopping...");
                        WaitForStop();
                    }

                    CallPulse();
                    CallRest();
                    CallHeal();
                    // if (GetActualStrategy() == SquireSettings.CombatStrategy.DPS)
                    {
                        // if (!Me.Combat && leader.Combat)
                        {
                            // have a target? Then PULLL!!!!!!!!
                            if (target != null)
                            {
                                CallPull(target);
                            }
                        }
                    }
                }
            }
            catch (InvalidOperationException)
            {
                slog("Leader is no longer valid, resetting...");
                leader = null;
            }
            catch (Exception e)
            {
                slog("An Exception occured. Check debug log for details.");
                Logging.WriteDebug(">>> EXCEPTION");
                Logging.WriteException(e);
            }

            // at this point, they either stopped the bot or we are in Combat

            // now fall through and let default behavior take place
        }
Beispiel #9
0
 //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();
     }
 }
Beispiel #10
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(

                                     // Move to the gameobject if it isn't null and we aren't withing interact range.
                                     new Decorator(ret => GameObject != null && !GameObject.WithinInteractRange,
                                                   new Sequence(
                                                       new Action(ret => TreeRoot.StatusText = "Moving to \"" + GameObject.Name + "\" at location " + GameObject.Location),
                                                       new Action(ret => Navigator.MoveTo(GameObject.Location))
                                                       )
                                                   ),

                                     // Interact etc.
                                     new Decorator(ret => GameObject != null && GameObject.WithinInteractRange,
                                                   // Set the context to the gameobject
                                                   new Sequence(ret => GameObject,

                                                                new DecoratorContinue(ret => StyxWoW.Me.IsMoving,
                                                                                      new Sequence(
                                                                                          new Action(ret => WoWMovement.MoveStop()),
                                                                                          new WaitContinue(5, ret => !StyxWoW.Me.IsMoving,
                                                                                                           new Action(ret => StyxWoW.SleepForLagDuration()))
                                                                                          )),

                                                                new Action(ret => LogMessage("info", "Using Object \"{0}\" {1}/{2} times",
                                                                                             ((WoWGameObject)ret).Name, _counter + 1, NumOfTimes)),
                                                                new Action(ret => ((WoWGameObject)ret).Interact()),
                                                                new Action(ret => StyxWoW.SleepForLagDuration()),
                                                                new Action(ret => Thread.Sleep(WaitTime)),
                                                                new Action(delegate { _counter++; })
                                                                )),

                                     new Decorator(ret => Location != WoWPoint.Empty,
                                                   new Sequence(
                                                       new Action(ret => TreeRoot.StatusText = "Moving to location " + Location.ToString()),
                                                       new Action(ret => Navigator.MoveTo(Location))
                                                       )
                                                   )
                                     )));
        }
Beispiel #11
0
        public void WaitForMount()
        {
            if (Me.Combat || Me.IsIndoors || !LevelbotSettings.Instance.UseMount)
            {
                return;
            }

            WaitForStop();
            WoWPoint ptStop = Me.Location;

            var timeOut = new Stopwatch();

            timeOut.Start();

            if (!Mount.CanMount())
            {
                return;
            }

            slog("Attempting to mount via HB...");
            Mount.MountUp();
            StyxWoW.SleepForLagDuration();
#if MOUNT_HACKS
            if (!Me.IsCasting && !Me.Mounted)
            {
                // HACK #1
                string sMount = LevelbotSettings.Instance.MountName;
                if (string.IsNullOrEmpty(sMount))
                {
                    slog("No mount name entered in HonorBuddy General Settings");
                }
                else
                {
                    slog("Attempting to mount via LUA and configured {0}", sMount);
                    Lua.DoString("/use " + sMount);
                    StyxWoW.SleepForLagDuration();
                }
            }

            if (!Me.IsCasting && !Me.Mounted)
            {
                // HACK #2
                MountHelper.MountWrapper mnt = MountHelper.GroundMounts.FirstOrDefault();
                if (mnt != null)
                {
                    slog("Attempting to mount via LUA and found mount {0}", mnt.Name);
                    Lua.DoString("/use " + mnt.Name);
                    StyxWoW.SleepForLagDuration();
                }
            }
#endif
            while (IsGameStable() && Me.CurrentHealth > 1 && Me.IsCasting)
            {
                Thread.Sleep(75);
            }

            if (!Me.Mounted)
            {
                slog("unable to mount after {0} ms", timeOut.ElapsedMilliseconds);
                if (ptStop.Distance(Me.Location) != 0)
                {
                    slog("character was stopped but somehow moved {0:F3} yds while trying to mount", ptStop.Distance(Me.Location));
                }
            }
            else
            {
                slog("Mounted");
            }
        }
Beispiel #12
0
        private void PoisonKnives()
        {
            LocalPlayer Me         = ObjectManager.Me;
            bool        needpoison = false;
            WoWItem     mainhand   = Me.Inventory.Equipped.MainHand;
            WoWItem     offhand    = Me.Inventory.Equipped.OffHand;

            // If you're not at least level 10, you can't poison knives anyway.
            if (Me.Level < 10)
            {
                return;
            }

            // Leave early if neither weapon needs poison.
            if (mainhand != null && mainhand.TemporaryEnchantment.Id == 0)
            {
                needpoison = true;
            }
            if (offhand != null && offhand.TemporaryEnchantment.Id == 0)
            {
                needpoison = true;
            }
            if (needpoison == false)
            {
                return;
            }

            // Get the poisons available
            String mainhandpoison = FirstAvailableItem(mainhandpoisons);
            String offhandpoison  = FirstAvailableItem(offhandpoisons);

            // Leave early if no poison is available
            if (mainhandpoison == null)
            {
                log(Color.Red, "Out of main hand poison! Buy more.");
            }
            if (offhandpoison == null)
            {
                log(Color.Red, "Out of off hand poison! Buy more.");
            }
            if (mainhandpoison == null && offhandpoison == null)
            {
                return;
            }

            // Stop moving
            WoWMovement.MoveStop();
            StyxWoW.SleepForLagDuration();

            // Get off horse
            if (Me.Mounted)
            {
                Mount.Dismount();
                StyxWoW.SleepForLagDuration();
            }

            // Apply poison to main weapon
            if (mainhandpoison != null)
            {
                ApplyMainPoison(mainhandpoison);
            }

            // Apply poison to offhand weapon
            if (offhandpoison != null)
            {
                ApplyOffhandPoison(offhandpoison);
            }
        }
Beispiel #13
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =

                                 new PrioritySelector(ctx => Object,

                                                      new Decorator(ctx => ctx != null && (((WoWObject)ctx).Distance > InteractRange || !((WoWObject)ctx).InLineOfSight),
                                                                    new Sequence(
                                                                        new Action(ctx => TreeRoot.StatusText = "Moving to use item on - " + ((WoWObject)ctx).Name),
                                                                        new Action(ctx => Navigator.MoveTo(((WoWObject)ctx).Location)))),

                                                      new Decorator(ctx => ctx != null && ((WoWObject)ctx).Distance <= InteractRange,
                                                                    new Sequence(
                                                                        new DecoratorContinue(c => StopMovingOnUse && Me.IsMoving,
                                                                                              new Sequence(
                                                                                                  new Action(ctx => WoWMovement.MoveStop()),
                                                                                                  new WaitContinue(5, ctx => !Me.IsMoving,
                                                                                                                   new Action(ctx => StyxWoW.SleepForLagDuration()))
                                                                                                  )),

                                                                        new Sequence(ctx => StyxWoW.Me.CarriedItems.FirstOrDefault(ret => ret.Entry == ItemId),
                                                                                     // Set the status text.
                                                                                     new Action(ctx => TreeRoot.StatusText = "Using item on " + Object.Name),

                                                                                     // If we don't have the item stop!
                                                                                     new DecoratorContinue(ctx => ctx == null,
                                                                                                           new Action(ctx => LogMessage("fatal", "Could not find ItemId({0}) in inventory.", ItemId))),

                                                                                     new DecoratorContinue(ctx => Object.Type == WoWObjectType.Unit,
                                                                                                           new Action(ctx => Object.ToUnit().Target())),

                                                                                     // Face the object.
                                                                                     new Action(ctx => WoWMovement.Face(Object.Guid)),

                                                                                     // Use the item.
                                                                                     new Action(ctx => ((WoWItem)ctx).UseContainerItem()),

                                                                                     new DecoratorContinue(ctx => HasGroundTarget,
                                                                                                           new Action(ctx => LegacySpellManager.ClickRemoteLocation(Object.Location))),

                                                                                     new WaitContinue(6, ctx => false,
                                                                                                      new Sequence(
                                                                                                          new Action(ctx => StyxWoW.SleepForLagDuration()),
                                                                                                          new Action(ctx => _npcBlacklist.Add(Object.Guid)),
                                                                                                          new Action(ctx => _waitTimer.Reset()),

                                                                                                          new DecoratorContinue(ctx => !_waitTimer.IsRunning,
                                                                                                                                new Action(ctx => _waitTimer.Start())),

                                                                                                          new Action(ctx => Counter++)
                                                                                                          )
                                                                                                      )
                                                                                     )
                                                                        )),

                                                      new Sequence(
                                                          new Action(ctx => LogMessage("info", "Moving to {0}", Location)),
                                                          new Action(ctx => Navigator.MoveTo(Location))
                                                          )
                                                      )));
        }
Beispiel #14
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(

                                     new Decorator(ret => Counter >= 1,
                                                   new Action(ret => _isBehaviorDone = true)),

                                     new PrioritySelector(

                                         new Decorator(ret => Counter > 0,
                                                       new Sequence(
                                                           new Action(ret => TreeRoot.StatusText = "Finished!"),
                                                           new Action(ret => _isBehaviorDone = true),
                                                           new WaitContinue(1,
                                                                            new Action(delegate
            {
                _isBehaviorDone = true;
                return RunStatus.Success;
            }))
                                                           )
                                                       ),

                                         new Decorator(ret => MobList.Count > 0 && !MobList[0].WithinInteractRange && IsMoveToMob,
                                                       new Sequence(
                                                           new DecoratorContinue(ret => IsMoveToMob,
                                                                                 new Sequence(
                                                                                     new Action(ret => TreeRoot.StatusText = "Moving To Mob MyCTM - " + MobList[0].Name + " X: " + MobList[0].X + " Y: " + MobList[0].Y + " Z: " + MobList[0].Z),
                                                                                     new Action(ret => WoWMovement.ClickToMove(MobList[0].Location))
                                                                                     )),

                                                           new DecoratorContinue(ret => !IsMoveToMob,
                                                                                 new Sequence(
                                                                                     new Action(ret => TreeRoot.StatusText = "Moving To Mob MyCTM - " + MobList[0].Name + " X: " + MobList[0].X + " Y: " + MobList[0].Y + " Z: " + MobList[0].Z),
                                                                                     new Action(ret => Navigator.MoveTo(MobList[0].Location))
                                                                                     ))


                                                           )),

                                         new Decorator(ret => MobList.Count > 0 && MobList[0].WithinInteractRange,
                                                       new Sequence(
                                                           new DecoratorContinue(ret => StyxWoW.Me.IsMoving,
                                                                                 new Action(ret =>
            {
                WoWMovement.MoveStop();
                StyxWoW.SleepForLagDuration();
            })),
                                                           new Action(ret => MobList[0].Interact()),
                                                           new Action(ret => Counter++)
                                                           )
                                                       ),

                                         new Decorator(ret => (MobList.Count > 0) && !IsMoveToMob && !UseLuaTarget,
                                                       new Sequence(
                                                           new DecoratorContinue(ret => StyxWoW.Me.IsMoving,
                                                                                 new Action(ret =>
            {
                WoWMovement.MoveStop();
                StyxWoW.SleepForLagDuration();
            })),
                                                           new Action(ret => MobList[0].Interact()),
                                                           new Action(ret => Counter++)
                                                           )
                                                       ),

                                         new Decorator(ret => MobList.Count > 0 && UseLuaTarget,
                                                       new Sequence(
                                                           new DecoratorContinue(ret => StyxWoW.Me.IsMoving,
                                                                                 new Action(ret =>
            {
                WoWMovement.MoveStop();
                StyxWoW.SleepForLagDuration();
            })),
                                                           new Action(ret => Lua.DoString("TargetNearest()")),
                                                           new Action(ret => Me.CurrentTarget.Interact()),
                                                           new Action(ret => Counter++)
                                                           )
                                                       )
                                         ))));
        }
Beispiel #15
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(

                                     new Decorator(ret => Counter > NumOfTimes && QuestId == 0,
                                                   new Action(ret => _isBehaviorDone = true)),

                                     new Decorator(
                                         ret => UseType == QBType.Current,
                                         new PrioritySelector(
                                             new Decorator(
                                                 new Sequence(
                                                     new Action(ret => TreeRoot.StatusText = "Using Pet Ability:" + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                     new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                     new Action(ret => StyxWoW.SleepForLagDuration()),
                                                     new Action(ret => Lua.DoString("CastPetAction({0})", AttackButton)),
                                                     new Action(ret => StyxWoW.SleepForLagDuration()),
                                                     new Action(ret => Counter++),
                                                     new Action(ret => Thread.Sleep(WaitTime)))
                                                 ))),

                                     new Decorator(
                                         ret => UseType == QBType.Location,
                                         new PrioritySelector(
                                             new Decorator(
                                                 ret => Me.Location.Distance(MoveToLocation) > 3,
                                                 new Sequence(
                                                     new Action(ret => TreeRoot.StatusText = "Moving To Use Ability at Location, Distance: " + MoveToLocation.Distance(Me.Location)),
                                                     new Action(ret => Navigator.MoveTo(MoveToLocation)))),
                                             new Sequence(
                                                 new Action(ret => TreeRoot.StatusText = "Using Pet Ability At Location:" + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                 new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                 new Action(ret => StyxWoW.SleepForLagDuration()),
                                                 new Action(ret => Lua.DoString("CastPetAction({0})", AttackButton)),
                                                 new Action(ret => StyxWoW.SleepForLagDuration()),
                                                 new Action(ret => Counter++),
                                                 new Action(ret => Thread.Sleep(WaitTime)))
                                             )),

                                     new Decorator(
                                         ret => UseType == QBType.ToObject,
                                         new PrioritySelector(
                                             new Decorator(
                                                 ret => UseObject == null && Me.Location.DistanceSqr(MoveToLocation) >= 2 * 2,
                                                 new Sequence(
                                                     new Action(ret => TreeRoot.StatusText = "Moving To Use Ability around Location. Distance: " + MoveToLocation.Distance(Me.Location)),
                                                     new Action(ret => Navigator.MoveTo(MoveToLocation)))),
                                             new Decorator(
                                                 ret => UseObject != null,
                                                 new PrioritySelector(
                                                     new Decorator(
                                                         ret => UseObject.DistanceSqr >= Range * Range,
                                                         new Sequence(
                                                             new Action(ret => TreeRoot.StatusText = "Moving closer to the Target, Distance: " + MoveToLocation.Distance(Me.Location)),
                                                             new Action(ret => Navigator.MoveTo(UseObject.Location)))),
                                                     new Decorator(
                                                         ret => UseObject.DistanceSqr < MinRange * MinRange,
                                                         new Sequence(
                                                             new Action(ret => TreeRoot.StatusText = "Too Close, Backing Up"),
                                                             new Action(ret => Navigator.MoveTo(WoWMathHelper.CalculatePointFrom(Me.Location, UseObject.Location, (float)MinRange + 2f)))
                                                             )),
                                                     new Sequence(
                                                         new Action(ret => TreeRoot.StatusText = "Using Pet Ability On Target : " + UseObject.Name + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                         new Action(ret => UseObject.Target()),
                                                         new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                         new Action(ret => UseObject.Face()),
                                                         new Action(ret => StyxWoW.SleepForLagDuration()),
                                                         new Action(ret => Lua.DoString("CastPetAction({0})", AttackButton)),
                                                         new Action(ret => Counter++),
                                                         new Action(ret => StyxWoW.SleepForLagDuration()),
                                                         new Action(ret => _npcBlacklist.Add(UseObject.Guid)),
                                                         new Action(ret => Thread.Sleep(WaitTime))))),
                                             new Action(ret => TreeRoot.StatusText = "No objects around. Waiting")
                                             ))
                                     )));
        }
Beispiel #16
0
        private void OnSpellFired(bool success, bool spellCast, LuaEventArgs raw)
        {
            var args   = raw.Args;
            var player = Convert.ToString(args[0]);

            if (player != "player")
            {
                return;
            }

            // get the english spell name, not the localized one!
            var spellId    = Convert.ToInt32(args[4]);
            var spellName  = WoWSpell.FromId(spellId).Name;
            var sourceGuid = ulong.Parse(args[3].ToString().Replace("0x", string.Empty), NumberStyles.HexNumber);

            if (!success && spellCast)
            {
                CLULogger.DiagnosticLog("Woops, '{0}' cast failed: {1}", spellName, raw.EventName);
            }

            // if the spell is locked, let's extend it (spell travel time + client lag) / or reset it...
            if (Locks.ContainsKey(spellName))
            {
                if (success)
                {
                    // yay!
                    Locks[spellName] = DateTime.Now.AddSeconds(ClientLag + 4.0);
                }
                else
                {
                    if (spellCast)
                    {
                        // interrupted while casting
                        Locks[spellName] = DateTime.Now;
                    }
                    else
                    {
                        // failed to cast it. moar spam!
                        Locks[spellName] = DateTime.Now;
                    }
                }
            }

            // We need to 'sleep' for these spells. Otherwise, we'll end up double-casting them. Which will cause issues
            switch (spellName)
            {
            case "Rejuvenation":
            case "Lifebloom":
            case "Regrowth":
            case "Nourish":
            case "Healing Touch":
            case "Remove Corruption":
            case "Holy Light":
            case "Holy Radiance":
            case "Divine Light":
            case "Holy Shock":
                CLULogger.DiagnosticLog("Sleeping for heal success. ({0})", spellName);
                StyxWoW.SleepForLagDuration();
                break;

            case "Nature's Swiftness":
                CLULogger.DiagnosticLog("PrevNaturesSwiftness. ({0})", spellName);
                if (sourceGuid == StyxWoW.Me.Guid)
                {
                    Classes.Druid.Common.PrevNaturesSwiftness = spellId == 132158;
                }
                break;
            }
        }
Beispiel #17
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(

                                     new Decorator(ret => Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted,
                                                   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.Location.Distance(Location) > 5,
                                                   new Sequence(
                                                       new Action(ret => TreeRoot.StatusText = "Moving To Location - X: " + Location.X + " Y: " + Location.Y),
                                                       new Action(ret => Flightor.MoveTo(Location)),
                                                       new Action(ret => Thread.Sleep(300))
                                                       )
                                                   ),
                                     new Decorator(ret => MobList.Count == 0 && Me.Location.Distance(Location) <= 5,
                                                   new Sequence(
                                                       new Action(ret => Lua.DoString("UseItemByName({0})", ItemId)),
                                                       new Action(ret => TimeOut.Start())
                                                       )
                                                   ),
                                     new Decorator(ret => TimeOut.ElapsedMilliseconds >= 300000,
                                                   new Sequence(
                                                       new Action(ret => MobList[0].Interact()),
                                                       new Action(ret => Thread.Sleep(500)),
                                                       new Action(ret => Lua.DoString("SelectGossipOption(1)"))
                                                       )
                                                   ),

                                     new Decorator(ret => Me.CurrentTarget != null && Me.CurrentTarget.IsFriendly,
                                                   new Action(ret => Me.ClearTarget())),

                                     new Decorator(
                                         ret => Mobs.Count > 0 && Mobs[0].IsHostile,
                                         new PrioritySelector(
                                             new Decorator(
                                                 ret => Me.CurrentTarget != Mobs[0],
                                                 new Action(ret =>
            {
                Mobs[0].Target();
                StyxWoW.SleepForLagDuration();
            })),
                                             new Decorator(
                                                 ret => !Me.Combat,
                                                 new PrioritySelector(
                                                     new Decorator(
                                                         ret => RoutineManager.Current.PullBehavior != null,
                                                         RoutineManager.Current.PullBehavior),
                                                     new Action(ret => RoutineManager.Current.Pull()))))),

                                     new Decorator(ret => Mobs.Count > 0 && (Me.Combat || Mobs[0].Combat),
                                                   new PrioritySelector(
                                                       new Decorator(
                                                           ret => Me.CurrentTarget == null && Mobs[0].CurrentTarget != null,
                                                           new Sequence(
                                                               new Action(ret => MobList[0].Target()),
                                                               new Action(ret => StyxWoW.SleepForLagDuration()))),
                                                       new Decorator(
                                                           ret => !Me.Combat,
                                                           new PrioritySelector(
                                                               new Decorator(
                                                                   ret => RoutineManager.Current.PullBehavior != null,
                                                                   RoutineManager.Current.PullBehavior),
                                                               new Action(ret => RoutineManager.Current.Pull())))))

                                     )
                             ));
        }
Beispiel #18
0
        // Thanks to Singular Devs for the CombatLogEventArgs class and SpellImmunityManager.
        private static void HandleCombatLog(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);

            //var missType = Convert.ToString(e.Args[14]);

            switch (e.Event)
            {
            case "SWING_MISSED":
                if (e.Args[11].ToString() == "EVADE")
                {
                    CLULogger.TroubleshootLog("Mob is evading swing. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[11].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        CLULogger.TroubleshootLog("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;

            case "SPELL_MISSED":
            case "RANGE_MISSED":
                if (e.Args[14].ToString() == "EVADE")
                {
                    CLULogger.TroubleshootLog("Mob is evading ranged attack. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[14].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        CLULogger.TroubleshootLog("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;

            case "SPELL_AURA_REFRESH":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.25;
                        }
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.25;
                        }
                    }
                }
                break;

            case "SPELL_AURA_APPLIED":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.25;
                        }
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.25;
                        }
                    }
                }
                break;

            case "SPELL_AURA_REMOVED":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 0;
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 0;
                    }
                }
                break;
            }
        }
Beispiel #19
0
        private void RepairSellMail(bool repair, bool vendor, bool mail)
        {
            uint     VendorEntry = 0;
            WoWPoint VendorLoc   = new WoWPoint();
            WoWPoint MailboxLoc  = new WoWPoint();

            if (Me.IsHorde)
            {
                VendorEntry = 3319;
                VendorLoc   = new WoWPoint(1584.327, -4318.02, 21.18613);
                MailboxLoc  = new WoWPoint(1551.957, -4359.154, 17.89191);
            }
            if (Me.IsAlliance)
            {
                VendorEntry = 54321;
                VendorLoc   = new WoWPoint(0, 0, 0);
                MailboxLoc  = new WoWPoint(0, 0, 0);
            }
            if (repair || vendor)
            {
                while (VendorLoc.Distance(Me.Location) > 1)
                {
                    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 Vendor!");
                    Flightor.MoveTo(VendorLoc);
                    Thread.Sleep(250);
                }

                Log("Dismounting.");
                //while (Me.IsFlying) { WoWMovement.Move(WoWMovement.MovementDirection.Descend, TimeSpan.FromSeconds(1)); }
                //Log("Landed.");
                Flightor.MountHelper.Dismount();
                StyxWoW.SleepForLagDuration();
                WoWMovement.MoveStop(WoWMovement.MovementDirection.All);
                Navigator.PlayerMover.MoveStop();

                Thread.Sleep(ranNum(500, 1500));
                foreach (WoWUnit unit in ObjectManager.GetObjectsOfType <WoWUnit>().Where(o => o.Entry == VendorEntry))
                {
                    while (unit.Location.Distance(Me.Location) > unit.InteractRange)
                    {
                        Navigator.MoveTo(unit.Location);
                        Log(string.Format("Moving towards: {0}.", unit.Name));
                        unit.Target();
                        unit.Interact();
                        Thread.Sleep(500);
                        unit.Interact();
                        Thread.Sleep(ranNum(1000, 3000));
                        unit.Interact();
                    }
                    break;
                }
                StyxWoW.SleepForLagDuration();
            }
            if (Me.CurrentTarget != null)
            {
                if (repair && Me.CurrentTarget.Entry == VendorEntry && Me.CurrentTarget.IsRepairMerchant)
                {
                    Styx.Logic.Vendors.RepairAllItems(); Thread.Sleep(ranNum(500, 3000));
                }
                if (Me.Auras.ContainsKey("Herbouflage"))
                {
                    string.Format("RunMacroText(\"{0}\")", "/cancelaura Herbouflage");
                }
                if (Me.ActiveAuras.ContainsKey("Herbouflage"))
                {
                    string.Format("RunMacroText(\"{0}\")", "/cancelaura Herbouflage");
                }
                if (vendor && Me.CurrentTarget.Entry == VendorEntry && Me.CurrentTarget.IsVendor)
                {
                    Styx.Logic.Vendors.SellAllItems(); Thread.Sleep(ranNum(500, 3000));
                }
                if (Me.Auras.ContainsKey("Herbouflage"))
                {
                    string.Format("RunMacroText(\"{0}\")", "/cancelaura Herbouflage");
                }
                if (Me.ActiveAuras.ContainsKey("Herbouflage"))
                {
                    string.Format("RunMacroText(\"{0}\")", "/cancelaura Herbouflage");
                }
            }
            if (mail)
            {
                if (Styx.Logic.Inventory.InventoryManager.HaveItemsToMail)
                {
                    if (Styx.Helpers.CharacterSettings.Instance.MailRecipient != null && Styx.Helpers.CharacterSettings.Instance.MailRecipient != "")
                    {
                        bool Foundbox = false;
                        ObjectManager.Update();
                        Log("You have items to mail, and a Recipient set!");
                        var Mailboxes = ObjectManager.GetObjectsOfType <WoWGameObject>().Where(o => Navigator.CanNavigateFully(Me.Location, o.Location) && o.SubType == WoWGameObjectType.Mailbox);
                        foreach (WoWGameObject Mailbox in ObjectManager.GetObjectsOfType <WoWGameObject>().Where(o => Navigator.CanNavigateFully(Me.Location, o.Location) && o.SubType == WoWGameObjectType.Mailbox))
                        {
                            Log("Found a Mailbox (Auto).  Moving to it.", null);
                            while (Mailbox.Location.Distance(Me.Location) > Mailbox.InteractRange)
                            {
                                Navigator.MoveTo(Mailbox.Location);
                            }
                            Thread.Sleep(500);
                            Navigator.PlayerMover.MoveStop();
                            WoWMovement.MoveStop(WoWMovement.MovementDirection.All);
                            Thread.Sleep(1000);
                            Mailbox.Interact();
                            Thread.Sleep(500);
                            Mailbox.Interact();
                            StyxWoW.SleepForLagDuration();
                            Log("Mailing Items!");
                            Thread.Sleep(ranNum(2000, 5000));
                            Styx.Logic.Vendors.MailAllItems();
                            if (Me.Auras.ContainsKey("Herbouflage"))
                            {
                                string.Format("RunMacroText(\"{0}\")", "/cancelaura Herbouflage");
                            }
                            if (Me.ActiveAuras.ContainsKey("Herbouflage"))
                            {
                                string.Format("RunMacroText(\"{0}\")", "/cancelaura Herbouflage");
                            }
                            StyxWoW.SleepForLagDuration();
                            Foundbox = true;
                            break;
                        }
                        if (!Foundbox)
                        {
                            Log("Couldn't find a mailbox automatically.  Using back-up.");
                            while (MailboxLoc.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 Mailbox!");
                                Flightor.MoveTo(MailboxLoc);
                                Thread.Sleep(250);
                            }
                            Log("Dismounting.");
                            Flightor.MountHelper.Dismount();
                            StyxWoW.SleepForLagDuration();
                            WoWMovement.MoveStop(WoWMovement.MovementDirection.All);
                            Navigator.PlayerMover.MoveStop();

                            Thread.Sleep(ranNum(1500, 3000));
                            ObjectManager.Update();
                            Foundbox = true;
                        }
                        if (Foundbox)
                        {
                            while (VendorLoc.Distance(Me.Location) > 1)
                            {
                                Log("Walking back to Original Vendor Location.");
                                Thread.Sleep(250);
                                Navigator.MoveTo(VendorLoc);
                            }
                        }
                        if (!Foundbox)
                        {
                            Log("Didn't find a Mailbox to use.  Please head to TheBuddyForum and report this issue in the BuddyManager thread!!!");
                        }
                    }
                    else
                    {
                        Log("You don't have a mail recipient set!");
                    }
                }
                else
                {
                    Log("Found no items to mail.");
                }
            }

            while (VendorLoc.Distance(Me.Location) > 5)
            {
                Navigator.MoveTo(VendorLoc); Thread.Sleep(100);
            }

            NeedToRepairMailSell = false;
        }
Beispiel #20
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(

                                     new Decorator(ret => Counter > 1,
                                                   new Action(ret => _isBehaviorDone = true)),

                                     new PrioritySelector(

                                         new Decorator(ret => !MovedToTarget,
                                                       new Action(delegate
            {
                MovedToTarget = true;
                return RunStatus.Success;
            })
                                                       ),

                                         new Decorator(ret => StyxWoW.Me.IsMoving,
                                                       new Action(delegate
            {
                WoWMovement.MoveStop();
                StyxWoW.SleepForLagDuration();
            })
                                                       ),

                                         new Decorator(ret => MovedToTarget,
                                                       new Action(delegate
            {
                // CurrentUnit.Interact();

                TreeRoot.GoalText = "BasicUseObject Running";
                TreeRoot.StatusText = "Using Object";

                ObjectManager.Update();

                _objectList = ObjectManager.GetObjectsOfType <WoWGameObject>()
                              .Where(u => u.Entry == ObjectId && !u.InUse && !u.IsDisabled)
                              .OrderBy(u => u.Distance).ToList();

                if (_objectList.Count >= 1)
                {
                    Thread.Sleep(1000);
                    UseGameObjectFunc();
                }

                if (Me.Combat)
                {
                    return RunStatus.Success;
                }


                if (Counter > 1)
                {
                    return RunStatus.Success;
                }
                return RunStatus.Running;
            })
                                                       ),

                                         new Action(ret => Thread.Sleep(1000))
                                         )
                                     )));
        }
Beispiel #21
0
        public Composite CreateFrostMageCombat()
        {
            WantedPet = "Water Elemental";
            return(new PrioritySelector(
                       CreateEnsureTarget(),
                       //Move away from frozen targets
                       new Decorator(
                           ret => (Me.CurrentTarget.HasAura("Frost Nova") || Me.CurrentTarget.HasAura("Freeze")) && Me.CurrentTarget.DistanceSqr < 5 * 5,
                           new Action(
                               ret =>
            {
                Logger.Write("Getting away from frozen target");
                WoWPoint moveTo = WoWMathHelper.CalculatePointFrom(Me.Location, Me.CurrentTarget.Location, 10f);

                if (Navigator.CanNavigateFully(Me.Location, moveTo))
                {
                    Navigator.MoveTo(moveTo);
                }
            })),
                       CreateMoveToAndFace(34f, ret => Me.CurrentTarget),
                       CreateWaitForCast(true),
                       CreateCastPetActionOnLocation("Freeze", ret => !Me.CurrentTarget.HasAura("Frost Nova")),
                       CreateSpellBuff("Frost Nova", ret => NearbyUnfriendlyUnits.Any(u => u.DistanceSqr <= 8 * 8)),
                       CreateMagePolymorphOnAddBehavior(),
                       new Decorator(
                           ret => !Me.GotAlivePet,
                           new Action(ret => PetManager.CallPet(WantedPet))),
                       CreateSpellCast("Evocation", ret => Me.ManaPercent < 20),
                       CreateSpellCast("Counterspell", ret => Me.CurrentTarget.IsCasting),
                       CreateSpellCast("Mirror Image"),
                       CreateSpellCast("Time Warp"),
                       new Decorator(
                           ret => Me.CurrentTarget.HealthPercent > 50,
                           new Sequence(
                               new Action(ctx => Me.CurrentTarget.Face()),
                               new Action(ctx => StyxWoW.SleepForLagDuration()),
                               new PrioritySelector(CreateSpellCast("Flame Orb"))
                               )),
                       CreateSpellBuffOnSelf("Ice Barrier", ret => !Me.Auras.ContainsKey("Mana Shield")),
                       CreateSpellBuffOnSelf("Mana Shield", ret => !Me.Auras.ContainsKey("Ice Barrier") && Me.HealthPercent <= 50),
                       CreateSpellCast(
                           "Deep Freeze",
                           ret =>
                           (Me.ActiveAuras.ContainsKey("Fingers of Frost") || Me.CurrentTarget.HasAura("Frost Nova") || Me.CurrentTarget.HasAura("Freeze"))),
                       CreateSpellCast(
                           "Ice Lance",
                           ret =>
                           (Me.ActiveAuras.ContainsKey("Fingers of Frost") || Me.CurrentTarget.ActiveAuras.ContainsKey("Frost Nova") ||
                            Me.CurrentTarget.ActiveAuras.ContainsKey("Freeze"))),
                       //CreateSpellCast("Fireball", Me.ActiveAuras.ContainsKey("Brain Freeze")),
                       CreateSpellCast("Arcane Missiles", ret => Me.ActiveAuras.ContainsKey("Arcane Missiles!")),
                       new Decorator(
                           ret => Me.ActiveAuras.ContainsKey("Brain Freeze"),
                           new PrioritySelector(
                               CreateSpellCast("Frostfire Bolt"),
                               CreateSpellCast("Fireball")
                               )),
                       CreateSpellBuff("Fire Blast", ret => Me.CurrentTarget.HealthPercent < 10),
                       CreateSpellCast("Frostbolt")
                       ));
        }
Beispiel #22
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(
                                     new Decorator(
                                         ret => Item == null,
                                         new ActionAlwaysSucceed()),

                                     new Decorator(ret => Counter > NumOfTimes && QuestId == 0,
                                                   new Action(ret => _isBehaviorDone = true)),

                                     new Decorator(
                                         ret => UseType == QBType.PointToPoint,
                                         new PrioritySelector(
                                             new Decorator(
                                                 ret => Me.Location.Distance(MoveToLocation) > 3,
                                                 new Sequence(
                                                     new Action(ret => TreeRoot.StatusText = "Using Item: " + UseObject.Name + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                     new Action(ret => Navigator.MoveTo(MoveToLocation)))),
                                             new Sequence(
                                                 new Action(ret => TreeRoot.StatusText = "Using Item"),
                                                 new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                 new Action(ret => Me.SetFacing(ClickToLocation)),
                                                 new Action(ret => StyxWoW.SleepForLagDuration()),
                                                 new Action(ret => Item.UseContainerItem()),
                                                 new Action(ret => StyxWoW.SleepForLagDuration()),
                                                 new Action(ret => Counter++),
                                                 new Action(ret => LegacySpellManager.ClickRemoteLocation(ClickToLocation)),
                                                 new Action(ret => Thread.Sleep(WaitTime)))
                                             )),

                                     new Decorator(
                                         ret => UseType == QBType.PointToObject,
                                         new PrioritySelector(
                                             new Decorator(
                                                 ret => UseObject == null && Me.Location.DistanceSqr(MoveToLocation) >= 2 * 2,
                                                 new Sequence(
                                                     new Action(ret => TreeRoot.StatusText = "Moving to location"),
                                                     new Action(ret => Navigator.MoveTo(MoveToLocation)))),
                                             new Decorator(
                                                 ret => UseObject != null,
                                                 new PrioritySelector(
                                                     new Decorator(
                                                         ret => UseObject.DistanceSqr >= Range * Range,
                                                         new Sequence(
                                                             new Action(ret => TreeRoot.StatusText = "Moving closer to the object"),
                                                             new Action(ret => Navigator.MoveTo(UseObject.Location)))),
                                                     new Decorator(
                                                         ret => UseObject.DistanceSqr < MinRange * MinRange,
                                                         new Sequence(
                                                             new Action(ret => TreeRoot.StatusText = "Too Close, Backing Up"),
                                                             new Action(ret => Navigator.MoveTo(WoWMathHelper.CalculatePointFrom(Me.Location, UseObject.Location, (float)MinRange + 2f)))
                                                             )),
                                                     new Sequence(
                                                         new Action(ret => TreeRoot.StatusText = "Using Item: " + UseObject.Name + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                         new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                         new Action(ret => Me.SetFacing(UseObject.Location)),
                                                         new Action(ret => StyxWoW.SleepForLagDuration()),
                                                         new Action(ret => Item.UseContainerItem()),
                                                         new Action(ret => Counter++),
                                                         new Action(ret => StyxWoW.SleepForLagDuration()),
                                                         new Action(ret => LegacySpellManager.ClickRemoteLocation(UseObject.Location)),
                                                         new Action(ret => _npcBlacklist.Add(UseObject.Guid)),
                                                         new Action(ret => Thread.Sleep(WaitTime))))),
                                             new Action(ret => TreeRoot.StatusText = "No objects around. Waiting")
                                             )),

                                     new Decorator(
                                         ret => UseType == QBType.ToObject,
                                         new PrioritySelector(
                                             new Decorator(
                                                 ret => UseObject != null,
                                                 new PrioritySelector(
                                                     new Decorator(
                                                         ret => UseObject.DistanceSqr >= Range * Range,
                                                         new Sequence(
                                                             new Action(ret => TreeRoot.StatusText = "Moving to object's range"),
                                                             new Action(ret => Navigator.MoveTo(UseObject.Location)))),
                                                     new Decorator(
                                                         ret => UseObject.DistanceSqr < MinRange * MinRange,
                                                         new Sequence(
                                                             new Action(ret => TreeRoot.StatusText = "Too Close, Backing Up"),
                                                             new Action(ret => Navigator.MoveTo(WoWMathHelper.CalculatePointFrom(Me.Location, UseObject.Location, (float)MinRange + 2f)))
                                                             )),
                                                     new Sequence(
                                                         new Action(ret => TreeRoot.StatusText = "Using Item: " + UseObject.Name + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                         new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                         new Action(ret => Me.SetFacing(UseObject.Location)),
                                                         new Action(ret => StyxWoW.SleepForLagDuration()),
                                                         new Action(ret => Item.UseContainerItem()),
                                                         new Action(ret => Counter++),
                                                         new Action(ret => StyxWoW.SleepForLagDuration()),
                                                         new Action(ret => LegacySpellManager.ClickRemoteLocation(UseObject.Location)),
                                                         new Action(ret => _npcBlacklist.Add(UseObject.Guid)),
                                                         new Action(ret => Thread.Sleep(WaitTime))))),
                                             new Decorator(
                                                 ret => Me.Location.DistanceSqr(MoveToLocation) > 2 * 2,
                                                 new Sequence(
                                                     new Action(ret => TreeRoot.StatusText = "Moving to location"),
                                                     new Action(ret => Navigator.MoveTo(MoveToLocation))))
                                             ))
                                     )));
        }
Beispiel #23
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(

                                     new Decorator(ret => Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted || MobList.Count == 0 || Me.QuestLog.GetQuestById((uint)QuestId).IsFailed,
                                                   new Sequence(
                                                       new Action(ret => TreeRoot.StatusText = "Finished!"),
                                                       new WaitContinue(120,
                                                                        new Action(delegate
            {
                _isBehaviorDone = true;
                return RunStatus.Success;
            }))
                                                       )),

                                     new Decorator(ret => Me.CurrentTarget != null && Me.CurrentTarget.IsFriendly,
                                                   new Action(ret => Me.ClearTarget())),

                                     new Decorator(
                                         ret => MobList.Count > 0 && MobList[0].IsHostile,
                                         new PrioritySelector(
                                             new Decorator(
                                                 ret => Me.CurrentTarget != MobList[0],
                                                 new Action(ret =>
            {
                MobList[0].Target();
                StyxWoW.SleepForLagDuration();
            })),
                                             new Decorator(
                                                 ret => !Me.Combat,
                                                 new PrioritySelector(
                                                     new Decorator(
                                                         ret => RoutineManager.Current.PullBehavior != null,
                                                         RoutineManager.Current.PullBehavior),
                                                     new Action(ret => RoutineManager.Current.Pull()))))),


                                     new Decorator(
                                         ret => MobList.Count > 0 && (!Me.Combat || Me.CurrentTarget == null || Me.CurrentTarget.Dead) &&
                                         MobList[0].CurrentTarget == null && MobList[0].DistanceSqr > 5f * 5f,
                                         new Sequence(
                                             new Action(ret => TreeRoot.StatusText = "Following Mob - " + MobList[0].Name + " At X: " + MobList[0].X + " Y: " + MobList[0].Y + " Z: " + MobList[0].Z),
                                             new Action(ret => Navigator.MoveTo(MobList[0].Location)),
                                             new Action(ret => Thread.Sleep(100))
                                             )
                                         ),

                                     new Decorator(ret => MobList.Count > 0 && (Me.Combat || MobList[0].Combat),
                                                   new PrioritySelector(
                                                       new Decorator(
                                                           ret => Me.CurrentTarget == null && MobList[0].CurrentTarget != null,
                                                           new Sequence(
                                                               new Action(ret => MobList[0].CurrentTarget.Target()),
                                                               new Action(ret => StyxWoW.SleepForLagDuration()))),
                                                       new Decorator(
                                                           ret => !Me.Combat,
                                                           new PrioritySelector(
                                                               new Decorator(
                                                                   ret => RoutineManager.Current.PullBehavior != null,
                                                                   RoutineManager.Current.PullBehavior),
                                                               new Action(ret => RoutineManager.Current.Pull())))))

                                     )
                             ));
        }
Beispiel #24
0
 //Skinning
 private void _HasSkinning()
 {
     if (!hasKnife)
     {
         foreach (WoWItem knife in ObjectManager.GetObjectsOfType <WoWItem>(false))
         {
             if (knife.BagSlot != -1)
             {
                 if (knife.Entry.Equals(7005))
                 {
                     hasKnife = true;
                 }
                 if (knife.Entry.Equals(12709))
                 {
                     hasKnife = true;
                 }
                 if (knife.Entry.Equals(40772))
                 {
                     hasKnife = true;
                 }
                 if (knife.Entry.Equals(40893))
                 {
                     hasKnife = true;
                 }
                 if (knife.Entry.Equals(19901))
                 {
                     hasKnife = true;
                 }
             }
         }
         if (hasKnife)
         {
             Log("Character has a Skinning knife!", null, null);
         }
     }
     if (!hasKnife && !informedKnife)
     {
         Log("Character has no Skinning Knife! Go get one!", null, null); informedKnife = true;
     }
     if (hasKnife)
     {
         if (!ExtensiveCombatCheck() && !Me.Mounted && !Me.IsCasting)
         {
             ObjectManager.Update();
             var DeadMobs = (from o in ObjectManager.GetObjectsOfType <WoWUnit>(false, false)
                             where !o.IsAlive && o.CanSkin && o.Distance < 15 && !Blacklist.Contains(o.Guid)
                             orderby o.DistanceSqr ascending
                             select o);
             if (DeadMobs.Count() > 0)
             {
                 foreach (WoWUnit _Mob in DeadMobs)
                 {
                     if (_Mob.SkinType == WoWCreatureSkinType.Leather && !_Mob.Lootable && !Me.Looting)
                     {
                         Log("Found Skin-Able: ", _Mob.Name, ".");
                         while (!ExtensiveCombatCheck() && _Mob.Distance > _Mob.InteractRange)
                         {
                             Navigator.MoveTo(_Mob.Location);
                         }
                         Navigator.PlayerMover.MoveStop();
                         Thread.Sleep(100); StyxWoW.SleepForLagDuration();
                         _Mob.Interact();
                         while (Me.IsCasting)
                         {
                             Thread.Sleep(100);
                         }
                         Thread.Sleep(250);
                         while (Styx.Logic.Inventory.Frames.LootFrame.LootFrame.Instance.IsVisible)
                         {
                             Thread.Sleep(100);
                         }
                         Log("Finished Skinning.", null, null);
                         Blacklist.Add(_Mob.Guid, TimeSpan.FromMinutes(5));
                         JustInteracted.Start();
                     }
                 }
             }
             DeadMobs = null;
             return;
         }
     }
 }
        protected override Composite CreateBehavior()
        {
            return
                (new PrioritySelector(

                     new Decorator(ret => !_isInitialized,
                                   new Action(ret => ParsePaths())),

                     // Go home.
                     new Decorator(ret => Quest != null && Quest.IsCompleted || _remountTimer.Elapsed.TotalMinutes >= 14,
                                   new PrioritySelector(
                                       new Decorator(ret => ObjectManager.GetObjectsOfType <WoWUnit>().FirstOrDefault(r => r.Entry == 29107 && Vehicle.Location.Distance(r.Location) <= 10) != null,
                                                     new Sequence(
                                                         new Action(ret => Lua.DoString("VehicleExit()")),
                                                         new Action(ret => _isBehaviorDone = Quest.IsCompleted),
                                                         new Action(ret => _remountTimer.Reset())
                                                         )),

                                       new Decorator(ret => Vehicle == null,
                                                     new Sequence(ret => Me.CarriedItems.FirstOrDefault(i => i.Entry == ItemId),
                                                                  new DecoratorContinue(ret => ret == null,
                                                                                        new Sequence(
                                                                                            new Action(ret => LogMessage("fatal", "Unable to find ItemId({0}) in inventory.", ItemId))
                                                                                            )),

                                                                  new WaitContinue(60, ret => ((WoWItem)ret).Cooldown == 0,
                                                                                   // Use the item
                                                                                   new Sequence(
                                                                                       new Action(ret => ((WoWItem)ret).UseContainerItem()),
                                                                                       new Action(ret => ParsePaths()))
                                                                                   ),

                                                                  // Wait until we are in the vehicle
                                                                  new WaitContinue(5, ret => Vehicle != null,
                                                                                   new Sequence(
                                                                                       new Action(ret => _remountTimer.Reset()),
                                                                                       new Action(ret => _remountTimer.Start()),
                                                                                       new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(500)))
                                                                                       )
                                                                                   ))),

                                       new Decorator(ret => EndPath.Peek().Distance(Vehicle.Location) <= 6,
                                                     new Action(ret => EndPath.Dequeue())),

                                       new Sequence(
                                           new Action(ret => TreeRoot.StatusText = "Flying back to turn in the quest"),
                                           new Action(ret => WoWMovement.ClickToMove(EndPath.Peek())))
                                       )),

                     new Decorator(ret => Vehicle == null,
                                   new Sequence(ret => Me.CarriedItems.FirstOrDefault(i => i.Entry == ItemId),
                                                new DecoratorContinue(ret => ret == null,
                                                                      new Sequence(
                                                                          new Action(ret => LogMessage("fatal", "Unable to locate ItemId({0}) in inventory.", ItemId))
                                                                          )),

                                                new WaitContinue(60, ret => ((WoWItem)ret).Cooldown == 0,
                                                                 // Use the item
                                                                 new Sequence(
                                                                     new Action(ret => ParsePaths()),
                                                                     new Action(ret => ((WoWItem)ret).UseContainerItem()))
                                                                 ),

                                                // Wait until we are in the vehicle
                                                new WaitContinue(5, ret => Vehicle != null,
                                                                 new Sequence(
                                                                     new Action(ret => _remountTimer.Reset()),
                                                                     new Action(ret => _remountTimer.Start()),
                                                                     new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(500)))
                                                                     )
                                                                 ))),

                     new Decorator(ret => Vehicle != null,

                                   new PrioritySelector(
                                       new Decorator(ret => !_remountTimer.IsRunning,
                                                     new Action(ret => _remountTimer.Start())),

                                       new Decorator(
                                           ret => StartPoint != WoWPoint.Empty,
                                           new PrioritySelector(
                                               new Decorator(
                                                   ret => Vehicle.Location.Distance2D(StartPoint) < 15,
                                                   new Sequence(
                                                       new Action(ret => TreeRoot.StatusText = "Pathing through"),
                                                       new Action(ret => StartPoint = WoWPoint.Empty))),
                                               new Sequence(
                                                   new Action(ret => TreeRoot.StatusText = "Moving towards start point"),
                                                   new Action(ret => Navigator.PlayerMover.MoveTowards(StartPoint))))),

                                       new Decorator(ret => Path.Peek().Distance2DSqr(Vehicle.Location) <= 30 * 30,
                                                     new Action(ret => Path.Dequeue())),

                                       new Decorator(ret => (Vehicle.HealthPercent <= 70 || Vehicle.ManaPercent <= 35) &&
                                                     HealNpcs != null && HealSpell != null && !HealSpell.Spell.Cooldown,
                                                     new PrioritySelector(
                                                         ret => HealNpcs.Where(n => Vehicle.IsSafelyFacing(n)).OrderBy(n => n.DistanceSqr).FirstOrDefault(),
                                                         new Decorator(
                                                             ret => ret != null && ((WoWUnit)ret).InLineOfSightOCD,
                                                             new PrioritySelector(
                                                                 new Decorator(
                                                                     ret => ((WoWUnit)ret).Location.Distance(Vehicle.Location) > 15,
                                                                     new Action(ret => WoWMovement.ClickToMove(((WoWUnit)ret).Location.Add(0, 0, 10)))),
                                                                 new Action(ret =>
            {
                WoWMovement.MoveStop();
                CastPetAction(HealSpell);
            }))))),

                                       new Sequence(
                                           ret => KillNpcs.Where(n => n.Distance2DSqr > 20 * 20 && Vehicle.IsSafelyFacing(n)).OrderBy(n => n.DistanceSqr).FirstOrDefault(),
                                           new DecoratorContinue(
                                               ret => ret != null && ((WoWUnit)ret).InLineOfSightOCD && AttackSpell != null && !AttackSpell.Spell.Cooldown && !StyxWoW.GlobalCooldown,
                                               new Sequence(
                                                   new Action(ret =>
            {
                Vector3 v = ((WoWUnit)ret).Location - StyxWoW.Me.Location;
                v.Normalize();
                Lua.DoString(string.Format(
                                 "local pitch = {0}; local delta = pitch - VehicleAimGetAngle() + 0.1; VehicleAimIncrement(delta);",
                                 Math.Asin(v.Z).ToString(CultureInfo.InvariantCulture)));
            }),
                                                   new Action(ret => CastPetAction(AttackSpell)),
                                                   new Action(ret => StyxWoW.SleepForLagDuration()))),
                                           new Action(ret => StyxWoW.SleepForLagDuration()),
                                           new Action(ret => WoWMovement.ClickToMove(Path.Peek()))
                                           )
                                       ))));
        }
Beispiel #26
0
        //Skinning//

        //Mining
        private void _HasMining()
        {
            if (!hasPick)
            {
                foreach (WoWItem _item in ObjectManager.GetObjectsOfType <WoWItem>(false))
                {
                    if (_item.BagSlot != -1)
                    {
                        if (_item.Entry.Equals(2901))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(40893))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(40892))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(40772))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(20723))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(1959))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(756))
                        {
                            hasPick = true;
                        }
                        if (_item.Entry.Equals(9465))
                        {
                            hasPick = true;
                        }
                    }
                }
                if (hasPick)
                {
                    Log("Character has a Pickaxe!", null, null);
                }
            }
            if (!hasPick && !informedPick)
            {
                Log("Character has no Pickaxe! Go get one!", null, null); informedPick = true;
            }
            if (hasPick)
            {
                var DeadMobs = (from o in ObjectManager.GetObjectsOfType <WoWUnit>(false, false)
                                where o.Distance < 15 && !o.IsAlive && !Blacklist.Contains(o.Guid)
                                orderby o.DistanceSqr ascending
                                select o);
                if (DeadMobs.Count() > 0 && !ExtensiveCombatCheck())
                {
                    foreach (WoWUnit _Mob in DeadMobs)
                    {
                        if (_Mob.SkinType == WoWCreatureSkinType.Rock && !_Mob.Lootable && !Me.Looting)
                        {
                            Log("Found Mine-Able: ", _Mob.Name, ".");
                            while (_Mob.Distance > 5 && !ExtensiveCombatCheck())
                            {
                                Navigator.MoveTo(_Mob.Location);
                            }
                            Navigator.PlayerMover.MoveStop();
                            Thread.Sleep(100); StyxWoW.SleepForLagDuration();
                            _Mob.Interact();
                            Thread.Sleep(500);
                            while (Me.IsCasting)
                            {
                                Thread.Sleep(100);
                            }
                            Thread.Sleep(250);
                            while (Styx.Logic.Inventory.Frames.LootFrame.LootFrame.Instance.IsVisible)
                            {
                                Thread.Sleep(250);
                            }
                            Log("Finished Mining.", null, null);
                            Blacklist.Add(_Mob.Guid, TimeSpan.FromMinutes(5));
                            JustInteracted.Start();
                        }
                    }
                    DeadMobs = null;
                    return;
                }
            }
        }
Beispiel #27
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new Decorator(ret => !_isBehaviorDone,
                                               new PrioritySelector(
                                                   new Decorator(ret => IsQuestComplete(),
                                                                 new PrioritySelector(
                                                                     new Decorator(ret => Me.HasAura("Flame Ascendancy"),
                                                                                   new Action(delegate
            {
                DLog("Quest complete - cancelling Flame Ascendancy");
                Lua.DoString("RunMacroText(\"/cancelaura Flame Ascendancy\")");
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                                   ),
                                                                     new Action(delegate
            {
                _isBehaviorDone = 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.HasAura("Flame Ascendancy"),
                                                                 new Action(delegate
            {
                WoWItem item = ObjectManager.GetObjectsOfType <WoWItem>().FirstOrDefault(i => i != null && i.Entry == 54814);
                if (item == null)
                {
                    LogMessage("fatal", "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) && !Me.Auras.ContainsKey("Flame Shield"),
                                                                 new Action(delegate
            {
                Log("Cast Flame Shield");
                Lua.DoString("RunMacroText(\"/click BonusActionButton2\")");
                Blacklist.Add(2, TimeSpan.FromMilliseconds(6000));
                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;
            })
                                                   )
                                               )
                             ));
        }
Beispiel #28
0
        private static void HandleCombatLog(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);

            if (e.SourceGuid != StyxWoW.Me.Guid)
            {
                return;
            }

            // Logger.WriteDebug("[CombatLog] " + e.Event + " - " + e.SourceName + " - " + e.SpellName);

            switch (e.Event)
            {
            default:
                Logger.WriteDebug("[CombatLog] filter out this event -- " + e.Event + " - " + e.SourceName + " - " + e.SpellName);
                break;

            case "SPELL_CAST_FAILED":
                if (SingularSettings.Instance.EnableDebugLogging)
                {
                    Logger.WriteDebug("[CombatLog] {0}:{1} cast of {2}#{3} failed: '{4}'",
                                      e.SourceName,
                                      e.SourceGuid,
                                      e.SpellName,
                                      e.SpellId,
                                      e.Args[14]
                                      );
                }
                break;

            case "SPELL_AURA_APPLIED":
            case "SPELL_CAST_SUCCESS":
                if (e.SourceGuid != StyxWoW.Me.Guid)
                {
                    return;
                }

                // Update the last spell we cast. So certain classes can 'switch' their logic around.
                Spell.LastSpellCast = e.SpellName;
                //Logger.WriteDebug("Successfully cast " + Spell.LastSpellCast);

                // Force a wait for all summoned minions. This prevents double-casting it.
                if (StyxWoW.Me.Class == WoWClass.Warlock && e.SpellName.StartsWith("Summon "))
                {
                    StyxWoW.SleepForLagDuration();
                }
                break;

            case "SWING_MISSED":
                if (e.Args[11].ToString() == "EVADE")
                {
                    Logger.Write("Mob is evading swing. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[11].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        Logger.WriteDebug("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;

            case "SPELL_MISSED":
            case "RANGE_MISSED":
                // DoT casting spam can occur when running on test dummy with low +hit
                //  ..  and multiple misses occurring. this should help troubleshoot
                //  ..  false reports of flawed rotation
                if (SingularSettings.Instance.EnableDebugLogging)
                {
                    Logger.WriteFile(
                        "[CombatLog] {0} {1}#{2} {3}",
                        e.Event,
                        e.SpellName,
                        e.SpellId,
                        e.Args[14]
                        );
                }

                if (e.Args[14].ToString() == "EVADE")
                {
                    Logger.Write("Mob is evading ranged attack. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[14].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        Logger.WriteDebug("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;
            }
        }
Beispiel #29
0
        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();
            })
                                                           )
                                                       )
                                                   )
                                     )
                             ));
        }
Beispiel #30
0
 /// <summary>
 /// Thread sleep for the duration of your current in-game lag
 /// </summary>
 public static void LagSleep()
 {
     StyxWoW.SleepForLagDuration();
 }