Exemplo n.º 1
0
        public Transport(Dictionary<string, string> args)
            : base(args)
        {
            CheckForUnrecognizedAttributes(recognizedAttributes);

            WoWPoint getOnlocation = new WoWPoint(0, 0, 0);
            WoWPoint getOfflocation = new WoWPoint(0, 0, 0);
            WoWPoint reachedlocation = new WoWPoint(0, 0, 0);
            WoWPoint endlocation = new WoWPoint(0, 0, 0);
            WoWPoint docklocation = new WoWPoint(0, 0, 0);
            WoWPoint shipstand = new WoWPoint(0, 0, 0);
            int questId = 0;
            int objectId = 0;

            success = success && GetAttributeAsInteger("ObjectId", true, "1", 0, int.MaxValue, out objectId);
            success = success && GetAttributeAsInteger("QuestId", false, "0", 0, int.MaxValue, out questId);
            success = success && GetXYZAttributeAsWoWPoint("TransGetOnX", "TransGetOnY", "TransGetOnZ", true, new WoWPoint(0, 0, 0), out reachedlocation);
            success = success && GetXYZAttributeAsWoWPoint("TransGetOffX", "TransGetOffY", "TransGetOffZ", true, new WoWPoint(0, 0, 0), out endlocation);
            success = success && GetXYZAttributeAsWoWPoint("GetOnX", "GetOnY", "GetOnZ", true, new WoWPoint(0, 0, 0), out getOnlocation);
            success = success && GetXYZAttributeAsWoWPoint("GetOffX", "GetOffY", "GetOffZ", true, new WoWPoint(0, 0, 0), out getOfflocation);
            success = success && GetXYZAttributeAsWoWPoint("X", "Y", "Z", false, new WoWPoint(0, 0, 0), out docklocation);
            success = success && GetXYZAttributeAsWoWPoint("TransStandX", "TransStandY", "TransStandZ", false, new WoWPoint(0, 0, 0), out shipstand);

            QuestId = (uint)questId;
            ObjectID = objectId;

            GetOnLocation = getOnlocation;
            GetOffLocation = getOfflocation;
            ReachedLocation = reachedlocation;
            EndLocation = endlocation;
            Location = docklocation;
            ShipStandLocation = shipstand;

            Counter = 0;
        }
Exemplo n.º 2
0
		private static void safeMoveTo(WoWPoint point)
		{
			try
			{
				WoWPoint movePoint = point;
				
				if (Navigator.GeneratePath(Me.Location, movePoint).Length == 0)
				{
					Log("Can not generate navigation path to tank. Something wrong with mesh");
					errorCount++;
					if (errorCount > 50)
						warningSound();
				}
				else
				{
					errorCount = 0;
					soundPlayed = false;
					Navigator.MoveTo(movePoint);	
					Thread.Sleep(100);
				}
			}
			catch (System.Threading.ThreadAbortException) { throw; }
			catch (Exception c)
			{
				Log("This instance has not been meshed yet");
				dLog("{0}", c);
				warningSound();
			}			
		}
Exemplo n.º 3
0
        public BuyItemFromAhAction() {
            Properties["ItemID"] = new MetaProp("ItemID", typeof(string));
            Properties["MaxBuyout"] = new MetaProp("MaxBuyout", typeof(PropertyBag.GoldEditor),
                new DisplayNameAttribute("Max Buyout"), new TypeConverterAttribute(typeof(PropertyBag.GoldEditorConverter)));
            Properties["Amount"] = new MetaProp("Amount", typeof(uint));
            Properties["ItemListType"] = new MetaProp("ItemListType", typeof(ItemType), new DisplayNameAttribute("Buy ..."));
            Properties["AutoFindAh"] = new MetaProp("AutoFindAh", typeof(bool), new DisplayNameAttribute("Auto find AH"));
            Properties["BuyAdditively"] = new MetaProp("BuyAdditively", typeof(bool), new DisplayNameAttribute("Buy Additively"));

            Properties["BidOnItem"] = new MetaProp("BidOnItem", typeof(bool), new DisplayNameAttribute("Bid on Item"));
            Properties["Location"] = new MetaProp("Location", typeof(string), new EditorAttribute(typeof(PropertyBag.LocationEditor), typeof(UITypeEditor)));

            ItemID = "";
            Amount = 1u;
            ItemListType = ItemType.Item;
            AutoFindAh = true;
            loc = WoWPoint.Zero;
            Location = loc.ToInvariantString();
            MaxBuyout = new PropertyBag.GoldEditor("100g0s0c");
            BidOnItem = false;
            BuyAdditively = true;

            Properties["AutoFindAh"].PropertyChanged += new EventHandler(AutoFindAHChanged);
            Properties["ItemListType"].PropertyChanged += new EventHandler(BuyItemFromAhAction_PropertyChanged);
            Properties["Location"].PropertyChanged += new EventHandler(LocationChanged);
            Properties["Amount"].Show = true;
            Properties["Location"].Show = false;
        }
        public CancelAuctionAction()
        {
            Properties["ItemID"] = new MetaProp("ItemID", typeof(string), new DisplayNameAttribute("Item ID List"));
            Properties["AutoFindAh"] = new MetaProp("AutoFindAh", typeof(bool), new DisplayNameAttribute("Auto find AH"));
            Properties["Location"] = new MetaProp("Location", typeof(string), new EditorAttribute(typeof(PropertyBag.LocationEditor), typeof(UITypeEditor)));
            Properties["UseCategory"] = new MetaProp("UseCategory", typeof(bool), new DisplayNameAttribute("Use Category"));
            Properties["Category"] = new MetaProp("Category", typeof(WoWItemClass), new DisplayNameAttribute("Item Category"));
            Properties["SubCategory"] = new MetaProp("SubCategory", typeof(WoWItemTradeGoodsClass), new DisplayNameAttribute("Item SubCategory"));
            Properties["MinBuyout"] = new MetaProp("MinBuyout", typeof(PropertyBag.GoldEditor),
                new DisplayNameAttribute("Min Buyout"), new TypeConverterAttribute(typeof(PropertyBag.GoldEditorConverter)));

            ItemID = "0";
            AutoFindAh = true;
            loc = WoWPoint.Zero;
            Location = loc.ToInvariantString();
            UseCategory = false;
            Category = WoWItemClass.TradeGoods;
            SubCategory = WoWItemTradeGoodsClass.None;
            MinBuyout = new PropertyBag.GoldEditor("0g0s0c");

            Properties["AutoFindAh"].PropertyChanged += new EventHandler(AutoFindAHChanged);
            Properties["Location"].PropertyChanged += new EventHandler(LocationChanged);
            Properties["UseCategory"].PropertyChanged += UseCategoryChanged;
            Properties["Category"].PropertyChanged += CategoryChanged;

            Properties["Category"].Show = false;
            Properties["SubCategory"].Show = false;
            Properties["Location"].Show = false;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Cast "Freeze" pet ability on a target.  Uses a local store for location to
        /// avoid target position changing during cast preparation and being out of
        /// range after range check
        /// </summary>
        /// <param name="onUnit">target to cast on</param>
        /// <returns></returns>
        public static Composite CastFreeze( UnitSelectionDelegate onUnit, SimpleBooleanDelegate require = null)
        {
            if (onUnit == null)
                return new ActionAlwaysFail();

            if (require == null)
                require = req => true;

            return new Sequence(
                ctx => onUnit(ctx),
                new Decorator(
                    req => req != null && (req as WoWUnit).SpellDistance() < 40 && require(req),
                    new Action( r =>
                    {
                        _locFreeze = (r as WoWUnit).Location;
                        if (StyxWoW.Me.Location.Distance(_locFreeze) > 45)
                            _locFreeze = WoWMathHelper.CalculatePointFrom(StyxWoW.Me.Location, _locFreeze, 7f + (r as WoWUnit).CombatReach);
                        if (StyxWoW.Me.Location.Distance(_locFreeze) > 45)
                            return RunStatus.Failure;
                        return RunStatus.Success;
                    })
                    ),
                new Throttle( TimeSpan.FromMilliseconds(250),
                    Pet.CastPetActionOnLocation(
                        "Freeze",
                        on => _locFreeze,
                        ret => !Me.CurrentTarget.TreatAsFrozen()
                        )
                    )
                );
        }
Exemplo n.º 6
0
        /// <summary>
        /// Defends an Object.
        /// </summary>
        /// <remarks>
        /// Created 12/8/2010.
        /// </remarks>
        /// <param name="args">A variable-length parameters list containing arguments.</param>
        public DefendObject(Dictionary<string, string> args) : base(args)
        {
            try
            {
                _location = GetAttributeAsNullable("", false, ConstrainAs.WoWPointNonEmpty, null) ?? _me.Location;
                _objectId = GetNumberedAttributesAsArray<uint>("ObjectId", 1, null, new[] {"NpcId", "MobId"}) ?? new uint[] { 27430 };
                _questId = GetAttributeAsNullable("QuestId", false, ConstrainAs.QuestId(this), null) ?? 0;
                _questRequirementComplete = GetAttributeAsNullable<QuestCompleteRequirement>("QuestCompleteRequirement", false, null, null) ?? QuestCompleteRequirement.NotComplete;
                _questRequirementInLog = GetAttributeAsNullable<QuestInLogRequirement>("QuestInLogRequirement", false, null, null) ?? QuestInLogRequirement.InLog;
                _maxRange = GetAttributeAsNullable<int>("MaxRange", false, null, null) ?? 40;
            }

            catch (Exception except)
            {
                // Maintenance problems occur for a number of reasons.  The primary two are...
                // * Changes were made to the behavior, and boundary conditions weren't properly tested.
                // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes.
                // In any case, we pinpoint the source of the problem area here, and hopefully it
                // can be quickly resolved.
                LogMessage("error", "BEHAVIOR MAINTENANCE PROBLEM: " + except.Message
                                    + "\nFROM HERE:\n"
                                    + except.StackTrace + "\n");
                IsAttributeProblem = true;
            }
        }
Exemplo n.º 7
0
        public MoveToAction()
        {
            Properties["Entry"] = new MetaProp("Entry", typeof (uint),
                                               new EditorAttribute(typeof (PropertyBag.EntryEditor),
                                                                   typeof (UITypeEditor)),
                                               new DisplayNameAttribute(Pb.Strings["Action_Common_Entry"]));

            Properties["Location"] = new MetaProp("Location",
                                                  typeof (string),
                                                  new EditorAttribute(typeof (PropertyBag.LocationEditor),
                                                                      typeof (UITypeEditor)),
                                                  new DisplayNameAttribute(Pb.Strings["Action_Common_Location"]));

            Properties["MoveType"] = new MetaProp("MoveType", typeof (MoveToType),
                                                  new DisplayNameAttribute(Pb.Strings["Action_MoveToAction_MoveToType"]));

            Properties["Pathing"] = new MetaProp("Pathing", typeof (NavigationType),
                                                 new DisplayNameAttribute(Pb.Strings["Action_Common_Use"]));

            Entry = 0u;
            _loc = WoWPoint.Zero;
            Location = _loc.ToInvariantString();
            MoveType = MoveToType.Location;
            Pathing = NavigationType.Navigator;

            Properties["Entry"].Show = false;
            Properties["MoveType"].PropertyChanged += MoveToActionPropertyChanged;
            Properties["Location"].PropertyChanged += LocationChanged;
        }
Exemplo n.º 8
0
 public static List<WoWPoint> ProcessSlopeAndLavaResults(List<WoWPoint> testPoints, WoWPoint[] slopePoints,
                                                         bool[] lavaHits)
 {
     //float slopeRise = AutoAngler2.Instance.MySettings.LandingSpotSlope / 2;
     const float slopeRise = 0.60f;
     var retList = new List<WoWPoint>();
     for (int i = 0; i < testPoints.Count; i++)
     {
         if (slopePoints[i*4] != WoWPoint.Zero &&
             slopePoints[i*4 + 1] != WoWPoint.Zero &&
             slopePoints[i*4 + 2] != WoWPoint.Zero &&
             slopePoints[i*4 + 3] != WoWPoint.Zero &&
             // check for lava hits
             (lavaHits == null ||
              (lavaHits != null &&
               !lavaHits[i*4] &&
               !lavaHits[i*4 + 1] &&
               !lavaHits[i*4 + 2] &&
               !lavaHits[i*4 + 3]))
             )
         {
             if (ElevationDifference(testPoints[i], slopePoints[(i*4)]) <= slopeRise &&
                 ElevationDifference(testPoints[i], slopePoints[(i*4) + 1]) <= slopeRise &&
                 ElevationDifference(testPoints[i], slopePoints[(i*4) + 2]) <= slopeRise &&
                 ElevationDifference(testPoints[i], slopePoints[(i*4) + 3]) <= slopeRise)
             {
                 retList.Add(testPoints[i]);
             }
         }
     }
     return retList;
 }
Exemplo n.º 9
0
        public BuyItemAction()
        {
            Properties["Location"] = new MetaProp("Location", typeof(string),
                                                  new EditorAttribute(typeof(PropertyBag.LocationEditor),
                                                                      typeof(UITypeEditor)));
            Properties["NpcEntry"] = new MetaProp("NpcEntry", typeof(uint),
                                                  new EditorAttribute(typeof(PropertyBag.EntryEditor),
                                                                      typeof(UITypeEditor)));
            Properties["ItemID"] = new MetaProp("ItemID", typeof(string));
            Properties["Count"] = new MetaProp("Count", typeof(DynamicProperty<int>),
                                               new TypeConverterAttribute(typeof(DynamicProperty<int>.DynamivExpressionConverter)));
            Properties["BuyItemType"] = new MetaProp("BuyItemType", typeof(BuyItemActionType),
                                                     new DisplayNameAttribute("Buy"));
            Properties["BuyAdditively"] = new MetaProp("BuyAdditively", typeof(bool),
                                                       new DisplayNameAttribute("Buy Additively"));
            ItemID = "";
            Count = new DynamicProperty<int>(this, "0"); // dynamic expression
            RegisterDynamicProperty("Count");
            BuyItemType = BuyItemActionType.Material;
            _loc = WoWPoint.Zero;
            Location = _loc.ToInvariantString();
            NpcEntry = 0u;
            BuyAdditively = true;

            Properties["ItemID"].Show = false;
            Properties["Count"].Show = false;
            Properties["BuyAdditively"].Show = false;
            Properties["Location"].PropertyChanged += LocationChanged;
            Properties["BuyItemType"].PropertyChanged += BuyItemActionPropertyChanged;
        }
 void LocationChanged(object sender, EventArgs e) {
     MetaProp mp = (MetaProp)sender;
     loc = Util.StringToWoWPoint((string)((MetaProp)sender).Value);
     Properties["Location"].PropertyChanged -= new EventHandler(LocationChanged);
     Properties["Location"].Value = string.Format("<{0}, {1}, {2}>", loc.X, loc.Y, loc.Z);
     Properties["Location"].PropertyChanged += new EventHandler(LocationChanged);
     RefreshPropertyGrid();
 }
Exemplo n.º 11
0
        internal static void MoveTo(WoWPoint Location)
        {
            MoveTo(Location.X, Location.Y, Location.Z);

            // Rewrite this using just 1 write, as a struct.
            // from mem it was this ->

            //var CTM = new WoWMovement.ClickToMoveInfoStruct;
        }
Exemplo n.º 12
0
        /// <summary>
        /// calculate a unit's vertical distance (height) above ground level (mesh).  this is the units position
        /// relative to the ground and is independent of any other character.  
        /// </summary>
        /// <param name="u">unit</param>
        /// <returns>float.MinValue if can't determine, otherwise distance off ground</returns>
        public static float HeightOffTheGround(this WoWUnit u)
        {
            var unitLoc = new WoWPoint( u.Location.X, u.Location.Y, u.Location.Z);
            var listMeshZ = Navigator.FindHeights( unitLoc.X, unitLoc.Y).Where( h => h <= unitLoc.Z);
            if (listMeshZ.Any())
                return unitLoc.Z - listMeshZ.Max();

            return float.MaxValue;
        }
Exemplo n.º 13
0
        public override bool Run(WoWPoint location, int distance)
        {
            var nearestLocationToObject = WoWMathHelper.CalculatePointFrom(StyxWoW.Me.Location, location, distance);
            var pathToDest =
                Navigator.GeneratePath(StyxWoW.Me.Location, nearestLocationToObject);

            if (_recursiveHandlerCount >= 5)
            {
                Helper.UseHeartStone();
                _recursiveHandlerCount = 0;
            }
            else
            {
                if (pathToDest.Count() == 0)
                {
                    _recursiveHandlerCount++;
                    Run(ProfileManager.CurrentProfile.HotspotManager.GetNextHotspot(), 10);

                    return false;
                }
            }

            foreach (var localDest in pathToDest)
            {
                if (!StyxWoW.Me.IsFlying && !Navigator.CanNavigateFully(StyxWoW.Me.Location, localDest, 8192))
                {
                    Logging.Write(Colors.Red, "Cant navigate to the destination.");
                    return false;
                }

                try
                {
                    if (Helper.BlacklistHotspot(localDest)) return true;

                    while (localDest.Distance(StyxWoW.Me.Location) >= 5 && TreeRoot.IsRunning)
                    {
                        if (Helper.BlacklistHotspot(localDest)) return true;

                        if (Helper.GetInCombat()) break;

                        ClassBase.Avoid();

                        if(!ShouldStayStealth) Helper.MountUp(ClassBase.MountName);

                        Navigator.MoveTo(localDest);

                        Thread.Sleep(100);
                    }
                    if (Helper.GetInCombat()) break;
                }
                catch (Exception exception)
                {
                    Logging.Write(Colors.Red, exception.Message);
                }
            }
            return true;
        }
        public UseHearthstone(Dictionary<string, string> args)
            : base(args)
        {
            m_Complete = false;

            try
            {
                if (Args.ContainsKey("OutsideDistance"))
                {
                    float Distance = 0.0f;

                    if (!float.TryParse(Args["OutsideDistance"], out Distance))
                    {
                        throw new ArgumentException("Parsing attribute 'OutsideDistance' in SetHearthstone behavior failed! Please check your profile!");
                    }

                    m_OutsideDistance = Distance;
                }
                else
                {
                    m_OutsideDistance = null;
                }

                float X;
                float Y;
                float Z;

                if (!float.TryParse(Args["X"], out X))
                {
                    throw new ArgumentException("Parsing attribute 'X' in SetHearthstone behavior failed! Please check your profile!");
                }

                if (!float.TryParse(Args["Y"], out Y))
                {
                    throw new ArgumentException("Parsing attribute 'Y' in SetHearthstone behavior failed! Please check your profile!");
                }

                if (!float.TryParse(Args["Z"], out Z))
                {
                    throw new ArgumentException("Parsing attribute 'Z' in SetHearthstone behavior failed! Please check your profile!");
                }

                m_Location = new WoWPoint(X, Y, Z);

                if (!uint.TryParse(Args["HearthLocation"], out m_HearthLocation))
                {
                    throw new ArgumentException("Parsing attribute 'HearthLocation' in SetHearthstone behavior failed! Please check your profile!");
                }
            }
            catch (Exception Ex)
            {
                Logging.Write(string.Format("Failed to create UseHearthstone behavior.\nException:\n{0}", Ex.ToString()));

                Thread.CurrentThread.Abort();
            }
        }
		public static void movetoLoc(WoWPoint loc)
		{
			while (loc.Distance(Me.Location) > 10)
			{
				Navigator.MoveTo(loc);
				Thread.Sleep(100);
				if (inCombat) return;
			}
			Thread.Sleep(2000);
		}
Exemplo n.º 16
0
        public TrainSkillAction()
        {
            Properties["Location"] = new MetaProp("Location", typeof(string), new EditorAttribute(typeof(PropertyBag.LocationEditor), typeof(UITypeEditor)));
            Properties["NpcEntry"] = new MetaProp("NpcEntry", typeof(uint), new EditorAttribute(typeof(PropertyBag.EntryEditor), typeof(UITypeEditor)));
            loc = WoWPoint.Zero;
            Location = loc.ToInvariantString();
            NpcEntry = 0u;

            Properties["Location"].PropertyChanged += new EventHandler(LocationChanged);
        }
Exemplo n.º 17
0
 public static WorldLine GetSlopeTraceLine(WoWPoint point, float xDelta, float yDelta)
 {
     WoWPoint topP = point;
     topP.X += xDelta;
     topP.Y += yDelta;
     topP.Z += 6;
     WoWPoint botP = topP;
     botP.Z -= 12;
     return new WorldLine(topP, botP);
 }
Exemplo n.º 18
0
 public static void MoveTo(WoWPoint point)
 {
     if (BotPoi.Current.Type != PoiType.None)
         BotPoi.Clear();
     if (!ObjectManager.Me.Mounted && Mount.ShouldMount(point) && Mount.CanMount())
         Mount.MountUp();
     TreeRoot.StatusText = string.Format("PB: Moving to {0}", point);
     _lastPoint = point;
     _lastMove = DateTime.Now;
     Navigator.MoveTo(point);
 }
Exemplo n.º 19
0
 public override MoveResult MoveTo(WoWPoint location)
 {
     try
     {
         return MoveResult.Failed;
     }
     catch (Exception ex)
     {
         Logger.DiagnosticLog("EnyoNavigator.MoveTo() Exception: {0}", ex); return MoveResult.Failed;
     }
 }
Exemplo n.º 20
0
 public static bool IsFacing2D(WoWPoint me, float myFacingRadians, WoWPoint target, float arcRadians)
 {
     me.Z = target.Z = 0;
     arcRadians = WoWMathHelper.NormalizeRadian(arcRadians);
     float num = WoWMathHelper.CalculateNeededFacing(me, target);
     float num2 = WoWMathHelper.NormalizeRadian(num - myFacingRadians);
     if (num2 > 3.1415926535897931)
     {
         num2 = (float)(6.2831853071795862 - num2);
     }
     bool result = (num2 <= arcRadians / 2f);
     return result;
 }
Exemplo n.º 21
0
 //if pool is between CurrentPoint and NextPoint then cycle to nextPoint
 public void CycleToNextIfBehind(WoWGameObject pool)
 {
     WoWPoint cp = CurrentPoint;
     WoWPoint point = GetNextWayPoint();
     point = new WoWPoint(point.X - cp.X, point.Y - cp.Y, 0);
     point.Normalize();
     float angle = WoWMathHelper.NormalizeRadian((float)Math.Atan2(point.Y, point.X - 1));
     if (WoWMathHelper.IsFacing(CurrentPoint, angle, pool.Location)
         && CurrentPoint != WayPoints[WayPoints.Count - 1])
     {
         CycleToNextPoint();
     }
 }
Exemplo n.º 22
0
        public CancelAuctionAction()
        {
            Properties["ItemID"] = new MetaProp("ItemID", typeof (string),
                                                new DisplayNameAttribute(Pb.Strings["Action_Common_ItemEntries"]));

            Properties["AutoFindAh"] = new MetaProp("AutoFindAh", typeof (bool),
                                                    new DisplayNameAttribute(Pb.Strings["Action_Common_AutoFindAH"]));

            Properties["Location"] = new MetaProp("Location", typeof (string),
                                                  new EditorAttribute(typeof (PropertyBag.LocationEditor),
                                                                      typeof (UITypeEditor)),
                                                  new DisplayNameAttribute(Pb.Strings["Action_Common_Location"]));

            Properties["UseCategory"] = new MetaProp("UseCategory", typeof (bool),
                                                     new DisplayNameAttribute(Pb.Strings["Action_Common_UseCategory"]));

            Properties["Category"] = new MetaProp("Category", typeof (WoWItemClass),
                                                  new DisplayNameAttribute(Pb.Strings["Action_Common_ItemCategory"]));

            Properties["SubCategory"] = new MetaProp("SubCategory", typeof (WoWItemTradeGoodsClass),
                                                     new DisplayNameAttribute(
                                                         Pb.Strings["Action_Common_ItemSubCategory"]));

            Properties["MinBuyout"] = new MetaProp("MinBuyout", typeof (PropertyBag.GoldEditor),
                                                   new TypeConverterAttribute(typeof (PropertyBag.GoldEditorConverter)),
                                                   new DisplayNameAttribute(Pb.Strings["Action_Common_MinBuyout"]));

            Properties["IgnoreStackSizeBelow"] = new MetaProp("IgnoreStackSizeBelow", typeof (uint),
                                                              new DisplayNameAttribute(
                                                                  Pb.Strings["Action_Common_IgnoreStackSizeBelow"]));

            ItemID = "0";
            AutoFindAh = true;
            _loc = WoWPoint.Zero;
            Location = _loc.ToInvariantString();
            UseCategory = false;
            Category = WoWItemClass.TradeGoods;
            SubCategory = WoWItemTradeGoodsClass.None;
            MinBuyout = new PropertyBag.GoldEditor("0g0s0c");
            IgnoreStackSizeBelow = 1u;

            Properties["AutoFindAh"].PropertyChanged += AutoFindAHChanged;
            Properties["Location"].PropertyChanged += LocationChanged;
            Properties["UseCategory"].PropertyChanged += UseCategoryChanged;
            Properties["Category"].PropertyChanged += CategoryChanged;

            Properties["Category"].Show = false;
            Properties["SubCategory"].Show = false;
            Properties["Location"].Show = false;
        }
Exemplo n.º 23
0
        public q25165(Dictionary<string, string> args)
            : base(args)
        {
            CheckForUnrecognizedAttributes(recognizedAttributes);

            int questId = 0;
            WoWPoint location = new WoWPoint(0, 0, 0);

            success = success && GetAttributeAsInteger("QuestId", false, "0", 0, int.MaxValue, out questId);
            success = success && GetXYZAttributeAsWoWPoint("X", "Y", "Z", true, new WoWPoint(0, 0, 0), out location);

            QuestId = (uint)questId;
            Location = location;
        }
Exemplo n.º 24
0
        // 25Feb2013-12:50UTC chinajade
        public IEnumerable<WoWUnit> FindHostileUnitsWithinAggroRangeOFDestination(
            WoWPoint destination,
            double extraRangePadding = 0.0,
            ProvideBoolDelegate extraQualifiers = null)
        {
            extraQualifiers = extraQualifiers ?? (context => true);

            return
                from wowUnit in ObjectManager.GetObjectsOfType<WoWUnit>(true, false)
                where
                    IsViableForFighting(wowUnit)
                    && wowUnit.IsHostile      
                    && extraQualifiers(wowUnit)
                    && (wowUnit.Location.SurfacePathDistance(destination) <= (wowUnit.MyAggroRange + extraRangePadding))
                select wowUnit;
        }
 private void SafeMoveToPoint(WoWPoint point, int duration)
 {
     moveTimer.Reset();
     moveTimer.Start();
     while (Me.HealthPercent > 1)
     {
         Thread.Sleep(500);
         Navigator.MoveTo(point);
         if (!Me.HasAura("Stealth") || moveTimer.ElapsedMilliseconds >= duration)
         {
             break;
         }
         WoWMovement.MoveStop();
     }
     return;
 }
Exemplo n.º 26
0
        public static int CountOfAddsInRange(double distance, WoWPoint location)
        {
            List<WoWUnit> hlist =
                (from o in ObjectManager.ObjectList
                 where o is WoWUnit
                 let p = o.ToUnit()
                 where p.Distance2D < 40
                       && !p.Dead
                       && p.Combat
                       && (p.IsTargetingMyPartyMember || p.IsTargetingMeOrPet)
                       && p.IsHostile
                       && p.Attackable
                 select p).ToList();

            return hlist.Count(u => location.Distance(u.Location) <= distance);
        }
        public UseItemOn(Dictionary<string, string> args)
            : base(args)
        {

            CheckForUnrecognizedAttributes(recognizedAttributes);

            int itemId = 0;
            int range = 0;
            int npcID = 0;
            int npcID2 = 0;
            int npcID3 = 0;
            int factionid = 0;
            int numberoftimes = 0;
            int hpAmountLeft = 0;
            int inCombatHpUse = 0;
            int waittime = 0;
            int questId = 0;
            WoWPoint location = new WoWPoint(0, 0, 0);
            
            success = success && GetAttributeAsInteger("ItemId", true, "1", 0, int.MaxValue, out itemId);
            success = success && GetAttributeAsInteger("Range", false, "5", 0, int.MaxValue, out range);
            success = success && GetAttributeAsInteger("NpcId", true, "1", 0, int.MaxValue, out npcID);
            success = success && GetAttributeAsInteger("NpcId2", false, "1", 0, int.MaxValue, out npcID2);
            success = success && GetAttributeAsInteger("NpcId3", false, "1", 0, int.MaxValue, out npcID3);
            success = success && GetAttributeAsInteger("FactionID", false, "0", 0, int.MaxValue, out factionid);
            success = success && GetAttributeAsInteger("NumOfTimes", false, "1", 0, int.MaxValue, out numberoftimes);
            success = success && GetAttributeAsInteger("HpLeftAmount", false, "110", 0, int.MaxValue, out hpAmountLeft);
            success = success && GetAttributeAsInteger("InCombatHPUse", false, "0", 0, int.MaxValue, out inCombatHpUse);
            success = success && GetAttributeAsInteger("WaitTime", false, "1000", 0, int.MaxValue, out waittime);
            success = success && GetAttributeAsInteger("QuestId", false, "0", 0, int.MaxValue, out questId);
            success = success && GetXYZAttributeAsWoWPoint("X", "Y", "Z", true, new WoWPoint(0, 0, 0), out location);

            QuestId = (uint)questId;
            ItemID = itemId;
            Range = range;
            NPCID = npcID;
            NPCID2 = npcID2;
            NPCID3 = npcID3;
            FactionID = factionid;
            Counter = 1;
            WaitTime = waittime;
            HpLeftAmount = hpAmountLeft;
            InCombatHPUse = inCombatHpUse;
            MovedToTarget = false;
            NumberOfTimes = numberoftimes;
            Location = location;
        }
Exemplo n.º 28
0
        public MoveToAction()
        {
            Properties["Entry"] = new MetaProp("Entry", typeof(uint), new EditorAttribute(typeof(PropertyBag.EntryEditor), typeof(UITypeEditor)));
            Properties["Location"] = new MetaProp("Location", typeof(string), new EditorAttribute(typeof(PropertyBag.LocationEditor), typeof(UITypeEditor)));
            Properties["MoveType"] = new MetaProp("MoveType", typeof(MoveToType), new DisplayNameAttribute("MoveTo Type"));
            Properties["Pathing"] = new MetaProp("Pathing", typeof(NavigationType), new DisplayNameAttribute("Use"));

            Entry = 0u;
            loc = WoWPoint.Zero;
            Location = loc.ToInvariantString();
            MoveType = MoveToType.Location;
            Pathing = NavigationType.Navigator;

            Properties["Entry"].Show = false;
            Properties["MoveType"].PropertyChanged += new EventHandler(MoveToAction_PropertyChanged);
            Properties["Location"].PropertyChanged += new EventHandler(LocationChanged);
        }
Exemplo n.º 29
0
 public static List<WorldLine> GetQuadSloopTraceLines(WoWPoint point)
 {
     //float delta = AutoAngler2.Instance.MySettings.LandingSpotWidth / 2;
     const float delta = 0.5f;
     var wl = new List<WorldLine>
                  {
                      // north west
                      GetSlopeTraceLine(point, delta, -delta),
                      // north east
                      GetSlopeTraceLine(point, delta, delta),
                      // south east
                      GetSlopeTraceLine(point, -delta, delta),
                      // south west
                      GetSlopeTraceLine(point, -delta, -delta)
                  };
     return wl;
 }
        public SellItemAction() {
            Properties["Location"] = new MetaProp("Location", typeof(string), new EditorAttribute(typeof(PropertyBag.LocationEditor), typeof(UITypeEditor)));
            Properties["NpcEntry"] = new MetaProp("NpcEntry", typeof(uint), new EditorAttribute(typeof(PropertyBag.EntryEditor), typeof(UITypeEditor)));
            Properties["ItemID"] = new MetaProp("ItemID", typeof(string));
            Properties["Count"] = new MetaProp("Count", typeof(uint));
            Properties["SellItemType"] = new MetaProp("SellItemType", typeof(SellItemActionType), new DisplayNameAttribute("Sell Item Type"));

            ItemID = "";
            Count = 0u;
            loc = WoWPoint.Zero;
            Location = loc.ToInvariantString();
            NpcEntry = 0u;

            Properties["Location"].PropertyChanged += new EventHandler(LocationChanged);
            Properties["SellItemType"].Value = SellItemActionType.Specific;
            Properties["SellItemType"].PropertyChanged += new EventHandler(SellItemAction_PropertyChanged);
        }
Exemplo n.º 31
0
        private bool TotemManagerUpdate()
        {
            int countTotems = 0;

            _ptTotems = new WoWPoint();
            _totem    = new WoWUnit[5];

#if USE_OLD_SEARCH
            List <WoWUnit> totemList = (from o in ObjectManager.ObjectList
                                        where o is WoWUnit
                                        let unit = o.ToUnit()
                                                   where unit.CreatedByUnitGuid == _me.Guid &&
                                                   unit.CreatureType == WoWCreatureType.Totem
                                                   select unit
                                        ).ToList();

            foreach (WoWUnit totem in totemList)
            {
                int indexTotem = 0;
                try
                {
                    countTotems++;
                    indexTotem         = _dictTotemSlot[(TotemId)totem.CreatedBySpellId];
                    _totem[indexTotem] = totem;
                    if (totem.Distance < _ptTotems.Distance(_me.Location))
                    {
                        _ptTotems = totem.Location;
                    }
                }
                catch
                {
                    Shaman.Wlog("NOTIFY SHAMWOW DEVELOPER:  Unknown totem: totem spell id={0}, totem name='{1}', index totem={2}", totem.CreatedBySpellId, totem.Name, indexTotem);
                }
            }
#else
            foreach (WoWTotemInfo ti in _me.Totems)
            {
                if (ti.WoWTotem != WoWTotem.None)
                {
                    countTotems++;

                    try
                    {
                        WoWUnit totem      = ObjectManager.GetObjectByGuid <WoWUnit>(ti.Guid);
                        int     indexTotem = _dictTotemSlot[(TotemId)totem.CreatedBySpellId];
                        _totem[indexTotem] = totem;
                        if (totem.Distance < _ptTotems.Distance(_me.Location))
                        {
                            _ptTotems = totem.Location;
                        }
                    }
                    catch
                    {
                        Shaman.Wlog("NOTIFY SHAMWOW DEVELOPER:  Unknown totem: totem spell id={0}, totem name='{1}'", ti.Spell.Id, ti.Name);
                    }
                }
            }
#endif

#if SHOW_TOTEM_COUNT
            if (countTotems > 0)
            {
                Shaman.Dlog("TotemManagerUpdate:  found {0} totems with closest {1:F1} yds away at {2}", countTotems, _ptTotems.Distance(_me.Location), _ptTotems.ToString());
            }
#endif

            return(countTotems > 0);
        }
Exemplo n.º 32
0
        public void findAndKillMob()
        {
            bool CastSuccess = false;
            int  loothelper  = 0;

            if (Rarekiller.Settings.DeveloperLogs)
            {
                Logging.WriteDebug("Rarekiller: Scan for Rare Mob");
            }
            // ----------------- Generate a List with all wanted Rares found in Object Manager ---------------------
            ObjectManager.Update();
            List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>()
                                     .Where(o => (
                                                (Rarekiller.Settings.CATA && ((o.Entry == 50057) ||                                           // Blazewing Hyjal
                                                                              (o.Entry == 50053) ||                                           // Thartuk the Exile Hyjal
                                                                              (o.Entry == 50050) ||                                           // Shok'sharak Vashir
                                                                              (o.Entry == 50005) ||                                           // Poseidus Vashir
                                                                              (o.Entry == 50052) ||                                           // Burgy Blackheart Vashir
                                                                              (o.Entry == 49913) ||                                           // Lady La-La Vashir
                                                                              (o.Entry == 50060) ||                                           // Terborus Tiefenheim
                                                                              (o.Entry == 50059) ||                                           // Golgarok Tiefenheim
                                                                              (o.Entry == 49822) ||                                           // Jadefang Tiefenheim
                                                                              (o.Entry == 50065) ||                                           // Armagedillo Uldum
                                                                              (o.Entry == 50064) ||                                           // Cyrus the Black Uldum
                                                                              (o.Entry == 50085) ||                                           // Overlord Sunderfury Twilight Higlands
                                                                              (o.Entry == 50086))) ||                                         // Tarvus the Vile Twilight Higlands
                                                (Rarekiller.Settings.Aeonaxx && (((o.Entry == 3868) && Rarekiller.Settings.BloodseekerSearch) // Blood Seeker for Aeonaxx
                                                                                 )) ||                                                        // Aeonaxx hostile || (o.Entry == 51236)
                                                (Rarekiller.Settings.Poseidus && ((o.Entry == 50005) || // Poseidus
                                                                                  (o.Entry == 9999999))) ||                                   // Platzhalter
                                                (Rarekiller.Settings.TLPD && ((o.Entry == 32491) ||                                           // Timelost Protodrake
                                                                              (o.Entry == 32630))) ||                                         // Vyragosa
                                                (Rarekiller.Settings.WOTLK && ((o.Entry == 32517) ||                                          // Loque'nahak
                                                                               (o.Entry == 32495) ||                                          // Hildana Deathstealer
                                                                               (o.Entry == 32358) ||                                          // Fumblub Gearwind
                                                                               (o.Entry == 32377) ||                                          // Perobas the Bloodthirster
                                                                               (o.Entry == 32398) ||                                          // King Ping
                                                                               (o.Entry == 32409) ||                                          // Crazed Indu'le Survivor
                                                                               (o.Entry == 32422) ||                                          // Grocklar
                                                                               (o.Entry == 32438) ||                                          // Syreian the Bonecarver
                                                                               (o.Entry == 32471) ||                                          // Griegen
                                                                               (o.Entry == 32481) ||                                          // Aotona
                                                                               (o.Entry == 32630) ||                                          // Vyragosa
                                                                               (o.Entry == 32487) ||                                          // Putridus the Ancient
                                                                               (o.Entry == 32501) ||                                          // High Thane Jorfus
                                                                               (o.Entry == 32357) ||                                          // Old Crystalbark
                                                                               (o.Entry == 32361) ||                                          // Icehorn
                                                                               (o.Entry == 32386) ||                                          // Vigdis the War Maiden
                                                                               (o.Entry == 32400) ||                                          // Tukemuth
                                                                               (o.Entry == 32417) ||                                          // Scarlet Highlord Daion
                                                                               (o.Entry == 32429) ||                                          // Seething Hate
                                                                               (o.Entry == 32447) ||                                          // Zul'drak Sentinel
                                                                               (o.Entry == 32475) ||                                          // Terror Spinner
                                                                               (o.Entry == 32485) ||                                          // King Krush
                                                                               (o.Entry == 32500))) ||                                        // Dirkee
                                                (Rarekiller.Settings.BC && ((o.Entry == 18695) ||                                             // Ambassador Jerrikar
                                                                            (o.Entry == 18697) ||                                             // Chief Engineer Lorthander
                                                                            (o.Entry == 18694) ||                                             // Collidus the Warp-Watcher
                                                                            (o.Entry == 18686) ||                                             // Doomslayer Jurim
                                                                            (o.Entry == 18678) ||                                             // Fulgorge
                                                                            (o.Entry == 18692) ||                                             // Hemathion
                                                                            (o.Entry == 18680) ||                                             // Marticar
                                                                            (o.Entry == 18690) ||                                             // Morcrush
                                                                            (o.Entry == 18685) ||                                             // Okrek
                                                                            (o.Entry == 18683) ||                                             // Voidhunter Yar
                                                                            (o.Entry == 18682) ||                                             // Bog Lurker
                                                                            (o.Entry == 18681) ||                                             // Coilfang Emissary
                                                                            (o.Entry == 18689) ||                                             // Crippler
                                                                            (o.Entry == 18698) ||                                             // Ever-Core the Punisher
                                                                            (o.Entry == 17144) ||                                             // Goretooth
                                                                            (o.Entry == 18696) ||                                             // Kraator
                                                                            (o.Entry == 18677) ||                                             // Mekthorg the Wild
                                                                            (o.Entry == 20932) ||                                             // Nuramoc
                                                                            (o.Entry == 18693) ||                                             // Speaker Mar'grom
                                                                            (o.Entry == 18679))) ||                                           // Vorakem Doomspeaker
                                                ((o.Level < Rarekiller.Settings.Level) && Rarekiller.Settings.LowRAR && (o.CreatureRank == Styx.WoWUnitClassificationType.Rare)) || // every single Rare Mob < Level 61 is hunted
                                                (Rarekiller.Settings.HUNTbyID && (o.Entry == Convert.ToInt64(Rarekiller.Settings.MobID)))     // Hunt special IDs
                                                ))
                                     .OrderBy(o => o.Distance).ToList();

            foreach (WoWUnit o in objList)
            {
                if (!o.Dead && !o.IsPet && !Blacklist.Contains(o.Guid))
                {
                    Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}", o.Name, o.Entry);
                    //if ((o.Entry == 51236) && !Me.IsOnTransport)
                    //{
                    //    Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Find {0} ID {1}, but I don't mounted him", o.Name, o.Entry);
                    //    Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                    //    Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                    //    return;
                    //}
                    //else if (o.Entry == 51236)
                    //    return;

                    if (o.Entry != 51236)
                    {
                        if (o.Level > (Me.Level + 4))
                        {
                            Logging.Write("Rarekiller: His Level is 5 over mine, better not to kill him.");
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                            Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                            return;
                        }
                        if (o.IsFriendly)
                        {
                            Logging.Write("Rarekiller: Find {0}, but he's friendly", o.Name);
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                            Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                            return;
                        }
                        if ((o.Entry == 32630) && !Rarekiller.Settings.Vyragosa)
                        {
                            Logging.Write("Rarekiller: Config says: don't kill Vyragosa.");
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                            Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes.");
                            return;
                        }
                        if ((o.Entry == 50057) && !Rarekiller.Settings.Blazewing)
                        {
                            Logging.Write("Rarekiller: Config says: don't kill Blazewing.");
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                            Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes.");
                            return;
                        }
                        if ((o.Entry == 596) || (o.Entry == 599))
                        {
                            // ----------------- Distancecheck because of the Spawn Place is Underground
                            Logging.Write("Rarekiller: Don't run wild because of Instance Mobs.");
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                            Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                            return;
                        }

                        if (((o.Entry == 49822) || (o.Entry == 50086) || (o.Entry == 2744)) && (Me.IsFlying || o.Location.Distance(Me.Location) > 30))
                        {
                            // ----------------- Distancecheck because of the Spawn Place is Underground
                            Logging.Write("Rarekiller: {0} is more then 20 yd away and Underground", o.Name);
                            Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller: You have to place me next to him, if you want to hunt this Mob.");
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                            Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes.");
                            return;
                        }

                        if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(o.Entry)))
                        {
                            Logging.Write("Rarekiller: {0} is Member of the BlacklistedMobs.xml", o.Name);
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15));
                            Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 15 Minutes.");
                            return;
                        }
                        if (Rarekiller.Settings.NotKillTameable && o.IsTameable)
                        {
                            return;
                        }
                        if (Rarekiller.inCombat)
                        {
                            Logging.Write("Rarekiller: ... but first I have to finish fighting another one.");
                            return;
                        }
                        if (Me.IsOnTransport)
                        {
                            Logging.Write("Rarekiller: ... but I'm on a Transport.");
                            return;
                        }
                        if ((o.Entry == 3868) && !Rarekiller.Settings.BloodseekerKill)
                        {
                            Rarekiller.Settings.Range = "35";
                        }
                        // ----------------- Check if hunted Mob is tagged by another Player ---------------------
                        if (Rarekiller.Settings.DontKillTagged)
                        {
                            if (o.TaggedByOther)
                            {
                                WoWMovement.MoveStop();
                                Logging.Write(System.Drawing.Color.Red, "Rarekiller: {0} is tagged by another player", o.Name);
                                if (Rarekiller.Settings.BlacklistTagged)
                                {
                                    Logging.Write("Rarekiller: -- I'm a nice Guy so let him have it");
                                    Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist2));
                                    Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 2 Minutes.");
                                    return;
                                }
                                else
                                {
                                    Logging.Write("Rarekiller: -- lets take a look who wins :)");
                                }
                            }
                            while (o.TaggedByOther && !o.Dead)
                            {
                                if (Rarekiller.inCombat)
                                {
                                    return;
                                }
                                Thread.Sleep(1000);
                            }
                            if (o.Dead)
                            {
                                Logging.Write("Rarekiller: {0} was killed by another Player", o.Name);
                                Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                                Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                                return;
                            }
                        }
                    }

                    if (Rarekiller.Settings.Alert)
                    {
                        if (File.Exists(Rarekiller.Settings.SoundfileFoundRare) && (o.Entry != 51236))
                        {
                            new SoundPlayer(Rarekiller.Settings.SoundfileFoundRare).Play();
                        }
                        else if (File.Exists(Rarekiller.Soundfile))
                        {
                            new SoundPlayer(Rarekiller.Soundfile).Play();
                        }
                        else
                        {
                            Logging.Write(System.Drawing.Color.Red, "Rarekiller: playing Soundfile failes");
                        }
                    }

                    while (Me.IsCasting)
                    {
                        Thread.Sleep(100);
                    }

// ----------------- Move to Mob Part ---------------------
                    if (o.Entry != 51236)
                    {
                        if ((o.Entry == 49822) || (Rarekiller.Settings.GroundMountMode &&
                                                   (!(o.Entry == 50005) || // Poseidus Vashir
                                                    !(o.Entry == 50052) || // Burgy Blackheart Vashir
                                                    !(o.Entry == 49913)    // Lady La-La Vashir
                                                   )))                     //In Vashir you have to use Flightor !
                        {
                            ForceGround = true;
                        }
                        else
                        {
                            ForceGround = false;
                        }

                        Logging.Write("Rarekiller Part MoveTo: Move to target");
                        BlacklistTimer.Reset();
                        BlacklistTimer.Start();
                        Place = Me.ZoneId;
                        if (Rarekiller.Settings.GroundMountMode && ((o.Entry == 33687) || (o.Entry == 32630) || (o.Entry == 32491) || (o.Entry == 50057) || (o.Entry == 50005) || (o.Entry == 50052) || (o.Entry == 49913)))
                        {
                            WoWPoint LastLocation = o.Location;
                            while ((o.Location.Distance(Me.Location) > SpellManager.Spells[Rarekiller.Spells.FastPullspell].MaxRange) && !o.TaggedByOther && !o.Dead)
                            {
                                Logging.Write("Rarekiller: Try to hunt flying Mob {0} in Ground Mount Mode, maybe he comes in Range.", o.Name);
                                o.Face();
                                Thread.Sleep(100);
                                if (o.Location.Distance(Me.Location) > LastLocation.Distance(Me.Location))
                                {
                                    Logging.Write("Rarekiller: {0} is flying away", o.Name);
                                    if (!(o.Entry == 50005))
                                    {
                                        Blacklist.Add(o.Guid, TimeSpan.FromSeconds(10));
                                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 10 Seconds.");
                                    }
                                    return;
                                }
                                else
                                {
                                    LastLocation = o.Location;
                                }
                            }
                        }
                        else
                        {
                            while (o.Location.Distance(Me.Location) > Convert.ToInt64(Rarekiller.Settings.Range))
                            {
                                if (Rarekiller.Settings.GroundMountMode || ForceGround)
                                {
                                    Navigator.MoveTo(o.Location);
                                }
                                else
                                {
                                    Flightor.MoveTo(o.Location);
                                }
                                Thread.Sleep(100);

                                if (BlacklistTimer.Elapsed.TotalSeconds > 20 && FirstTry)
                                {
                                    Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Rarekiller: Can't reach Mob {0} so try to dismount and walk", o.Name);

                                    WoWMovement.MoveStop();
                                    Thread.Sleep(1000);
                                    //Descend to Land
                                    WoWMovement.Move(WoWMovement.MovementDirection.Descend);
                                    Thread.Sleep(2000);
                                    WoWMovement.MoveStop();
                                    //Walk some Meters to avoid standing on a Tent
                                    WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft);
                                    Thread.Sleep(500);
                                    WoWMovement.MoveStop();
                                    Thread.Sleep(1000);
                                    //Dismount
                                    if (Me.Auras.ContainsKey("Flight Form"))
                                    {
                                        Lua.DoString("CancelShapeshiftForm()");
                                    }
                                    else if (Me.Mounted)
                                    {
                                        Lua.DoString("Dismount()");
                                    }

                                    Thread.Sleep(300);
                                    ForceGround = true;
                                    FirstTry    = false;
                                    BlacklistTimer.Reset();
                                    BlacklistTimer.Start();
                                }

                                if (Rarekiller.Settings.BlacklistCheck && !FirstTry && (BlacklistTimer.Elapsed.TotalSeconds > (Convert.ToInt32(Rarekiller.Settings.BlacklistTime))))
                                {
                                    Logging.Write(System.Drawing.Color.Red, "Rarekiller Part MoveTo: Can't reach Mob {0}, Blacklist and Move on", o.Name);
                                    Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                                    Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes.");
                                    BlacklistTimer.Reset();
                                    WoWMovement.MoveStop();
                                    return;
                                }
                                if (Rarekiller.Settings.ZoneSave && (Me.ZoneId != Place))
                                {
                                    Logging.Write(System.Drawing.Color.Red, "Rarekiller Part MoveTo: Left Zone while move to {0} is not allowed", o.Name);
                                    Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                                    Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes.");
                                    BlacklistTimer.Reset();
                                    WoWMovement.MoveStop();
                                    return;
                                }
                            }
                            BlacklistTimer.Reset();
                            WoWMovement.MoveStop();
                        }

                        // ----------------- another Check if hunted Mob is tagged by another Player ---------------------
                        o.Target();
                        if (Rarekiller.Settings.DontKillTagged)
                        {
                            if (o.TaggedByOther)
                            {
                                Logging.Write(System.Drawing.Color.Red, "Rarekiller: {0} is tagged by another player", o.Name);
                                if (Rarekiller.Settings.BlacklistTagged)
                                {
                                    Logging.Write("Rarekiller: -- I'm a nice Guy so let him have it");
                                    Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist2));
                                    Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 2 Minutes.");
                                    return;
                                }
                                else
                                {
                                    Logging.Write("Rarekiller: -- lets take a look who wins :)");
                                }
                            }
                            while (o.TaggedByOther && !o.Dead)
                            {
                                if (Rarekiller.inCombat)
                                {
                                    return;
                                }
                                Thread.Sleep(1000);
                            }
                            if (o.Dead)
                            {
                                Logging.Write("Rarekiller: {0} was killed by another Player", o.Name);
                                Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                                Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                                return;
                            }
                        }

                        if (Rarekiller.Settings.ScreenRarekiller && Rarekiller.Settings.ScreenFound)
                        {
                            Lua.DoString("TakeScreenshot()");
                            Thread.Sleep(300);
                            Logging.WriteDebug("Rarekiller Part Rarekiller: Take Screenshot before Pull");
                        }
                        Logging.WriteDebug("Rarekiller: Pull at Mob Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z));
                        Logging.WriteDebug("Rarekiller: ... my Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z));
                        Logging.Write("Rarekiller: Target is Flying - {0}", o.IsFlying);
                        // move closer again
                        if (Rarekiller.Settings.GroundMountMode && ((o.Entry == 33687) || (o.Entry == 32630) || (o.Entry == 32491) || (o.Entry == 50057) || (o.Entry == 50005) || (o.Entry == 50052) || (o.Entry == 49913)))
                        {
                            o.Face();
                        }
                        else
                        {
                            while (o.Location.Distance(Me.Location) > Convert.ToInt64(Rarekiller.Settings.Range))
                            {
                                if (Rarekiller.Settings.GroundMountMode || ForceGround)
                                {
                                    Navigator.MoveTo(o.Location);
                                }
                                else
                                {
                                    Flightor.MoveTo(o.Location);
                                }
                                Thread.Sleep(100);
                            }
                        }
                        //----------------- Dismount -----------------------
                        if (Me.IsFlying && !((o.Entry == 33687) || (o.Entry == 32630) || (o.Entry == 32491) || (o.Entry == 50057) ||
                                             (o.Entry == 50005) || (o.Entry == 50052) || (o.Entry == 49913) || (o.Entry == 29753) || (o.Entry == 3868) || o.IsFlying))
                        {
                            //Descend to Land
                            WoWMovement.Move(WoWMovement.MovementDirection.Descend);
                            Thread.Sleep(1000);
                            if (Me.IsFlying && !Rarekiller.inCombat)
                            {
                                Thread.Sleep(1000);
                            }
                            WoWMovement.MoveStop();
                            //Dismount
                            if (Me.Auras.ContainsKey("Flight Form"))
                            {
                                Lua.DoString("CancelShapeshiftForm()");
                            }
                            else if (Me.Mounted)
                            {
                                Lua.DoString("Dismount()");
                            }

                            Thread.Sleep(150);
                        }
                    }
                    else
                    {
                        o.Target();
                    }
// ----------------- Pull Part --------------------
                    ForceGround = false;
                    FirstTry    = true;
                    if (!Me.Mounted && ((Me.Class == WoWClass.Hunter) || (Me.Class == WoWClass.Warlock)))
                    {
                        Lua.DoString(string.Format("RunMacroText(\"/petpassive\")"), 0);
                    }

                    if ((o.Entry == 3868) && !Rarekiller.Settings.BloodseekerKill)
                    {
                        while (!o.Dead)
                        {
                            WoWMovement.MoveStop();
                            o.Target();
                            o.Face();
                            Thread.Sleep(1000);
                        }
                        return;
                    }

                    if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, o, false);
                    }
                    else if (SpellManager.HasSpell(Rarekiller.Spells.FastPullspell))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.FastPullspell, o, false);
                    }
                    else if ((o.Entry != 32630) && (o.Entry != 32491) && (o.Entry != 33687) && (o.Entry != 50057) && SpellManager.HasSpell(Rarekiller.Spells.LowPullspell))
                    {
                        if (Me.Auras.ContainsKey("Flight Form") && (o.Entry != 51236))
                        {
                            Lua.DoString("CancelShapeshiftForm()");
                        }
                        else if (Me.Mounted && (o.Entry != 51236))
                        {
                            Lua.DoString("Dismount()");
                        }

                        Thread.Sleep(150);
                        WoWMovement.MoveStop();
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.LowPullspell, o, true);
                        if (o.Entry == 51236)
                        {
                            Lua.DoString("StartAttack()");
                        }
                    }
                    else
                    {
                        Logging.Write(System.Drawing.Color.Red, "Rarekiller: I have no valid Pullspell - set Range to 3 for next try");
                        Rarekiller.Settings.Range = "3";
                        return;
                    }

                    if (CastSuccess)
                    {
                        Logging.Write("Rarekiller: Successfully pulled {0}", o.Name);
                    }
                    else
                    {
                        Logging.Write("Rarekiller: Pull fails - set Range to 3 for next try", o.Name);
                        Rarekiller.Settings.Range = "3";
                    }
                    if (!Me.Mounted && ((Me.Class == WoWClass.Hunter) || (Me.Class == WoWClass.Warlock)))
                    {
                        Lua.DoString(string.Format("RunMacroText(\"/petdefensive\")"), 0);
                    }

                    Thread.Sleep(100);
                    WoWMovement.MoveStop();
                    Logging.WriteDebug("Rarekiller: Use Quick Slowfall: {0} Mob: {1}", Me.IsFalling, o.Name);
                    if (Me.IsFalling && Rarekiller.Settings.UseSlowfall && ((o.Entry == 29753) || (o.Entry == 3868) || (o.Entry == 32491) || (o.Entry == 32630) || (o.Entry == 33687)))
                    {
                        Thread.Sleep(200);
                        Rarekiller.Slowfall.HelpFalling();
                    }
                    if (Me.CurrentTarget != o)
                    {
                        o.Target();
                    }
                    o.Face();
                    return;
                }
                else if (o.Dead)
                {
                    if (o.CanLoot)
                    {
// ----------------- Loot Helper for all killed Rare Mobs ---------------------
                        Logging.Write("Rarekiller: Found lootable corpse, move to him");

// ----------------- Move to Corpse -------------------
                        if (Rarekiller.Settings.GroundMountMode && (!(o.Entry == 50005) || // Poseidus Vashir
                                                                    !(o.Entry == 50052) || // Burgy Blackheart Vashir
                                                                    !(o.Entry == 49913)    // Lady La-La Vashir
                                                                    ))                     //In Vashir you have to use Flightor !
                        {
                            ForceGround = true;
                        }
                        else
                        {
                            ForceGround = false;
                        }
                        Logging.Write("Rarekiller Part MoveTo: Move to target");
                        while (o.Location.Distance(Me.Location) > 5)
                        {
                            if (Rarekiller.Settings.GroundMountMode || ForceGround)
                            {
                                Navigator.MoveTo(o.Location);
                            }
                            else
                            {
                                Flightor.MoveTo(o.Location);
                            }
                            Thread.Sleep(100);
                            if (Rarekiller.inCombat)
                            {
                                return;
                            }
                        }
                        WoWMovement.MoveStop();

                        if (Me.Auras.ContainsKey("Flight Form"))
                        {
                            Lua.DoString("CancelShapeshiftForm()");
                        }
                        else if (Me.Mounted)
                        {
                            Lua.DoString("Dismount()");
                        }

                        if (Rarekiller.Settings.ScreenRarekiller && Rarekiller.Settings.ScreenSuccess)
                        {
                            Lua.DoString("TakeScreenshot()");
                            Thread.Sleep(500);
                            Logging.WriteDebug("Rarekiller Part Rarekiller: Take Screenshot successfully killed {0}", o.Name);
                        }
                        while (loothelper < 3)
                        {
                            Thread.Sleep(500);
                            WoWMovement.MoveStop();
                            o.Interact();
                            Thread.Sleep(2000);
                            Lua.DoString("RunMacroText(\"/click StaticPopup1Button1\");");
                            Thread.Sleep(4000);
                            if (!o.CanLoot)
                            {
                                Logging.Write("Rarekiller: successfully looted");
                                Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                                Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                                return;
                            }
                            else
                            {
                                Logging.Write("Rarekiller: Loot failed, try again");
                                loothelper = loothelper + 1;
                            }
                            Logging.Write("Rarekiller: Loot failed 3 Times");
                        }
                    }

                    if (!Blacklist.Contains(o.Guid))
                    {
                        Logging.Write("Rarekiller: Find {0}, but sadly he's dead", o.Name);
                        Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes.");
                    }
                }
            }
        }
        public Composite CreateBehavior_KillMantid()
        {
            WoWUnit   attackTarget        = null;
            WoWUnit   IronShredder        = null;
            WaitTimer DeathFromAboveTimer = WaitTimer.TenSeconds;

            return(new Decorator(r => !Me.IsQuestComplete(QuestId) && Query.IsInVehicle() && (IronShredder = Me.CharmedUnit) != null,
                                 new PrioritySelector(ctx => attackTarget = GetAttackTarget(),
                                                      new Decorator(ctx => attackTarget != null,
                                                                    new PrioritySelector(
                                                                        new ActionFail(ctx => _stuckTimer.Reset()),
                                                                        new ActionSetActivity("Moving to Attack"),
                                                                        new Decorator(ctx => Me.CurrentTargetGuid != attackTarget.Guid,
                                                                                      new ActionFail(ctx => attackTarget.Target())),
                                                                        new Decorator(ctx => !Me.IsSafelyFacing(attackTarget) || !IronShredder.IsSafelyFacing(attackTarget),
                                                                                      new ActionFail(ctx => attackTarget.Face())),

                                                                        // cast 'Death From Above' ability on targets outside of melee
                                                                        new Decorator(
                                                                            ctx =>
                                                                            IronShredder.Location.DistanceSqr(attackTarget.Location) > 10 * 10 && IronShredder.Location.DistanceSqr(attackTarget.Location) < 70 * 70 && DeathFromAboveTimer.IsFinished,
                                                                            new Sequence(
                                                                                new Action(ctx => Lua.DoString("CastPetAction(2)")),
                                                                                new WaitContinue(2, ctx => StyxWoW.Me.CurrentPendingCursorSpell != null, new ActionAlwaysSucceed()),
                                                                                new Action(ctx => SpellManager.ClickRemoteLocation(attackTarget.Location)),
                                                                                new Action(ctx => DeathFromAboveTimer.Reset()))),

                                                                        // cast 'Elecrostatic Distortion' ability on melee range target.
                                                                        new Decorator(
                                                                            ctx => IronShredder.Location.DistanceSqr(attackTarget.Location) <= 25 * 25,
                                                                            new PrioritySelector(
                                                                                new Decorator(
                                                                                    ctx => IronShredder.Location.DistanceSqr(attackTarget.Location) <= 25 * 25 && (Me.IsMoving || Me.CharmedUnit.IsMoving),
                                                                                    new ActionFail(ctx => WoWMovement.ClickToMove(Me.CharmedUnit.Location))),
                                                                                new Action(ctx => Lua.DoString("CastPetAction(1)")))),
                                                                        new Decorator(ctx => IronShredder.Location.DistanceSqr(attackTarget.Location) > 25 * 25,
                                                                                      new Action(ctx => Navigator.MoveTo(attackTarget.Location))))),
                                                      new Decorator(
                                                          ctx => attackTarget == null,
                                                          new PrioritySelector(
                                                              new Decorator(
                                                                  ctx => IronShredder.Location.DistanceSqr(_waitPoint) > 10 * 10,
                                                                  new PrioritySelector(
                                                                      // can't set path precision so I'll just handle it directly...
                                                                      // the IronShredder takes wide turns so needs a higher path precision than normal
                                                                      new Decorator(
                                                                          ctx =>
            {
                var nav = Navigator.NavigationProvider as MeshNavigator;
                if (nav == null)
                {
                    return false;
                }
                if (nav.CurrentMovePath == null || nav.CurrentMovePath.Index >= nav.CurrentMovePath.Path.Points.Length)
                {
                    return false;
                }
                WoWPoint point = nav.CurrentMovePath.Path.Points[nav.CurrentMovePath.Index];
                return point.DistanceSqr(IronShredder.Location) < 6 * 6;
            },
                                                                          new Action(ctx => ((MeshNavigator)Navigator.NavigationProvider).CurrentMovePath.Index++)),

                                                                      CreateBehavior_Antistuck(),

                                                                      new Action(ctx => Navigator.MoveTo(_waitPoint)))),
                                                              new ActionSetActivity("No viable targets, waiting."))),
                                                      new ActionAlwaysSucceed())));
        }
Exemplo n.º 34
0
 public BehaviorQuestTurnin(uint questId, WoWPoint loc, WoWPoint[] specialPoints, int npcEntryId, int rewardChoiceIndex = -1)
     : this(questId, loc, npcEntryId, rewardChoiceIndex)
 {
     _specialMovementPoints = specialPoints;
 }
Exemplo n.º 35
0
        public static async Task <bool> MoveTo(
            WoWPoint destination,
            string destinationName,
            MovementByType movementBy = MovementByType.FlightorPreferred)
        {
            Contract.Requires(destinationName != null, context => "destinationName may not be null");

            if (movementBy == MovementByType.None)
            {
                return(false);
            }

            var activeMover = WoWMovement.ActiveMover;

            if (activeMover == null)
            {
                return(false);
            }

            if (!IsMoveToMessageThrottled)
            {
                if (string.IsNullOrEmpty(destinationName))
                {
                    destinationName = destination.ToString();
                }
                TreeRoot.StatusText = "Moving to " + destinationName;
            }

            switch (movementBy)
            {
            case MovementByType.FlightorPreferred:
                if (await TryFlightor(destination))
                {
                    return(true);
                }

                if (await TryNavigator(destination, destinationName))
                {
                    return(true);
                }

                if (await TryClickToMove(destination, NavType.Fly))
                {
                    return(true);
                }
                break;

            case MovementByType.NavigatorPreferred:
                if (await TryNavigator(destination, destinationName))
                {
                    return(true);
                }

                if (await TryClickToMove(destination, NavType.Run))
                {
                    return(true);
                }
                break;

            case MovementByType.NavigatorOnly:
                if (await TryNavigator(destination, destinationName))
                {
                    return(true);
                }
                break;

            case MovementByType.ClickToMoveOnly:
                var navType = activeMover.MovementInfo.CanFly ? NavType.Fly : NavType.Run;
                if (await TryClickToMove(destination, navType))
                {
                    return(true);
                }
                break;

            case MovementByType.None:
                break;

            default:
                QBCLog.MaintenanceError("Unhandled MovementByType of {0}", movementBy);
                break;
            }
            return(false);
        }
Exemplo n.º 36
0
        public override void ReadXml(XmlReader reader)
        {
            uint id;

            uint.TryParse(reader["Amount"], out id);
            Amount = (int)id;
            if (reader.MoveToAttribute("ItemID"))
            {
                ItemID = reader["ItemID"];
            }
            else if (reader.MoveToAttribute("Entry"))
            {
                ItemID = reader["Entry"];
            }
            uint.TryParse(reader["NpcEntry"], out id);
            NpcEntry = id;
            uint.TryParse(reader["GuildTab"], out id);
            GuildTab = id;
            bool boolVal = false;

            if (reader.MoveToAttribute("UseCategory"))
            {
                bool.TryParse(reader["UseCategory"], out boolVal);
                UseCategory = boolVal;
            }
            if (reader.MoveToAttribute("Category"))
            {
                Category = (WoWItemClass)Enum.Parse(typeof(WoWItemClass), reader["Category"]);
            }
            string subCatType = "";

            if (reader.MoveToAttribute("SubCategoryType"))
            {
                subCatType = reader["SubCategoryType"];
            }
            if (reader.MoveToAttribute("SubCategory") && !string.IsNullOrEmpty(subCatType))
            {
                Type t;
                if (subCatType != "SubCategoryType")
                {
                    string typeName = string.Format("Styx.{0}", subCatType);
                    t = Assembly.GetEntryAssembly().GetType(typeName);
                }
                else
                {
                    t = typeof(SubCategoryType);
                }
                object subVal = Activator.CreateInstance(t);
                subVal      = Enum.Parse(t, reader["SubCategory"]);
                SubCategory = subVal;
            }

            bool autoFind;

            bool.TryParse(reader["AutoFindBank"], out autoFind);
            AutoFindBank = autoFind;
            Bank         = (BankType)Enum.Parse(typeof(BankType), reader["Bank"]);
            float x, y, z;

            x   = reader["X"].ToSingle();
            y   = reader["Y"].ToSingle();
            z   = reader["Z"].ToSingle();
            loc = new WoWPoint(x, y, z);
            Properties["Location"].Value = loc.ToInvariantString();
            reader.ReadStartElement();
        }
Exemplo n.º 37
0
        protected override RunStatus Run(object context)
        {
            if (!IsDone)
            {
                WoWPoint movetoPoint = _loc;
                if (MailFrame.Instance == null || !MailFrame.Instance.IsVisible)
                {
                    if (AutoFindMailBox || movetoPoint == WoWPoint.Zero)
                    {
                        _mailbox =
                            ObjectManager.GetObjectsOfType <WoWGameObject>().Where(
                                o => o.SubType == WoWGameObjectType.Mailbox)
                            .OrderBy(o => o.Distance).FirstOrDefault();
                    }
                    else
                    {
                        _mailbox =
                            ObjectManager.GetObjectsOfType <WoWGameObject>().Where(
                                o => o.SubType == WoWGameObjectType.Mailbox &&
                                o.Location.Distance(_loc) < 10)
                            .OrderBy(o => o.Distance).FirstOrDefault();
                    }
                    if (_mailbox != null)
                    {
                        movetoPoint = WoWMathHelper.CalculatePointFrom(Me.Location, _mailbox.Location, 3);
                    }

                    if (movetoPoint == WoWPoint.Zero)
                    {
                        Professionbuddy.Err(Pb.Strings["Error_UnableToFindMailbox"]);
                        return(RunStatus.Failure);
                    }

                    if (movetoPoint.Distance(ObjectManager.Me.Location) > 4.5)
                    {
                        Util.MoveTo(movetoPoint);
                    }
                    else if (_mailbox != null)
                    {
                        _mailbox.Interact();
                    }
                    return(RunStatus.Success);
                }
                // Mail Frame is open..
                // item split in proceess
                if (_itemSplitSW.IsRunning && _itemSplitSW.ElapsedMilliseconds <= 2000)
                {
                    return(RunStatus.Success);
                }
                if (_itemList == null)
                {
                    _itemList = BuildItemList();
                }
                if (_itemList.Count == 0)
                {
                    //Professionbuddy.Debug("Sending any remaining items already in SendMail item slots. Mail subject will be: {0} ",_mailSubject);
                    Lua.DoString(
                        "for i=1,ATTACHMENTS_MAX_SEND do if GetSendMailItem(i) ~= nil then SendMail (\"{0}\",\"{1}\",'') end end ",
                        CharacterSettings.Instance.MailRecipient.ToFormatedUTF8(),
                        _mailSubject != null ? _mailSubject.ToFormatedUTF8() : " ");
                    //Professionbuddy.Debug("Done sending mail");
                    IsDone = true;
                    return(RunStatus.Failure);
                }

                MailFrame.Instance.SwitchToSendMailTab();
                uint    itemID = _itemList.Keys.FirstOrDefault();
                WoWItem item   = Me.BagItems.FirstOrDefault(i => i.Entry == itemID);
                _mailSubject = item != null ? item.Name : " ";
                if (string.IsNullOrEmpty(_mailSubject))
                {
                    _mailSubject = " ";
                }
                Professionbuddy.Debug("MailItem: sending {0}", itemID);
                int ret = MailItem(itemID, _itemList[itemID]);
                // we need to wait for item split to finish if ret == 0
                // format indexs are MailRecipient=0, Mail subject=1
                string mailToLua = string.Format(MailItemsFormat,
                                                 CharacterSettings.Instance.MailRecipient.ToFormatedUTF8(),
                                                 _mailSubject.ToFormatedUTF8());
                var mailItemsRet = Lua.GetReturnVal <int>(mailToLua, 0);
                if (ret == 0 || mailItemsRet == 1)
                {
                    _itemSplitSW.Reset();
                    _itemSplitSW.Start();
                    return(RunStatus.Success);
                }
                _itemList[itemID] = ret < 0 ? 0 : _itemList[itemID] - ret;

                bool done = _itemList[itemID] <= 0;
                if (done)
                {
                    _itemList.Remove(itemID);
                }
                if (IsDone)
                {
                    Professionbuddy.Log("Done sending {0} via mail",
                                        UseCategory
                                            ? string.Format("Items that belong to category {0} and subcategory {1}",
                                                            Category, SubCategory)
                                            : string.Format("Items that match Id of {0}", ItemID));
                }
                else
                {
                    return(RunStatus.Success);
                }
            }
            return(RunStatus.Failure);
        }
Exemplo n.º 38
0
        /// <summary>
        /// check if type of totem (ie Air Totem) exists in range
        /// </summary>
        /// <param name="pt"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static bool ExistInRange(WoWPoint pt, WoWTotemType type)
        {
            WoWTotemInfo ti = GetTotem(type);

            return(Exist(ti) && ti.Unit != null && ti.Unit.Location.Distance(pt) < GetTotemRange(ti.WoWTotem));
        }
Exemplo n.º 39
0
        public static WoWPoint SavePoint50832 = new WoWPoint(1749.258, 3209.693, 316.2377);  // The Yowler
        #endregion

        /// <summary>
        /// Function to Find and Kill Mobs
        /// </summary>
        public void findAndKillMob()
        {
            bool CastSuccess = false;

            #region create List of Mobs in Reach
            // ----------------- Generate a List with all wanted Rares found in Object Manager ---------------------
            ObjectManager.Update();
            List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>()
                                     .Where(o => (!Blacklist.Contains(o.Guid, Rarekiller.Settings.Flags) && (
                                                      (Rarekiller.Settings.CATA && (Rarekiller.CataRaresList.ContainsKey(Convert.ToInt32(o.Entry)))) ||
                                                      (Rarekiller.Settings.Poseidus && ((o.Entry == 50005) || // Poseidus
                                                                                        (o.Entry == 9999999))) || // Platzhalter
                                                      (Rarekiller.Settings.TLPD && ((o.Entry == 32491) ||         // Timelost Protodrake
                                                                                    (o.Entry == 32630))) ||       // Vyragosa
                                                      (Rarekiller.Settings.WOTLK && (Rarekiller.FrostbittenList.ContainsKey(Convert.ToInt32(o.Entry)))) ||
                                                      (Rarekiller.Settings.BC && (Rarekiller.BloodyRareList.ContainsKey(Convert.ToInt32(o.Entry)))) ||
                                                      (Rarekiller.Settings.KillList && (Rarekiller.KillMobsList.ContainsKey(Convert.ToInt32(o.Entry)))) || //Kill Mobs from List
                                                      (Rarekiller.Settings.KillList && o.TaggedByOther && (Rarekiller.TaggedMobsList.ContainsKey(Convert.ToInt32(o.Entry)))) || //Kill Tagged Mobs from List
                                                      ((o.Level < Rarekiller.Settings.Level) && Rarekiller.Settings.LowRAR && (o.CreatureRank == Styx.WoWUnitClassificationType.Rare)) || // every single Rare Mob < Level 61 is hunted
                                                      (Rarekiller.Settings.HUNTbyID && (o.Entry == Convert.ToInt64(Rarekiller.Settings.MobID))) // Hunt special IDs
                                                      // Pandaria Rares
                                                      || (Rarekiller.Settings.MOP && (
                                                              (o.Entry == 50828 && Rarekiller.Settings.Bonobos50828) || //
                                                              (o.Entry == 50836 && Rarekiller.Settings.IkIk50836) || //
                                                              (o.Entry == 50840 && Rarekiller.Settings.Nanners50840) || //
                                                              (o.Entry == 50823 && Rarekiller.Settings.Ferocious50823) || //
                                                              (o.Entry == 50831 && Rarekiller.Settings.Scritch50831) || //
                                                              (o.Entry == 50830 && Rarekiller.Settings.Spriggin50830) || //
                                                              (o.Entry == 50832 && Rarekiller.Settings.Yowler50832) || //
                                                              (o.Entry == 50750 && Rarekiller.Settings.Aethis50750) || //
                                                              (o.Entry == 50768 && Rarekiller.Settings.Cournith50768) || //
                                                              (o.Entry == 50772 && Rarekiller.Settings.Eshelon50772) || //
                                                              (o.Entry == 50766 && Rarekiller.Settings.Selena50766) || //
                                                              (o.Entry == 50769 && Rarekiller.Settings.Zai50769) || //
                                                              (o.Entry == 50780 && Rarekiller.Settings.Sahn50780) || //
                                                              (o.Entry == 50776 && Rarekiller.Settings.Nalash50776) || //
                                                              (o.Entry == 50739 && Rarekiller.Settings.Garlok50739) || //
                                                              (o.Entry == 50749 && Rarekiller.Settings.Kaltik50749) || //
                                                              (o.Entry == 50734 && Rarekiller.Settings.Lithik50734) || //
                                                              (o.Entry == 50364 && Rarekiller.Settings.Nallak50364) || //
                                                              (o.Entry == 50363 && Rarekiller.Settings.Kraxik50363) || //
                                                              (o.Entry == 50733 && Rarekiller.Settings.Skithik50733) || //
                                                              (o.Entry == 50388 && Rarekiller.Settings.Torik50388) || //
                                                              (o.Entry == 50341 && Rarekiller.Settings.Borginn50341) || //
                                                              (o.Entry == 50349 && Rarekiller.Settings.Kang50349) || //
                                                              (o.Entry == 50340 && Rarekiller.Settings.Gaarn50340) || //
                                                              (o.Entry == 50347 && Rarekiller.Settings.Karr50347) || //
                                                              (o.Entry == 50338 && Rarekiller.Settings.Kornas50338) || //
                                                              (o.Entry == 50344 && Rarekiller.Settings.Norlaxx50344) || //
                                                              (o.Entry == 50339 && Rarekiller.Settings.Sulikshor50339) || //
                                                              (o.Entry == 50354 && Rarekiller.Settings.Havak50354) || //
                                                              (o.Entry == 50351 && Rarekiller.Settings.JonnDar50351) || //
                                                              (o.Entry == 50355 && Rarekiller.Settings.Kahtir50355) || //
                                                              (o.Entry == 50356 && Rarekiller.Settings.Krol50356) || //
                                                              (o.Entry == 50350 && Rarekiller.Settings.Morgrinn50350) || //
                                                              (o.Entry == 50352 && Rarekiller.Settings.Qunas50352) || //
                                                              (o.Entry == 50359 && Rarekiller.Settings.Urgolax50359) || //
                                                              (o.Entry == 50821 && Rarekiller.Settings.AiLi50821) || //
                                                              (o.Entry == 50817 && Rarekiller.Settings.Ahone50817) || //
                                                              (o.Entry == 50822 && Rarekiller.Settings.AiRan50822) || //
                                                              (o.Entry == 50816 && Rarekiller.Settings.Ruun50816) || //
                                                              (o.Entry == 50811 && Rarekiller.Settings.Nasra50811) || //
                                                              (o.Entry == 50808 && Rarekiller.Settings.Urobi50808) || //
                                                              (o.Entry == 50820 && Rarekiller.Settings.Yul50820) || //
                                                              (o.Entry == 50787 && Rarekiller.Settings.Arness50787) || //
                                                              (o.Entry == 50806 && Rarekiller.Settings.Moldo50806) || //
                                                              (o.Entry == 50789 && Rarekiller.Settings.Nessos50789) || //
                                                              (o.Entry == 50805 && Rarekiller.Settings.Omnis50805) || //
                                                              (o.Entry == 50783 && Rarekiller.Settings.Salyin50783) || //
                                                              (o.Entry == 50782 && Rarekiller.Settings.Sarnak50782) || //
                                                              (o.Entry == 50791 && Rarekiller.Settings.Siltriss50791) || //
                                                              (o.Entry == 51059 && Rarekiller.Settings.Blackhoof51059) || //
                                                              (o.Entry == 50334 && Rarekiller.Settings.Dak50334) || //
                                                              (o.Entry == 51078 && Rarekiller.Settings.Ferdinand51078) || //
                                                              (o.Entry == 50331 && Rarekiller.Settings.GoKan50331) || //
                                                              (o.Entry == 50332 && Rarekiller.Settings.Korda50332) || //
                                                              (o.Entry == 50333 && Rarekiller.Settings.Lon50333) || //
                                                              (o.Entry == 50336 && Rarekiller.Settings.Yorik50336) //
                                                              ))
                                                      )))
                                     .OrderBy(o => o.Distance).ToList();
            #endregion

            foreach (WoWUnit o in objList)
            {
                if (!o.IsDead && !o.IsPet)
                {
                    #region don't kill if
                    // Don't kill Pandaria Rares with Low Health
                    if ((o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 ||
                         o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 ||
                         o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 ||
                         o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 ||
                         o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 ||
                         o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 ||
                         o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 ||
                         o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 ||
                         o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 ||
                         o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 ||
                         o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 ||
                         o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 ||
                         o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 ||
                         o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336) &&
                        Me.HealthPercent < 80)
                    {
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}, but don't Kill Pandaria Mob with Health < 80%", o.Name, o.Entry);
                        return;
                    }
                    if (Rarekiller.Settings.NotKillTameable && o.IsTameable) // ... I want to tame him :)
                    {
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}, but kill tameable", o.Name, o.Entry);
                        return;
                    }
                    #endregion

                    Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}", o.Name, o.Entry);
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Mob Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z));
                    if (Rarekiller.Settings.LUAoutput)
                    {
                        Lua.DoString("print('NPCScan: Find {0} ID {1}')", o.Name, o.Entry);
                    }

                    #region don't kill if ...
                    if (Rarekiller.Settings.PullCounter >= Rarekiller.Settings.MaxPullCounter)
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but I pulled him now {1} Times", o.Name, Rarekiller.Settings.PullCounter);
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 15 Minutes, MoP Rares will be deactivated");
                        if (Rarekiller.Settings.LUAoutput)
                        {
                            Lua.DoString("print('NPCScan: I pulled now {0} times, blacklist')", Rarekiller.Settings.PullCounter);
                        }
                        Rarekiller.Settings.PullCounter     = 0;
                        Rarekiller.Settings.GuidCurrentPull = 0;
                        Rarekiller.Settings.BlacklistCounter++;
                        Rarekiller.Settings.DeactivateMoPRare(o);
                        return;
                    }
                    // Don't kill Pandaria Rares with Level < 90
                    if ((o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 ||
                         o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 ||
                         o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 ||
                         o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 ||
                         o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 ||
                         o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 ||
                         o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 ||
                         o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 ||
                         o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 ||
                         o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 ||
                         o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 ||
                         o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 ||
                         o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 ||
                         o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336) &&
                        Me.Level < 90)
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but my level is to Low to kill him", o.Name);
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                        if (Rarekiller.Settings.LUAoutput)
                        {
                            Lua.DoString("print('NPCScan: My Level is to low')", o.Name);
                        }
                        return;
                    }

                    if (o.TaggedByOther && !Rarekiller.TaggedMobsList.ContainsKey(Convert.ToInt32(o.Entry)))
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but he's tagged by another Player", o.Name);
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                        if (Rarekiller.Settings.LUAoutput)
                        {
                            Lua.DoString("print('NPCScan: NPC is tagged')", o.Name);
                        }
                        return;
                    }
                    //if not known ID of Inhouse Pandaria Rare --> don't kill
                    if (!(o.Entry == 50817 || o.Entry == 50768 ||
                          o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 ||
                          o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50769))
                    {
                        if (Me.IsFlying && Me.IsOutdoors && o.IsIndoors)
                        {
                            Logging.Write(Colors.MediumPurple, "Rarekiller: Mob is Indoors and I fly Outdoors, so blacklist him to prevent Problems");
                            Logging.Write(Colors.MediumPurple, "Rarekiller: You have to place me next to the Spawnpoint, if you want me to hunt this Mob.");
                            Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                            Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                            if (Rarekiller.Settings.LUAoutput)
                            {
                                Lua.DoString("print('NPCScan: NPC is Indoors')", o.Name);
                            }
                            return;
                        }
                    }
                    if (o.Level > (Me.Level + 4))                     // ... 4 Levels higher them me
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: His Level is 5 over mine, better not to kill him.");
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes.");
                        return;
                    }
                    if (o.IsFriendly)                     // ... is Friendly
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but he's friendly", o.Name);
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes.");
                        if (Rarekiller.Settings.LUAoutput)
                        {
                            Lua.DoString("print('NPCScan: NPC is friendly')", o.Name);
                        }
                        return;
                    }
                    if ((o.Entry == 32630) && !Rarekiller.Settings.Vyragosa)                     // ... my Settings say don't kill Vyragosa
                    {
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Config says: don't kill Vyragosa.");
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                        if (Rarekiller.Settings.LUAoutput)
                        {
                            Lua.DoString("print('NPCScan: don't kill NPC')", o.Name);
                        }
                        return;
                    }
                    if ((o.Entry == 50057) && !Rarekiller.Settings.Blazewing)                     // ... my Settings say don't kill Blazewing
                    {
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Config says: don't kill Blazewing.");
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                        if (Rarekiller.Settings.LUAoutput)
                        {
                            Lua.DoString("print('NPCScan: don't kill NPC')", o.Name);
                        }
                        return;
                    }
                    if ((o.Entry == 596) || (o.Entry == 599) || Me.IsInInstance)
                    {
                        // ... Instance Mobs, don't run wild in Instances
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Don't run wild because of RareMobs in Instances.");
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes.");
                        return;
                    }
                    if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(o.Entry)))
                    // ... Mob is Blacklisted in Rarekiller/config/BlacklistedMobs.xml
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: {0} is Member of the BlacklistedMobs.xml", o.Name);
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 15 Minutes.");
                        return;
                    }
                    if (Rarekiller.DontInteract)
                    {
                        return;
                    }
                    #endregion

                    if (Rarekiller.Settings.Alert)
                    {
                        Rarekiller.Alert();
                    }

                    #region fly to Helperpoint for some Pandaria Rares
                    if (Me.IsFlying && (o.Entry == 50817 || o.Entry == 50768 ||
                                        o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 ||
                                        o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50769 ||
                                        o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347 || o.Entry == 50811 ||
                                        o.Entry == 50821 || o.Entry == 50808 || o.Entry == 50820))
                    {
                        WoWPoint Helperpoint = o.Location;
                        if (o.Entry == 50817)
                        {
                            Helperpoint = LandingPoint50817;
                        }
                        if (o.Entry == 50768)
                        {
                            Helperpoint = LandingPoint50768;
                        }
                        if (o.Entry == 50836)
                        {
                            Helperpoint = LandingPoint50836;
                        }
                        if (o.Entry == 50782)
                        {
                            Helperpoint = LandingPoint50782;
                        }
                        if (o.Entry == 50831)
                        {
                            Helperpoint = LandingPoint50831;
                        }
                        if (o.Entry == 50832)
                        {
                            Helperpoint = LandingPoint50832;
                        }
                        if (o.Entry == 50769)
                        {
                            Helperpoint = LandingPoint50769;
                        }
                        if (o.Entry == 50822)
                        {
                            Helperpoint = LandingPoint50822;
                        }
                        if (o.Entry == 50331)
                        {
                            Helperpoint = LandingPoint50331;
                        }
                        if (o.Entry == 51078)
                        {
                            Helperpoint = LandingPoint51078;
                        }
                        if (o.Entry == 50749)
                        {
                            Helperpoint = LandingPoint50749;
                        }
                        if (o.Entry == 50334)
                        {
                            Helperpoint = LandingPoint50334;
                        }
                        if (o.Entry == 50347)
                        {
                            Helperpoint = LandingPoint50347;
                        }
                        if (o.Entry == 50811)
                        {
                            Helperpoint = LandingPoint50811;
                        }
                        if (o.Entry == 50821)
                        {
                            Helperpoint = LandingPoint50821;
                        }
                        if (o.Entry == 50808)
                        {
                            Helperpoint = LandingPoint50808;
                        }
                        if (o.Entry == 50820)
                        {
                            Helperpoint = LandingPoint50820;
                        }

                        if (!Rarekiller.MoveTo(Helperpoint, o, 5, false))
                        {
                            return;
                        }
                        Rarekiller.Dismount();
                    }
                    #endregion

                    #region Check PullRange
                    if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell) && (
                            o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 ||
                            o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50768 ||
                            o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347 || o.Entry == 50811 ||
                            o.Entry == 50821 || o.Entry == 50808 || o.Entry == 50820))
                    {
                        Rarekiller.Settings.Range = "27";
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to 27 because of Inhouse Pandaria Rare");
                    }
                    else if (o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 ||
                             o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 ||
                             o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 ||
                             o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 ||
                             o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 ||
                             o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 ||
                             o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 ||
                             o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 ||
                             o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 ||
                             o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 ||
                             o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 ||
                             o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 ||
                             o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 ||
                             o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336)
                    {
                        Rarekiller.Settings.Range = "3";
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to 3 because of other Pandaria Rares");
                    }

                    else if (!Rarekiller.Settings.DefaultPull && (Convert.ToInt64(Rarekiller.Settings.Range) > Convert.ToInt64(Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull))))
                    {
                        Rarekiller.Settings.Range = Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull);
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to {0} because of Low-Ranged Customized Spell", Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull));
                    }

                    else if (Rarekiller.Settings.DefaultPull && (Convert.ToInt64(Rarekiller.Settings.Range) > Convert.ToInt64(Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell))))
                    {
                        Rarekiller.Settings.Range = Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell);
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to {0} because of Low-Ranged Default Spell", Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell));
                    }
                    #endregion

                    #region Move To Mob
                    if (o.Entry == 50817 || o.Entry == 50768 ||
                        o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 ||
                        o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50769 ||
                        o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347 || o.Entry == 50811 ||
                        o.Entry == 50821 || o.Entry == 50808 || o.Entry == 50820)
                    {
                        if (!Rarekiller.MoveTo(o, Convert.ToInt64(Rarekiller.Settings.Range), true))
                        {
                            return;
                        }
                    }
                    else
                    {
                        if (!Rarekiller.MoveTo(o, Convert.ToInt64(Rarekiller.Settings.Range), false))
                        {
                            return;
                        }
                    }
                    #endregion

                    #region Special Behavior Nal'lak
                    //if (Me.Combat && o.Entry == 50364) //Nal'lak
                    //{
                    //    WoWMovement.MoveStop();
                    //    Thread.Sleep(100);
                    //    if (Me.IsFlying)
                    //    {
                    //        WoWUnit GroundUnit = ObjectManager.GetObjectsOfType<WoWUnit>().Where(u => (!u.IsFlying)).OrderBy(u => u.Distance).FirstOrDefault(); ;
                    //        if (!Rarekiller.DescendToLand(GroundUnit)) return;
                    //    }
                    //    Rarekiller.Dismount();
                    //}
                    #endregion

                    #region Special Behavior Clean up Area
                    if (o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347)
                    {
                        ObjectManager.Update();
                        List <WoWUnit> AddList = ObjectManager.GetObjectsOfType <WoWUnit>().Where(Add => !Add.IsDead && Add.IsHostile && (Add != o) && Add.Location.Distance(o.Location) < 27 && Add.Location.Distance(Me.Location) < 27).OrderBy(Add => Add.Distance).ToList();
                        foreach (WoWUnit Add in AddList)
                        {
                            if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell))
                            {
                                CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.RangedPullspell, Add, true);
                                Logging.Write(Colors.MediumPurple, "Rarekiller: Clean up Area, pull Add: {0}", Add.Name);
                                return;
                            }
                        }
                    }
                    #endregion

                    #region Pull Mob
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Pull at Mob Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z));
                    Logging.Write(Colors.MediumPurple, "Rarekiller: ... my Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Target is Flying - {0}", o.IsFlying);

                    o.Target();
                    if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell) &&
                        (o.Entry == 50817 || o.Entry == 50768 ||
                         o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 ||
                         o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50769 ||
                         o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347 || o.Entry == 50811 ||
                         o.Entry == 50821 || o.Entry == 50808 || o.Entry == 50820))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.RangedPullspell, o, true);
                    }

                    else if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, o, false);
                    }
                    else if (SpellManager.HasSpell(Rarekiller.Spells.FastPullspell))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.FastPullspell, o, false);
                    }
                    else
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: I have no valid Pullspell - sorry");
                    }

                    if (Me.CurrentTarget != o)
                    {
                        o.Target();
                    }
                    #endregion

                    #region Quick Slowfall for known flying Mobs
                    if (Rarekiller.Settings.UseSlowfall && ((o.Entry == 29753) || (o.Entry == 32491) || (o.Entry == 32630) || (o.Entry == 33687) || (o.Entry == 50364)))
                    {
                        Thread.Sleep(500);
                        if (Me.IsFalling)
                        {
                            Rarekiller.Slowfall.HelpFalling();
                        }
                    }
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Use Quick Slowfall: {0} Mob: {1}", Me.IsFalling, o.Name);
                    #endregion

                    #region Pulltimer and Pullcounter
                    WaitAfterPullTimer.Reset();
                    WaitAfterPullTimer.Start();
                    while (WaitAfterPullTimer.IsRunning && !Rarekiller.ToonInvalidCombat && WaitAfterPullTimer.ElapsedMilliseconds < 2000)
                    {
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Wait for Combat now {0} ms", WaitAfterPullTimer.ElapsedMilliseconds);
                        Thread.Sleep(100);
                    }

                    if (CastSuccess && Me.Combat)
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Successfully pulled {0}", o.Name);
                    }

                    if (o.Entry != 32491 && o.Entry != 50005 && (Rarekiller.Settings.GuidCurrentPull != o.Guid) && Me.Combat)
                    {
                        Rarekiller.Settings.PullCounter     = 1;
                        Rarekiller.Settings.GuidCurrentPull = o.Guid;
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Pulled {0} now first time", o.Name);
                    }
                    else if (Me.Combat)
                    {
                        Rarekiller.Settings.PullCounter++;
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Pulled {0} now {1} times", o.Name, Rarekiller.Settings.PullCounter);

                        if ((o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 ||
                             o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 ||
                             o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 ||
                             o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 ||
                             o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 ||
                             o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 ||
                             o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 ||
                             o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 ||
                             o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 ||
                             o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 ||
                             o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 ||
                             o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 ||
                             o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 ||
                             o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336) &&
                            Me.Level < 90)
                        {
                            RoutineManager.Current.Combat();
                        }
                    }
                    #endregion

                    #region Move to a Save Fighting Area after Pull for some Pandaria Rares
                    if ((o.Entry == 50768 || o.Entry == 50832) && Me.Combat)
                    {
                        WoWPoint SaveHelperpoint = o.Location;
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Save Fighting Point", o.Entry);

                        if (o.Entry == 50768)
                        {
                            SaveHelperpoint = SavePoint50768;
                        }

                        if (o.Entry == 50832)
                        {
                            SaveHelperpoint = SavePoint50832;
                        }

                        if (Navigator.CanNavigateFully(Me.Location, SaveHelperpoint))
                        {
                            Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Save Fighting Point");
                            while (Me.Location.Distance(SaveHelperpoint) > 5)
                            {
                                if (Me.IsSwimming)
                                {
                                    WoWMovement.ClickToMove(SaveHelperpoint);
                                }
                                else
                                {
                                    Navigator.MoveTo(SaveHelperpoint);
                                }
                                Thread.Sleep(100);
                                if (Rarekiller.ToonInvalid)
                                {
                                    return;
                                }
                            }
                        }
                        else
                        {
                            Logging.Write(Colors.MediumPurple, "Rarekiller: Wasn't able to Move to Save Fighting Point", o.Entry);
                        }
                    }
                    #endregion

                    return;
                }
                else if (o.IsDead)
                {
                    if (o.Guid == Rarekiller.Settings.GuidCurrentPull)
                    {
                        Rarekiller.Settings.PullCounter     = 0;
                        Rarekiller.Settings.GuidCurrentPull = 0;
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Set PullCounter to {0}", Rarekiller.Settings.PullCounter);
                    }

                    if (o.CanLoot)
                    {
                        if (!Rarekiller.Loothelper(o))
                        {
                            return;
                        }
                    }

                    if (!Blacklist.Contains(o.Guid, Rarekiller.Settings.Flags))
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but sadly he's dead", o.Name);
                        Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes.");
                    }
                }
            }
        }
Exemplo n.º 40
0
        private async Task <bool> ScareSpiders()
        {
            // if not in a turret than move to one and interact with it
            if (!Query.IsInVehicle())
            {
                var mustang = GetMustang();
                if (mustang == null)
                {
                    QBCLog.Warning("No mustang was found nearby");
                    return(false);
                }

                TreeRoot.StatusText = "Moving To Mustang";
                if (mustang.DistanceSqr > 5 * 5)
                {
                    return((await CommonCoroutines.MoveTo(mustang.Location)).IsSuccessful());
                }

                await CommonCoroutines.LandAndDismount();

                QBCLog.Info("Interacting with Mustang");
                mustang.Interact();
                return(true);
            }

            // Find the nearest spider and if none exist then move to the spawn location
            if (!Query.IsViable(_currentTarget) || !_currentTarget.IsAlive)
            {
                _currentTarget = ObjectManager.GetObjectsOfType <WoWUnit>()
                                 .Where(u => u.IsAlive && u.Entry == 44284 && !Blacklist.Contains(u, BlacklistFlags.Interact))
                                 .OrderBy(u => u.DistanceSqr).FirstOrDefault();

                if (_currentTarget == null)
                {
                    if (!Navigator.AtLocation(_spiderSpawnLocation))
                    {
                        return((await CommonCoroutines.MoveTo(_spiderSpawnLocation)).IsSuccessful());
                    }
                    TreeRoot.StatusText = "Waiting for spiders to spawn";
                    return(true);
                }
                _noMoveBlacklistTimer.Reset();
                _blacklistTimer.Reset();
                QBCLog.Info("Locked on a new target. Distance {0}", _currentTarget.Distance);
            }

            TreeRoot.StatusText = "Scaring spider towards lumber mill";

            var moveToPoint = WoWMathHelper.CalculatePointFrom(_lumberMillLocation, _currentTarget.Location, -6);

            if (moveToPoint.DistanceSqr((WoWMovement.ActiveMover ?? StyxWoW.Me).Location) > 4 * 4)
            {
                return((await CommonCoroutines.MoveTo(moveToPoint)).IsSuccessful());
            }

            // spider not moving? blacklist and find a new target.
            if (_noMoveBlacklistTimer.ElapsedMilliseconds > 20000 && _currentTarget.Location.DistanceSqr(_spiderScareLoc) < 10 * 10)
            {
                Blacklist.Add(_currentTarget, BlacklistFlags.Interact, TimeSpan.FromMinutes(3), "Spider is not moving");
                _currentTarget = null;
            }
            else if (_blacklistTimer.IsFinished)
            {
                Blacklist.Add(_currentTarget, BlacklistFlags.Interact, TimeSpan.FromMinutes(3), "Took too long");
                _currentTarget = null;
            }
            else if (!_currentTarget.HasAura("Fear"))
            {
                await CommonCoroutines.StopMoving();

                Me.SetFacing(_lumberMillLocation);
                await CommonCoroutines.SleepForLagDuration();

                await Coroutine.Sleep(200);

                if (!_noMoveBlacklistTimer.IsRunning || _currentTarget.Location.DistanceSqr(_spiderScareLoc) >= 10 * 10)
                {
                    _noMoveBlacklistTimer.Restart();
                    _spiderScareLoc = _currentTarget.Location;
                }
                Lua.DoString("CastSpellByID(83605)");
                await Coroutine.Wait(3000, () => Query.IsViable(_currentTarget) && _currentTarget.HasAura("Fear"));
            }

            return(true);
        }
Exemplo n.º 41
0
 public static void InRangeOfLocation(WoWPoint pt, double range, SimpleBooleanDelegate and = null)
 {
     Set(StopType.RangeOfLocation, null, pt, range, at => StyxWoW.Me.Location.Distance(pt) <= range, and);
 }
Exemplo n.º 42
0
 /// <summary>
 /// This is a fix for WoWPoint.ToString using current cultures decimal separator.
 /// </summary>
 /// <param name="text"></param>
 /// <returns></returns>
 public static string ToInvariantString(this WoWPoint text)
 {
     return(string.Format(CultureInfo.InvariantCulture, "{0},{1},{2}", text.X, text.Y, text.Z));
 }
Exemplo n.º 43
0
        public void findAndTameMob()
        {
            if (Rarekiller.Settings.DeveloperLogs)
            {
                Logging.WriteDebug("Rarekiller: Scan for Tamer");
            }
            ObjectManager.Update();
            List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>()
                                     .Where(o => (
                                                ((Rarekiller.Settings.TameDefault && Rarekiller.TameableMobsList.ContainsKey(Convert.ToInt32(o.Entry))) ||
                                                 (Rarekiller.Settings.TameByID && (o.Entry == Convert.ToInt64(Rarekiller.Settings.TameMobID)))) &&
                                                !o.IsPet && o.IsTameable))
                                     .OrderBy(o => o.Distance).ToList();

            foreach (WoWUnit o in objList)
            {
                if (!o.Dead && !Blacklist.Contains(o.Guid))
                {
                    Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller Part Tamer: Found a new Pet {0} ID {1}", o.Name, o.Entry);
                    if (Rarekiller.inCombat)
                    {
                        Logging.Write("Rarekiller Part Tamer: ... but I'm in another Combat :( !!!");
                        return;
                    }
                    if (Me.Level < o.Level)
                    {
                        Logging.Write("Rarekiller Part Tamer: Mob Level is higher then mine, can't tame the Mob.");
                        Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 60 Minutes.");
                        return;
                    }
                    if (Me.IsOnTransport)
                    {
                        Logging.Write("Rarekiller Part Tamer: ... but I'm on a Transport.");
                        return;
                    }
                    while (Me.IsCasting)
                    {
                        Thread.Sleep(100);
                    }
                    if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(o.Entry)))
                    {
                        Logging.Write("Rarekiller Part Tamer: {0} is Member of the BlacklistedMobs.xml", o.Name);
                        Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15));
                        Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 15 Minutes.");
                        return;
                    }

                    //Dismiss Pet
                    SpellManager.Cast("Dismiss Pet");
                    Thread.Sleep(3000);

                    if (Rarekiller.Settings.Alert)
                    {
                        if (File.Exists(Rarekiller.Settings.SoundfileFoundRare))
                        {
                            new SoundPlayer(Rarekiller.Settings.SoundfileFoundRare).Play();
                        }
                        else if (File.Exists(Rarekiller.Soundfile))
                        {
                            new SoundPlayer(Rarekiller.Soundfile).Play();
                        }
                        else
                        {
                            Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Tamer: playing Soundfile failes");
                        }
                    }

                    WoWPoint newPoint = WoWMovement.CalculatePointFrom(o.Location, (float)Rarekiller.Settings.Tamedistance);

                    if (o.Entry == 49822)
                    {
                        ForceGround = true;
                    }

                    Logging.Write("Rarekiller Part MoveTo: Move to target");
                    BlacklistTimer.Reset();
                    BlacklistTimer.Start();
                    Place = Me.ZoneId;
                    while (newPoint.Distance(Me.Location) > Rarekiller.Settings.Tamedistance)
                    {
                        if (Rarekiller.Settings.GroundMountMode || ForceGround)
                        {
                            Navigator.MoveTo(newPoint);
                        }
                        else
                        {
                            Flightor.MoveTo(newPoint);
                        }
                        Thread.Sleep(100);
                        if (Rarekiller.inCombat)
                        {
                            return;
                        }
                        if (Rarekiller.Settings.BlacklistCheck && (BlacklistTimer.Elapsed.TotalSeconds > (Convert.ToInt32(Rarekiller.Settings.BlacklistTime))))
                        {
                            Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Tamer: Can't reach Mob {0}, Blacklist and Move on", o.Name);
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                            BlacklistTimer.Reset();
                            WoWMovement.MoveStop();
                            return;
                        }
                        if (Rarekiller.Settings.ZoneSave && (Me.ZoneId != Place))
                        {
                            Logging.Write(System.Drawing.Color.Red, "Rarekiller Part MoveTo: Left Zone while move to {0} is not allowed", o.Name);
                            Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                            Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes.");
                            BlacklistTimer.Reset();
                            WoWMovement.MoveStop();
                            return;
                        }
                    }
                    BlacklistTimer.Reset();
                    Thread.Sleep(300);
                    WoWMovement.MoveStop();

                    if (Me.Auras.ContainsKey("Flight Form"))
                    {
                        Lua.DoString("CancelShapeshiftForm()");
                    }
                    else if (Me.Mounted)
                    {
                        Lua.DoString("Dismount()");
                    }

                    Thread.Sleep(150);
                    o.Target();
                    if (Rarekiller.Settings.ScreenTamer && Rarekiller.Settings.ScreenFound)
                    {
                        Lua.DoString("TakeScreenshot()");
                        Thread.Sleep(300);
                        Logging.WriteDebug("Rarekiller Part Tamer: Take Screenshot before tame");
                    }
                    while (!o.IsPet)
                    {
                        if (o.Dead)
                        {
                            Logging.Write("Rarekiller Part Tamer: Mob was dying, I'm so Sorry !!! ");
                            return;
                        }
                        if (Me.HealthPercent < 10)
                        {
                            Logging.Write("Rarekiller Part Tamer: Health < 10% , Use Feign Death !!! ");
                            SpellManager.Cast("Feign Death");
                            return;
                        }

                        if (!Me.IsCasting)
                        {
                            WoWMovement.MoveStop();
                            SpellManager.Cast("Tame Beast");
                            Logging.Write("Plugin Part The Tamer: Try to tame Beast {0}", o.Name);
                            Thread.Sleep(1500);
                        }
                    }
                    Logging.Write("Rarekiller Part Tamer: Sucessfully tamed Beast {0}", o.Name);
                    if (Rarekiller.Settings.ScreenTamer && Rarekiller.Settings.ScreenSuccess)
                    {
                        Lua.DoString("TakeScreenshot()");
                        Thread.Sleep(500);
                        Logging.WriteDebug("Rarekiller Part Tamer: Take Screenshot after tame");
                    }
                }
                else if (o.IsPet)
                {
                    return;
                }
                else
                {
                    Logging.Write("Rarekiller Part Tamer: Find a Mob, but sadly he's dead, blacklistet or not tameable: {0}", o.Name);
                    Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                    Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 5 Minutes.");
                    return;
                }
            }
        }
        protected override RunStatus Run(object context)
        {
            if (!IsDone)
            {
                if (!TimeoutSW.IsRunning)
                {
                    TimeoutSW.Start();
                }
                if (TimeoutSW.ElapsedMilliseconds > 300000)
                {
                    IsDone = true;
                }
                WoWPoint movetoPoint = loc;
                if (MailFrame.Instance == null || !MailFrame.Instance.IsVisible)
                {
                    if (AutoFindMailBox || movetoPoint == WoWPoint.Zero)
                    {
                        mailbox = ObjectManager.GetObjectsOfType <WoWGameObject>().Where(o => o.SubType == WoWGameObjectType.Mailbox)
                                  .OrderBy(o => o.Distance).FirstOrDefault();
                    }
                    else
                    {
                        mailbox = ObjectManager.GetObjectsOfType <WoWGameObject>().Where(o => o.SubType == WoWGameObjectType.Mailbox &&
                                                                                         o.Location.Distance(loc) < 10)
                                  .OrderBy(o => o.Distance).FirstOrDefault();
                    }
                    if (mailbox != null)
                    {
                        movetoPoint = WoWMathHelper.CalculatePointFrom(me.Location, mailbox.Location, 3);
                    }
                    if (movetoPoint == WoWPoint.Zero)
                    {
                        return(RunStatus.Failure);
                    }
                    if (movetoPoint.Distance(ObjectManager.Me.Location) > 4.5)
                    {
                        Util.MoveTo(movetoPoint);
                    }
                    else if (mailbox != null)
                    {
                        mailbox.Interact();
                    }
                    return(RunStatus.Running);
                }
                else
                {
                    if (_idList == null)
                    {
                        _idList = BuildItemList();
                    }
                    if (!_refreshInboxSW.IsRunning)
                    {
                        _refreshInboxSW.Start();
                    }
                    if (!WaitForContentToShowSW.IsRunning)
                    {
                        WaitForContentToShowSW.Start();
                    }
                    if (WaitForContentToShowSW.ElapsedMilliseconds < 3000)
                    {
                        return(RunStatus.Running);
                    }
                    uint freeslots = ObjectManager.Me.FreeNormalBagSlots;

                    if (!ConcludingSW.IsRunning)
                    {
                        if (_refreshInboxSW.ElapsedMilliseconds < 61000)
                        {
                            if (GetMailType == GetMailActionType.AllItems)
                            {
                                string lua = string.Format("local totalItems,numItems = GetInboxNumItems() local foundMail=0 for index=1,numItems do local _,_,sender,subj,gold,cod,_,itemCnt,_,_,hasText=GetInboxHeaderInfo(index) if sender ~= nil and cod == 0 and itemCnt == nil and gold == 0 and hasText == nil then DeleteInboxItem(index) end if cod == 0 and ((itemCnt and itemCnt >0) or (gold and gold > 0)) then AutoLootMailItem(index) foundMail = foundMail + 1 break end end local beans = BeanCounterMail and BeanCounterMail:IsVisible() if foundMail == 0 {0}and totalItems == numItems and beans ~= 1 then return 1 else return 0 end ",
                                                           CheckNewMail ? "and HasNewMail() == nil " : "");
                                //freeslots / 2 >= MinFreeBagSlots ? (freeslots - MinFreeBagSlots) / 2 : 1);
                                if (Lua.GetReturnValues(lua)[0] == "1" || ObjectManager.Me.FreeNormalBagSlots <= MinFreeBagSlots)
                                {
                                    ConcludingSW.Start();
                                }
                            }
                            else
                            {
                                for (int i = 0; i < _idList.Count; i++)
                                {
                                    string lua = string.Format("local totalItems,numItems = GetInboxNumItems() local foundMail=0 for index=1,numItems do local _,_,sender,subj,gold,cod,_,itemCnt,_,_,hasText=GetInboxHeaderInfo(index) if sender ~= nil and cod == 0 and itemCnt == nil and gold == 0 and hasText == nil then DeleteInboxItem(index) end if cod == 0 and itemCnt and itemCnt >0  then for i2=1, ATTACHMENTS_MAX_RECEIVE do local itemlink = GetInboxItemLink(index, i2) if itemlink ~= nil and string.find(itemlink,'{0}') then foundMail = foundMail + 1 TakeInboxItem(index, i2) break end end end end if (foundMail == 0 {1})  or (foundMail == 0 and (numItems == 50 and totalItems >= 50)) then return 1 else return 0 end ",
                                                               //, Entry, freeslots / 2 >= MinFreeBagSlots ? (freeslots - MinFreeBagSlots) / 2 : 1);
                                                               _idList[i], CheckNewMail ? "and HasNewMail() == nil " : "");

                                    if (Lua.GetReturnValues(lua)[0] == "1" || ObjectManager.Me.FreeNormalBagSlots <= MinFreeBagSlots)
                                    {
                                        _idList.RemoveAt(i);
                                    }
                                }
                                if (_idList.Count == 0)
                                {
                                    ConcludingSW.Start();
                                }
                            }
                        }
                        else
                        {
                            _refreshInboxSW.Reset();
                            MailFrame.Instance.Close();
                        }
                    }
                    if (ConcludingSW.ElapsedMilliseconds > 2000)
                    {
                        IsDone = true;
                    }
                    if (IsDone)
                    {
                        Professionbuddy.Log("Mail retrieval of items:{0} finished", GetMailType);
                    }
                    else
                    {
                        return(RunStatus.Running);
                    }
                }
            }
            return(RunStatus.Failure);
        }
Exemplo n.º 45
0
 public WaypointType(WoWPoint location, string name = "", double radius = 10.0)
 {
     Location = location;
     Name     = name ?? string.Empty;
     Radius   = radius;
 }
Exemplo n.º 46
0
 /// <summary>
 /// check if any of several totems exist in range
 /// </summary>
 /// <param name="pt"></param>
 /// <param name="awt"></param>
 /// <returns></returns>
 public static bool ExistInRange(WoWPoint pt, params WoWTotem[] awt)
 {
     return(awt.Any(t => ExistInRange(pt, t)));
 }
Exemplo n.º 47
0
        public GetItemfromBankAction()
        {
            Properties["Amount"] = new MetaProp("Amount", typeof(DynamicProperty <int>),
                                                new TypeConverterAttribute(
                                                    typeof(DynamicProperty <int> .DynamivExpressionConverter)),
                                                new DisplayNameAttribute(Pb.Strings["Action_Common_Amount"]));

            Properties["ItemID"] = new MetaProp("ItemID", typeof(string),
                                                new DisplayNameAttribute(Pb.Strings["Action_Common_ItemEntries"]));

            Properties["MinFreeBagSlots"] = new MetaProp("MinFreeBagSlots", typeof(uint),
                                                         new DisplayNameAttribute(
                                                             Pb.Strings["Action_Common_MinFreeBagSlots"]));

            Properties["GetItemfromBankType"] = new MetaProp("GetItemfromBankType",
                                                             typeof(BankWithdrawlItemType),
                                                             new DisplayNameAttribute(
                                                                 Pb.Strings["Action_Common_ItemsToWithdraw"]));

            Properties["Bank"] = new MetaProp("Bank", typeof(BankType),
                                              new DisplayNameAttribute(Pb.Strings["Action_Common_Bank"]));

            Properties["AutoFindBank"] = new MetaProp("AutoFindBank", typeof(bool),
                                                      new DisplayNameAttribute(Pb.Strings["Action_Common_AutoFindBank"]));

            Properties["Location"] = new MetaProp("Location", typeof(string),
                                                  new EditorAttribute(typeof(PropertyBag.LocationEditor),
                                                                      typeof(UITypeEditor)),
                                                  new DisplayNameAttribute(Pb.Strings["Action_Common_Location"]));

            Properties["NpcEntry"] = new MetaProp("NpcEntry",
                                                  typeof(uint),
                                                  new EditorAttribute(typeof(PropertyBag.EntryEditor),
                                                                      typeof(UITypeEditor)),
                                                  new DisplayNameAttribute(Pb.Strings["Action_Common_NpcEntry"]));

            Properties["WithdrawAdditively"] = new MetaProp("WithdrawAdditively", typeof(bool),
                                                            new DisplayNameAttribute(
                                                                Pb.Strings["Action_Common_WithdrawAdditively"]));

            Properties["Withdraw"] = new MetaProp("Withdraw", typeof(DepositWithdrawAmount),
                                                  new DisplayNameAttribute(Pb.Strings["Action_Common_Withdraw"]));

            Amount = new DynamicProperty <int>(this, "1");
            RegisterDynamicProperty("Amount");
            ItemID              = "";
            MinFreeBagSlots     = 2u;
            GetItemfromBankType = BankWithdrawlItemType.SpecificItem;
            Bank               = BankType.Personal;
            AutoFindBank       = true;
            _loc               = WoWPoint.Zero;
            Location           = _loc.ToInvariantString();
            NpcEntry           = 0u;
            WithdrawAdditively = true;
            Withdraw           = DepositWithdrawAmount.All;

            Properties["Location"].Show = false;
            Properties["NpcEntry"].Show = false;
            Properties["Amount"].Show   = false;

            Properties["AutoFindBank"].PropertyChanged        += AutoFindBankChanged;
            Properties["GetItemfromBankType"].PropertyChanged += GetItemfromBankActionPropertyChanged;
            Properties["Location"].PropertyChanged            += LocationChanged;
            Properties["Withdraw"].PropertyChanged            += WithdrawChanged;
        }
Exemplo n.º 48
0
        protected override Composite CreateBehavior()
        {
            return(_root ??
                   (_root = new PrioritySelector(
                        new Action(c =>
            {         // looping since HB becomes unresposive for periods of time if I don't, bugged
                while (true)
                {
                    ObjectManager.Update();
                    WoWUnit npc = GetNpc();
                    WoWUnit vehicle = GetVehicle();
                    var quest = Me.QuestLog.GetQuestById((uint)QuestId);
                    WoWPoint waypoint = MoveToLoc;
                    if (_state != State.finshed && _state != State.landing && (quest.IsCompleted || _flightStopwatch.ElapsedMilliseconds >= 780000))
                    {
                        _state = State.finshed;
                        TreeRoot.StatusText = quest.IsCompleted ? "Turning Quest in!" : "Moving to landing spot and resummoning";
                        _pathIndex = 0;
                    }
                    switch (_state)
                    {
                    case State.liftoff:
                        bool inVehicle = InVehicle;

                        if (!_liftoffStopwatch.IsRunning || !inVehicle)
                        {
                            if (ItemId > 0 && !inVehicle && !Me.IsFalling && vehicle == null)
                            {
                                if (!Me.IsCasting)
                                {
                                    Lua.DoString("UseItemByName({0})", ItemId);
                                }
                                return RunStatus.Running;
                            }
                            else if (inVehicle)
                            {
                                _liftoffStopwatch.Reset();
                                _liftoffStopwatch.Start();
                                TreeRoot.StatusText = "Liftoff!";
                                WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
                            }
                        }
                        else if (_liftoffStopwatch.ElapsedMilliseconds > 2000)
                        {
                            TreeRoot.StatusText = "Moving to quest Area";
                            WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend);
                            _state = !quest.IsCompleted ? State.start : State.landing;
                            _flightStopwatch.Reset();
                            _flightStopwatch.Start();
                            _liftoffStopwatch.Stop();
                            _liftoffStopwatch.Reset();
                        }
                        break;

                    case State.start:
                    case State.finshed:
                        if (waypoint == WoWPoint.Zero)
                        {
                            _state = _state == State.start ? State.looping : State.landing;
                            _pathIndex = 0;
                        }
                        else
                        {
                            using (new FrameLock())
                            {
                                Lua.DoString("if GetPetActionCooldown({0}) == 0 then CastPetAction({0}) end ", SpeedButton);
                                WoWMovement.ClickToMove(waypoint);
                            }
                        }
                        break;

                    case State.looping:
                        if (StuckCheck())
                        {
                            break;
                        }
                        if (PickUpPassengerButton == 0)
                        {
                            TreeRoot.StatusText = string.Format("Blowing stuff up. {0} mins before resummon is required", ((780000 - _flightStopwatch.ElapsedMilliseconds) / 1000) / 60);
                            using (new FrameLock())
                            {
                                if ((vehicle.HealthPercent <= HealPercent || vehicle.ManaPercent <= HealPercent) && HealButton > 0 &&
                                    npc != null && npc.Location.Distance2D(vehicle.Location) < 60)
                                {
                                    TreeRoot.StatusText = string.Format("Using heal button {0} on NPC:{1}, {2} Units away",
                                                                        HealButton, npc.Name, vehicle.Location.Distance2D(npc.Location));
                                    Lua.DoString("if GetPetActionCooldown({0}) == 0 then CastPetAction({0}) end ", HealButton);
                                }
                                foreach (int b in Buttons)
                                {
                                    //  Lua.DoString("local a=VehicleAimGetNormAngle() if a < 0.55 then local _,s,_ = GetActionInfo({0}) local c = GetSpellCooldown(s) if c == 0 then CastSpellByID(s) end end", b);
                                    Lua.DoString("local a=VehicleAimGetNormAngle() if a < 0.55 then if GetPetActionCooldown({0}) == 0 then CastPetAction({0}) end  end", b);
                                }
                                Lua.DoString("if GetPetActionCooldown({0}) == 0 then CastPetAction({0}) end ", SpeedButton);
                                WoWMovement.ClickToMove(waypoint);
                            }
                        }
                        else
                        {
                            TreeRoot.StatusText = string.Format("Rescuing NPCs ");
                            if (npc != null)
                            {
                                WoWPoint clickLocation = npc.Location.RayCast(npc.Rotation, 6);
                                clickLocation.Z += 3;
                                if (!Me.GotTarget || Me.CurrentTarget != npc)
                                {
                                    npc.Target();
                                }
                                if (TargetIsInVehicle || quest.IsCompleted)
                                {
                                    _state = State.finshed;
                                    TreeRoot.StatusText = quest.IsCompleted ? "Turning Quest in!" : "Returning to base";
                                    _pathIndex = 0;
                                    break;
                                }
                                else
                                {
                                    if (npc.Distance > 25)
                                    {
                                        _casting = false;
                                    }
                                    if (vehicle.Location.Distance(clickLocation) > 5 && !_casting)
                                    {
                                        WoWMovement.ClickToMove(clickLocation);
                                    }
                                    else
                                    {
                                        WoWMovement.MoveStop();
                                        Lua.DoString("if GetPetActionCooldown({0}) == 0 then CastPetAction({0}) end ", PickUpPassengerButton);
                                        _casting = true;
                                    }
                                    break;
                                }
                            }
                            using (new FrameLock())
                            {
                                Lua.DoString("if GetPetActionCooldown({0}) == 0 then CastPetAction({0}) end ", SpeedButton);
                                WoWMovement.ClickToMove(waypoint);
                            }
                        }
                        break;

                    case State.landing:
                        if (PickUpPassengerButton == 0 || quest.IsCompleted)
                        {
                            Lua.DoString("VehicleExit()");
                            if ((Me.Combat || !quest.IsCompleted) && ItemId > 0)
                            {
                                _state = State.liftoff;
                                TreeRoot.StatusText = "Remounting to drop combat";
                            }
                            else
                            {
                                _isBehaviorDone = true;
                            }
                        }
                        else
                        {
                            WoWMovement.MoveStop();
                            Styx.StyxWoW.SleepForLagDuration();
                            Lua.DoString("if GetPetActionCooldown({0}) == 0 then CastPetAction({0}) end ", DropPassengerButton);
                            _state = State.start;
                            _pathIndex = 0;
                        }
                        return RunStatus.Success;
                    }
                    System.Threading.Thread.Sleep(100);
                }
            })
                        )));
        }
Exemplo n.º 49
0
 public static void AtLocation(WoWPoint pt, SimpleBooleanDelegate and = null)
 {
     Set(StopType.Location, null, pt, 0, at => StyxWoW.Me.Location.Distance(pt) <= 1, and);
 }
Exemplo n.º 50
0
 protected override RunStatus Run(object context)
 {
     if (!IsDone)
     {
         if (MerchantFrame.Instance == null || !MerchantFrame.Instance.IsVisible)
         {
             WoWPoint movetoPoint = _loc;
             WoWUnit  unit        = ObjectManager.GetObjectsOfType <WoWUnit>().Where(o => o.Entry == NpcEntry).
                                    OrderBy(o => o.Distance).FirstOrDefault();
             if (unit != null)
             {
                 movetoPoint = WoWMathHelper.CalculatePointFrom(Me.Location, unit.Location, 3);
             }
             else if (movetoPoint == WoWPoint.Zero)
             {
                 movetoPoint = MoveToAction.GetLocationFromDB(MoveToAction.MoveToType.NpcByID, NpcEntry);
             }
             if (movetoPoint != WoWPoint.Zero && ObjectManager.Me.Location.Distance(movetoPoint) > 4.5)
             {
                 Util.MoveTo(movetoPoint);
             }
             else if (unit != null)
             {
                 unit.Target();
                 unit.Interact();
             }
             if (GossipFrame.Instance != null && GossipFrame.Instance.IsVisible &&
                 GossipFrame.Instance.GossipOptionEntries != null)
             {
                 foreach (GossipEntry ge in GossipFrame.Instance.GossipOptionEntries)
                 {
                     if (ge.Type == GossipEntry.GossipEntryType.Vendor)
                     {
                         GossipFrame.Instance.SelectGossipOption(ge.Index);
                         break;
                     }
                 }
             }
         }
         else
         {
             // check if we have merchant frame open at correct NPC
             if (NpcEntry > 0 && Me.GotTarget && Me.CurrentTarget.Entry != NpcEntry)
             {
                 MerchantFrame.Instance.Close();
                 return(RunStatus.Success);
             }
             if (!_concludingSw.IsRunning)
             {
                 if (BuyItemType == BuyItemActionType.SpecificItem)
                 {
                     var      idList  = new List <uint>();
                     string[] entries = ItemID.Split(',');
                     if (entries.Length > 0)
                     {
                         foreach (string entry in entries)
                         {
                             uint temp;
                             uint.TryParse(entry.Trim(), out temp);
                             idList.Add(temp);
                         }
                     }
                     else
                     {
                         Professionbuddy.Err(Pb.Strings["Error_NoItemEntries"]);
                         IsDone = true;
                         return(RunStatus.Failure);
                     }
                     foreach (uint id in idList)
                     {
                         int count = !BuyAdditively ? Count - Util.GetCarriedItemCount(id) : Count;
                         if (count > 0)
                         {
                             BuyItem(id, (uint)count);
                         }
                     }
                 }
                 else if (BuyItemType == BuyItemActionType.Material)
                 {
                     foreach (var kv in Pb.MaterialList)
                     {
                         // only buy items if we don't have enough in bags...
                         int amount = kv.Value - (int)Ingredient.GetInBagItemCount(kv.Key);
                         if (amount > 0)
                         {
                             BuyItem(kv.Key, (uint)amount);
                         }
                     }
                 }
                 _concludingSw.Start();
             }
             if (_concludingSw.ElapsedMilliseconds >= 2000)
             {
                 Professionbuddy.Log("BuyItemAction Completed");
                 IsDone = true;
             }
         }
         if (!IsDone)
         {
             return(RunStatus.Success);
         }
     }
     return(RunStatus.Failure);
 }
Exemplo n.º 51
0
        float?GetFaceWaterDirection()
        {
            WoWPoint playerLoc  = _me.Location;
            var      sonar      = new List <int>(TraceStep);
            var      tracelines = new WorldLine[TraceStep * 3];

            bool[] tracelineRetVals;
            for (int i = 0; i < TraceStep; i++)
            {
                // scans 10,15 and 20 yards from player for water at every 18 degress
                for (int n = 0; n < 3; n++)
                {
                    WoWPoint p         = (playerLoc.RayCast((i * PIx2) / TraceStep, 10 + (n * 5)));
                    WoWPoint highPoint = p;
                    highPoint.Z += 5;
                    WoWPoint lowPoint = p;
                    lowPoint.Z -= 55;
                    tracelines[(i * 3) + n].Start = highPoint;
                    tracelines[(i * 3) + n].End   = lowPoint;
                }
            }
            GameWorld.MassTraceLine(tracelines,
                                    GameWorld.CGWorldFrameHitFlags.HitTestLiquid | GameWorld.CGWorldFrameHitFlags.HitTestLiquid2,
                                    out tracelineRetVals);
            for (int i = 0; i < TraceStep; i++)
            {
                int scan = 0;
                for (int n = 0; n < 3; n++)
                {
                    if (tracelineRetVals[(i * 3) + n])
                    {
                        scan++;
                    }
                }
                sonar.Add(scan);
            }

            int widest = 0;

            for (int i = 0; i < TraceStep; i++)
            {
                if (sonar[i] > widest)
                {
                    widest = sonar[i];
                }
            }
            bool counting = false;
            int  startIndex = 0, bigestStartIndex = 0, startLen = 0, endLen = 0, bigestStretch = 0;

            // if we found water find the largest area and face towards the center of it.


            if (widest > 0)
            {
                for (int i = 0; i < TraceStep; i++)
                {
                    if (sonar[i] == widest && !counting)
                    {
                        startIndex = i;
                        if (i == 0)
                        {
                            startLen = 1;
                        }
                        counting = true;
                    }
                    if (sonar[i] != widest && counting)
                    {
                        if ((i) - startIndex > bigestStretch)
                        {
                            bigestStretch    = (i) - startIndex;
                            bigestStartIndex = startIndex;
                        }
                        if (startIndex == 0)
                        {
                            startLen = i;
                        }
                        counting = false;
                    }
                    if (sonar[i] == widest && counting && i == 19)
                    {
                        endLen = i - startIndex;
                    }
                }
                int index;
                if (startLen + endLen > bigestStretch)
                {
                    if (startLen >= endLen)
                    {
                        index = startLen > endLen ? startLen - endLen : endLen - startLen;
                    }
                    else
                    {
                        index = (TraceStep - 1) - (endLen - startLen);
                    }
                }
                else
                {
                    index = bigestStartIndex + (bigestStretch / 2);
                }
                float direction = (index * PIx2) / 20;

                return(direction);
            }
            return(null);
        }
Exemplo n.º 52
0
 public void MoveTowards(WoWPoint location)
 {
 }
Exemplo n.º 53
0
        /// <summary>
        /// SetTotemsAsNeeded() - manages casting totems as called for by environment and
        /// user configuration values. This code uses:
        ///     http://www.yawb.info/2009/08/25/learning-about-totems-tips-to-aid-your-growing-shamanism/
        /// as a guideline for totem usage while leveling.
        /// </summary>
        private bool SetTotemsAsNeeded()
        {
            bool castTotem = false;

            try
            {
                if (!_me.Fleeing && (Shaman.cfg.FarmingLowLevel || _me.IsMoving))
                {
                    return(false);
                }

                // limit how frequently we check totems.  needs to be often,
                // .. but not each loop.
                // ..
                if (_TotemCheckTimer.ElapsedMilliseconds < 1500)
                {
                    // if this isn't first time here since reset, then wait for 2 seconds
                    if (!_me.Fleeing && _TotemCheckTimer.ElapsedMilliseconds > 0 && TotemsWereSet())
                    {
                        return(false);
                    }

                    // otherwise, only 0 if first check after last .Reset
                    //  ..  so continue processing
                }

                if (TotemsWereSet() && _ptTotems.Distance(_me.Location) > Shaman.cfg.DistanceForTotemRecall)
                {
                    Shaman.Dlog("Recalling Totems that were set {0:F1} yds away at point {1}", _ptTotems.Distance(_me.Location), _ptTotems.ToString());
                    RecallTotemsForMana();
                }

                _TotemCheckTimer.Reset();
                _TotemCheckTimer.Start();

                //-----
                // if you make it past the following gate, only limited tests are needed for each totem
                //-----
                if (IsPVP() || Shaman.IsRAF())
                {
                    ;
                }
                else if (Shaman.IsFightStressful() || !Shaman.cfg.PVE_SaveForStress_TotemsSelected)
                {
                    ;
                }
                else
                {
                    Shaman.Dlog("not setting totems until a stressful situation");
                    return(false);
                }

                // check which totems exist
                bool bAnyTotemsUp = TotemExist(TOTEM_EARTH) ||
                                    TotemExist(TOTEM_FIRE) ||
                                    TotemExist(TOTEM_WATER) ||
                                    TotemExist(TOTEM_AIR);

                Shaman.Dlog("SetTotemsAsNeeded:  earth: " + BoolToYN(TotemExist(TOTEM_EARTH)) + "  fire: " + BoolToYN(TotemExist(TOTEM_FIRE)) + "  water: " + BoolToYN(TotemExist(TOTEM_WATER)) + "  air: " + BoolToYN(TotemExist(TOTEM_AIR)));

                _WereTotemsSet = bAnyTotemsUp;  // _WereTotemsSet || removed because only matters if they exist

                // Quick scan for mobs that cast fear (only in RAF)
                //////////////////////////////////////////////////////////////////////
                Shaman.foundMobsThatFear = _me.Fleeing;
                if (Shaman.foundMobsThatFear)
                {
                    Shaman.Slog("Tremor Totem:  detected fear mob");
                }

                // Totem Bar Set
                // -- add handling for changing totem bar setup temporarily if needed for tremor totem
                //////////////////////////////////////////////////////////////////////
                const string totemBar = "Call of the Elements";
                if (!bAnyTotemsUp && SpellManager.HasSpell(totemBar))
                {
                    TotemId saveEarthTotemSetup = TotemId.TREMOR_TOTEM;

                    // if mobs that fear are found and tremor not in bar setup already, add temporarily just for cast
                    if (Shaman.foundMobsThatFear && _totemBar[TOTEM_EARTH] != TotemId.TREMOR_TOTEM)
                    {
                        saveEarthTotemSetup = _totemBar[TOTEM_EARTH];
                        TotemSelect(TOTEM_EARTH, TotemId.TREMOR_TOTEM);
                    }

                    if (Shaman.Safe_CastSpell(totemBar, Shaman.SpellRange.NoCheck, Shaman.SpellWait.Complete))
                    {
                        castTotem      = true;
                        _WereTotemsSet = true;
                        _ptTotems      = _me.Location;

                        if (IsRAF())
                        {
                            Dlog("SetTotemsAsNeeded: set totems at <{0}> {1:F1} yds from Leader", _ptTotems.ToString(), GroupTank.Distance);
                        }
                        else
                        {
                            Dlog("SetTotemsAsNeeded: set totems at <{0}>", _ptTotems.ToString());
                        }
                    }

                    // if we changed the earth totem on bar, restore back to configured value
                    if (saveEarthTotemSetup != TotemId.TREMOR_TOTEM)
                    {
                        TotemSelect(TOTEM_EARTH, saveEarthTotemSetup);
                    }
                }
                else
                {
                    // Earth Totems First
                    //////////////////////////////////////////////////////////////////////
                    if (foundMobsThatFear && HasTotemSpell(TotemId.TREMOR_TOTEM) && TotemId.TREMOR_TOTEM != (TotemId)_totem[TOTEM_EARTH].CreatedBySpellId)
                    {
                        castTotem = castTotem || TotemCast(TotemId.TREMOR_TOTEM);
                    }
                    else if (0 != _totemBar[TOTEM_EARTH])
                    {
                        if (!TotemExist(TOTEM_EARTH) && HasTotemSpell(_totemBar[TOTEM_EARTH]))
                        {
                            castTotem = castTotem || TotemCast(_totemBar[TOTEM_EARTH]);
                        }

                        if (!TotemExist(TOTEM_EARTH) && Shaman.typeShaman == Shaman.ShamanType.Enhance && HasTotemSpell(TotemId.STRENGTH_OF_EARTH_TOTEM))
                        {
                            castTotem = castTotem || TotemCast(TotemId.STRENGTH_OF_EARTH_TOTEM);
                        }

                        if (!TotemExist(TOTEM_EARTH) && Shaman.typeShaman != Shaman.ShamanType.Enhance && HasTotemSpell(TotemId.STONESKIN_TOTEM))
                        {
                            castTotem = castTotem || TotemCast(TotemId.STONESKIN_TOTEM);
                        }
                    }

                    // Fire Totems
                    //////////////////////////////////////////////////////////////////////
                    if (_countMeleeEnemy >= 3 && !IsHealerOnly())
                    {
                        if (!_me.GotTarget || !IsImmunneToFire(_me.CurrentTarget))
                        {
                            if (!TotemExist(TOTEM_FIRE) || (!TotemExist(TotemId.MAGMA_TOTEM) && !TotemExist(TotemId.FIRE_ELEMENTAL_TOTEM)))
                            {
                                if (HasTotemSpell(TotemId.MAGMA_TOTEM))
                                {
                                    castTotem = castTotem || TotemCast(TotemId.MAGMA_TOTEM);
                                }
                                else if (_countMeleeEnemy >= 4 && HasTotemSpell(TotemId.FLAMETONGUE_TOTEM) && !TotemExist(TotemId.FLAMETONGUE_TOTEM))
                                {
                                    Dlog("SetTotemsAsNeeded: 4 or more mobs and Magma not trained, using Flametongue to allow Fire Nova");
                                    castTotem = castTotem || TotemCast(TotemId.FLAMETONGUE_TOTEM);
                                }
                            }
                        }
                    }

                    if (0 != _totemBar[TOTEM_FIRE] && !TotemExist(TOTEM_FIRE))
                    {
                        if (!TotemExist(TOTEM_FIRE) && HasTotemSpell(_totemBar[TOTEM_FIRE]))
                        {
                            castTotem = castTotem || TotemCast(_totemBar[TOTEM_FIRE]);
                        }
                        if (!TotemExist(TOTEM_FIRE) && Shaman.typeShaman != Shaman.ShamanType.Resto && HasTotemSpell(TotemId.SEARING_TOTEM))
                        {
                            castTotem = castTotem || TotemCast(TotemId.SEARING_TOTEM);
                        }
                        if (!TotemExist(TOTEM_FIRE) && HasTotemSpell(TotemId.FLAMETONGUE_TOTEM))
                        {
                            castTotem = castTotem || TotemCast(TotemId.FLAMETONGUE_TOTEM);
                        }
                    }

                    // Water Totems
                    //////////////////////////////////////////////////////////////////////
                    if (0 != _totemBar[TOTEM_WATER])
                    {
                        if (!TotemExist(TOTEM_WATER) && HasTotemSpell(_totemBar[TOTEM_WATER]))
                        {
                            castTotem = castTotem || TotemCast(_totemBar[TOTEM_WATER]);
                        }

                        if (!TotemExist(TOTEM_WATER) && HasTotemSpell(TotemId.MANA_SPRING_TOTEM))
                        {
                            castTotem = castTotem || TotemCast(TotemId.MANA_SPRING_TOTEM);
                        }
                    }

                    // Air Totems
                    //////////////////////////////////////////////////////////////////////
                    if (0 != _totemBar[TOTEM_AIR])
                    {
                        if (!TotemExist(TOTEM_AIR) && HasTotemSpell(_totemBar[TOTEM_WATER]))
                        {
                            castTotem = castTotem || TotemCast(_totemBar[TOTEM_AIR]);
                        }
                        if (!TotemExist(TOTEM_AIR) && Shaman.typeShaman == Shaman.ShamanType.Resto && HasTotemSpell(TotemId.GROUNDING_TOTEM))
                        {
                            castTotem = castTotem || TotemCast(TotemId.GROUNDING_TOTEM);
                        }
                        if (!TotemExist(TOTEM_AIR) && Shaman.typeShaman == Shaman.ShamanType.Enhance && HasTotemSpell(TotemId.WINDFURY_TOTEM))
                        {
                            castTotem = castTotem || TotemCast(TotemId.WINDFURY_TOTEM);
                        }
                        if (!TotemExist(TOTEM_AIR) && Shaman.typeShaman == Shaman.ShamanType.Elemental && HasTotemSpell(TotemId.WRATH_OF_AIR_TOTEM))
                        {
                            castTotem = castTotem || TotemCast(TotemId.WRATH_OF_AIR_TOTEM);
                        }
                    }

                    _WereTotemsSet = _WereTotemsSet || TotemExist(TOTEM_EARTH) || TotemExist(TOTEM_FIRE) || TotemExist(TOTEM_WATER) || TotemExist(TOTEM_AIR);

                    if (!bAnyTotemsUp && _WereTotemsSet)
                    {
                        _ptTotems = _me.Location;
                    }
                }
            }
            catch (ThreadAbortException) { throw; }
            catch (Exception e)
            {
                Log(Color.Red, "An Exception occured. Check debug log for details.");
                Logging.WriteDebug("HB EXCEPTION in SetTotemsAsNeeded()");
                Logging.WriteException(e);
            }

            // would like to remove this code, but seeing duplicate totem sets
            if (castTotem)
            {
                ObjectManager.Update();
                TotemManagerUpdate();
            }

            return(castTotem);
        }
 public void AppendWaypoint(WoWPoint wowPoint, string name = "", double radius = 7.0)
 {
     Waypoints.Add(new WaypointType(wowPoint, name, radius));
 }
Exemplo n.º 55
0
        protected override async Task Run()
        {
            if (MerchantFrame.Instance == null || !MerchantFrame.Instance.IsVisible)
            {
                WoWPoint movetoPoint = _loc;
                if (_entry == 0)
                {
                    _entry = NpcEntry;
                }
                if (_entry == 0)
                {
                    MoveToAction.GetLocationFromDB(MoveToAction.MoveToType.NearestVendor, 0);
                    NpcResult npcResults = NpcQueries.GetNearestNpc(
                        StyxWoW.Me.MapId,
                        StyxWoW.Me.Location,
                        UnitNPCFlags.Vendor);
                    _entry      = (uint)npcResults.Entry;
                    movetoPoint = npcResults.Location;
                }
                WoWUnit unit = ObjectManager.GetObjectsOfType <WoWUnit>().Where(o => o.Entry == _entry).
                               OrderBy(o => o.Distance).FirstOrDefault();
                if (unit != null)
                {
                    movetoPoint = unit.Location;
                }
                else if (movetoPoint == WoWPoint.Zero)
                {
                    movetoPoint = MoveToAction.GetLocationFromDB(MoveToAction.MoveToType.NpcByID, NpcEntry);
                }
                if (movetoPoint != WoWPoint.Zero && StyxWoW.Me.Location.Distance(movetoPoint) > 4.5)
                {
                    Util.MoveTo(movetoPoint);
                }
                else if (unit != null)
                {
                    unit.Target();
                    unit.Interact();
                }

                if (GossipFrame.Instance != null && GossipFrame.Instance.IsVisible &&
                    GossipFrame.Instance.GossipOptionEntries != null)
                {
                    foreach (GossipEntry ge in GossipFrame.Instance.GossipOptionEntries)
                    {
                        if (ge.Type == GossipEntry.GossipEntryType.Vendor)
                        {
                            GossipFrame.Instance.SelectGossipOption(ge.Index);
                            return;
                        }
                    }
                }
            }
            else
            {
                if (SellItemType == SellItemActionType.Specific)
                {
                    var      idList  = new List <uint>();
                    string[] entries = ItemID.Split(',');
                    if (entries.Length > 0)
                    {
                        foreach (string entry in entries)
                        {
                            uint itemID;
                            if (!uint.TryParse(entry.Trim(), out itemID))
                            {
                                PBLog.Warn(Strings["Error_NotAValidItemEntry"], entry.Trim());
                                continue;
                            }
                            idList.Add(itemID);
                        }
                    }
                    else
                    {
                        PBLog.Warn(Strings["Error_NoItemEntries"]);
                        IsDone = true;
                        return;
                    }
                    List <WoWItem> itemList = StyxWoW.Me.BagItems.Where(u => idList.Contains(u.Entry)).
                                              Take(Sell == DepositWithdrawAmount.All ? int.MaxValue : Count).ToList();
                    using (StyxWoW.Memory.AcquireFrame())
                    {
                        foreach (WoWItem item in itemList)
                        {
                            item.UseContainerItem();
                        }
                    }
                }
                else
                {
                    List <WoWItem>        itemList  = null;
                    IEnumerable <WoWItem> itemQuery = from item in Me.BagItems
                                                      where !ProtectedItemsManager.Contains(item.Entry) &&
                                                      !ProfessionbuddyBot.Instance.TradeskillTools.Contains(item.Entry)
                                                      select item;
                    switch (SellItemType)
                    {
                    case SellItemActionType.Greys:
                        itemList = itemQuery.Where(i => i.Quality == WoWItemQuality.Poor).ToList();
                        break;

                    case SellItemActionType.Whites:
                        itemList = itemQuery.Where(i => i.Quality == WoWItemQuality.Common).ToList();
                        break;

                    case SellItemActionType.Greens:
                        itemList = itemQuery.Where(i => i.Quality == WoWItemQuality.Uncommon).ToList();
                        break;

                    case SellItemActionType.Blues:
                        itemList = itemQuery.Where(i => i.Quality == WoWItemQuality.Rare).ToList();
                        break;
                    }
                    if (itemList != null)
                    {
                        using (StyxWoW.Memory.AcquireFrame())
                        {
                            foreach (WoWItem item in itemList)
                            {
                                item.UseContainerItem();
                            }
                        }
                    }
                }
                PBLog.Log("SellItemAction Completed for {0}", ItemID);
                IsDone = true;
            }
        }
 public WaypointType FindFirstWaypoint(WoWPoint currentLocation)
 {
     return((WaypointVisitStrategy == WaypointVisitStrategyType.Random)
         ? FindNextWaypoint(currentLocation)
         : FindNearestWaypoint(currentLocation));
 }
Exemplo n.º 57
0
        protected override RunStatus Run(object context)
        {
            if (!IsDone)
            {
                if (MerchantFrame.Instance == null || !MerchantFrame.Instance.IsVisible)
                {
                    WoWPoint movetoPoint = _loc;
                    if (_entry == 0)
                    {
                        _entry = NpcEntry;
                    }
                    if (_entry == 0)
                    {
                        MoveToAction.GetLocationFromDB(MoveToAction.MoveToType.NearestVendor, 0);
                        var npcResults = NpcQueries.GetNearestNpc(ObjectManager.Me.FactionTemplate, ObjectManager.Me.MapId,
                                                                  ObjectManager.Me.Location, UnitNPCFlags.Vendor);
                        _entry      = (uint)npcResults.Entry;
                        movetoPoint = npcResults.Location;
                    }
                    WoWUnit unit = ObjectManager.GetObjectsOfType <WoWUnit>().Where(o => o.Entry == _entry).
                                   OrderBy(o => o.Distance).FirstOrDefault();
                    if (unit != null)
                    {
                        movetoPoint = unit.Location;
                    }
                    else if (movetoPoint == WoWPoint.Zero)
                    {
                        movetoPoint = MoveToAction.GetLocationFromDB(MoveToAction.MoveToType.NpcByID, NpcEntry);
                    }
                    if (movetoPoint != WoWPoint.Zero && ObjectManager.Me.Location.Distance(movetoPoint) > 4.5)
                    {
                        Util.MoveTo(movetoPoint);
                    }
                    else if (unit != null)
                    {
                        unit.Target();
                        unit.Interact();
                    }

                    if (GossipFrame.Instance != null && GossipFrame.Instance.IsVisible &&
                        GossipFrame.Instance.GossipOptionEntries != null)
                    {
                        foreach (GossipEntry ge in GossipFrame.Instance.GossipOptionEntries)
                        {
                            if (ge.Type == GossipEntry.GossipEntryType.Vendor)
                            {
                                GossipFrame.Instance.SelectGossipOption(ge.Index);
                                return(RunStatus.Success);
                            }
                        }
                    }
                }
                else
                {
                    if (SellItemType == SellItemActionType.Specific)
                    {
                        var      idList  = new List <uint>();
                        string[] entries = ItemID.Split(',');
                        if (entries.Length > 0)
                        {
                            foreach (var entry in entries)
                            {
                                uint temp;
                                uint.TryParse(entry.Trim(), out temp);
                                idList.Add(temp);
                            }
                        }
                        else
                        {
                            Professionbuddy.Err("No ItemIDs are specified");
                            IsDone = true;
                            return(RunStatus.Failure);
                        }
                        List <WoWItem> itemList = ObjectManager.Me.BagItems.Where(u => idList.Contains(u.Entry)).
                                                  Take((int)Count <= 0 ? int.MaxValue : Count).ToList();
                        using (new FrameLock())
                        {
                            foreach (WoWItem item in itemList)
                            {
                                item.UseContainerItem();
                            }
                        }
                    }
                    else
                    {
                        List <WoWItem>        itemList  = null;
                        IEnumerable <WoWItem> itemQuery = from item in Me.BagItems
                                                          where !Pb.ProtectedItems.Contains(item.Entry)
                                                          select item;
                        switch (SellItemType)
                        {
                        case SellItemActionType.Greys:
                            itemList = itemQuery.Where(i => i.Quality == WoWItemQuality.Poor).ToList();
                            break;

                        case SellItemActionType.Whites:
                            itemList = itemQuery.Where(i => i.Quality == WoWItemQuality.Common).ToList();
                            break;

                        case SellItemActionType.Greens:
                            itemList = itemQuery.Where(i => i.Quality == WoWItemQuality.Uncommon).ToList();
                            break;
                        }
                        if (itemList != null)
                        {
                            using (new FrameLock())
                            {
                                foreach (WoWItem item in itemList)
                                {
                                    item.UseContainerItem();
                                }
                            }
                        }
                    }
                    Professionbuddy.Log("SellItemAction Completed for {0}", ItemID);
                    IsDone = true;
                }
                return(RunStatus.Success);
            }
            return(RunStatus.Failure);
        }
Exemplo n.º 58
0
        /// <summary>
        /// Function to Find and Kill Mobs
        /// </summary>
        public void findAndKillMob(WoWUnit Enemy)
        {
            bool CastSuccess = false;

            if (!Enemy.IsDead)
            {
                #region don't kill if
                // Don't kill Pandaria Rares with Low Health
                if ((Enemy.Entry == 50828 || Enemy.Entry == 50836 || Enemy.Entry == 50840 || Enemy.Entry == 50823 ||
                     Enemy.Entry == 50831 || Enemy.Entry == 50830 || Enemy.Entry == 50832 || Enemy.Entry == 50750 ||
                     Enemy.Entry == 50768 || Enemy.Entry == 50772 || Enemy.Entry == 50766 || Enemy.Entry == 50769 ||
                     Enemy.Entry == 50780 || Enemy.Entry == 50776 || Enemy.Entry == 50739 || Enemy.Entry == 50749 ||
                     Enemy.Entry == 50734 || Enemy.Entry == 50364 || Enemy.Entry == 50363 || Enemy.Entry == 50733 ||
                     Enemy.Entry == 50388 || Enemy.Entry == 50341 || Enemy.Entry == 50349 || Enemy.Entry == 50340 ||
                     Enemy.Entry == 50347 || Enemy.Entry == 50338 || Enemy.Entry == 50344 || Enemy.Entry == 50339 ||
                     Enemy.Entry == 50354 || Enemy.Entry == 50351 || Enemy.Entry == 50355 || Enemy.Entry == 50356 ||
                     Enemy.Entry == 50350 || Enemy.Entry == 50352 || Enemy.Entry == 50359 || Enemy.Entry == 50821 ||
                     Enemy.Entry == 50817 || Enemy.Entry == 50822 || Enemy.Entry == 50816 || Enemy.Entry == 50811 ||
                     Enemy.Entry == 50808 || Enemy.Entry == 50820 || Enemy.Entry == 50787 || Enemy.Entry == 50806 ||
                     Enemy.Entry == 50789 || Enemy.Entry == 50805 || Enemy.Entry == 50783 || Enemy.Entry == 50782 ||
                     Enemy.Entry == 50791 || Enemy.Entry == 51059 || Enemy.Entry == 50334 || Enemy.Entry == 51078 ||
                     Enemy.Entry == 50331 || Enemy.Entry == 50332 || Enemy.Entry == 50333 || Enemy.Entry == 50336) &&
                    Me.HealthPercent < 80)
                {
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}, but don't Kill Pandaria Mob with Health < 80%", Enemy.Name, Enemy.Entry);
                    return;
                }
                if (Rarekiller.Settings.NotKillTameable && Enemy.IsTameable) // ... I want to tame him :)
                {
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}, but kill tameable", Enemy.Name, Enemy.Entry);
                    return;
                }
                #endregion

                Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}", Enemy.Name, Enemy.Entry);
                Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Mob Location: {0} / {1} / {2}", Convert.ToString(Enemy.X), Convert.ToString(Enemy.Y), Convert.ToString(Enemy.Z));
                if (Rarekiller.Settings.LUAoutput)
                {
                    Lua.DoString("print('NPCScan: Find {0} ID {1}')", Enemy.Name, Enemy.Entry);
                }

                #region don't kill if ...
                if (Rarekiller.Settings.PullCounter >= Rarekiller.Settings.MaxPullCounter)
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but I pulled him now {1} Times", Enemy.Name, Rarekiller.Settings.PullCounter);
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 15 Minutes, MoP Rares will be deactivated");
                    if (Rarekiller.Settings.LUAoutput)
                    {
                        Lua.DoString("print('NPCScan: I pulled now {0} times, blacklist')", Rarekiller.Settings.PullCounter);
                    }
                    Rarekiller.Settings.PullCounter     = 0;
                    Rarekiller.Settings.GuidCurrentPull = 0;
                    Rarekiller.Settings.BlacklistCounter++;
                    Rarekiller.Settings.DeactivateMoPRare(Enemy);
                    return;
                }
                // Don't kill Pandaria Rares with Level < 90
                if ((Enemy.Entry == 50828 || Enemy.Entry == 50836 || Enemy.Entry == 50840 || Enemy.Entry == 50823 ||
                     Enemy.Entry == 50831 || Enemy.Entry == 50830 || Enemy.Entry == 50832 || Enemy.Entry == 50750 ||
                     Enemy.Entry == 50768 || Enemy.Entry == 50772 || Enemy.Entry == 50766 || Enemy.Entry == 50769 ||
                     Enemy.Entry == 50780 || Enemy.Entry == 50776 || Enemy.Entry == 50739 || Enemy.Entry == 50749 ||
                     Enemy.Entry == 50734 || Enemy.Entry == 50364 || Enemy.Entry == 50363 || Enemy.Entry == 50733 ||
                     Enemy.Entry == 50388 || Enemy.Entry == 50341 || Enemy.Entry == 50349 || Enemy.Entry == 50340 ||
                     Enemy.Entry == 50347 || Enemy.Entry == 50338 || Enemy.Entry == 50344 || Enemy.Entry == 50339 ||
                     Enemy.Entry == 50354 || Enemy.Entry == 50351 || Enemy.Entry == 50355 || Enemy.Entry == 50356 ||
                     Enemy.Entry == 50350 || Enemy.Entry == 50352 || Enemy.Entry == 50359 || Enemy.Entry == 50821 ||
                     Enemy.Entry == 50817 || Enemy.Entry == 50822 || Enemy.Entry == 50816 || Enemy.Entry == 50811 ||
                     Enemy.Entry == 50808 || Enemy.Entry == 50820 || Enemy.Entry == 50787 || Enemy.Entry == 50806 ||
                     Enemy.Entry == 50789 || Enemy.Entry == 50805 || Enemy.Entry == 50783 || Enemy.Entry == 50782 ||
                     Enemy.Entry == 50791 || Enemy.Entry == 51059 || Enemy.Entry == 50334 || Enemy.Entry == 51078 ||
                     Enemy.Entry == 50331 || Enemy.Entry == 50332 || Enemy.Entry == 50333 || Enemy.Entry == 50336) &&
                    Me.Level < 90)
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but my level is to Low to kill him", Enemy.Name);
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                    if (Rarekiller.Settings.LUAoutput)
                    {
                        Lua.DoString("print('NPCScan: My Level is to low')", Enemy.Name);
                    }
                    return;
                }

                if (Enemy.TaggedByOther && !Rarekiller.TaggedMobsList.ContainsKey(Convert.ToInt32(Enemy.Entry)))
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but he's tagged by another Player", Enemy.Name);
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                    if (Rarekiller.Settings.LUAoutput)
                    {
                        Lua.DoString("print('NPCScan: NPC is tagged')", Enemy.Name);
                    }
                    return;
                }
                //if not known ID of Inhouse Pandaria Rare --> don't kill
                if (!(Enemy.Entry == 50817 || Enemy.Entry == 50768 ||
                      Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 ||
                      Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50769))
                {
                    if (Me.IsFlying && Me.IsOutdoors && Enemy.IsIndoors)
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Mob is Indoors and I fly Outdoors, so blacklist him to prevent Problems");
                        Logging.Write(Colors.MediumPurple, "Rarekiller: You have to place me next to the Spawnpoint, if you want me to hunt this Mob.");
                        Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                        if (Rarekiller.Settings.LUAoutput)
                        {
                            Lua.DoString("print('NPCScan: NPC is Indoors')", Enemy.Name);
                        }
                        return;
                    }
                }
                if (Enemy.Level > (Me.Level + 4))                 // ... 4 Levels higher them me
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: His Level is 5 over mine, better not to kill him.");
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes.");
                    return;
                }
                if (Enemy.IsFriendly)                 // ... is Friendly
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but he's friendly", Enemy.Name);
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes.");
                    if (Rarekiller.Settings.LUAoutput)
                    {
                        Lua.DoString("print('NPCScan: NPC is friendly')", Enemy.Name);
                    }
                    return;
                }
                if ((Enemy.Entry == 32630) && !Rarekiller.Settings.Vyragosa)                 // ... my Settings say don't kill Vyragosa
                {
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Config says: don't kill Vyragosa.");
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                    if (Rarekiller.Settings.LUAoutput)
                    {
                        Lua.DoString("print('NPCScan: don't kill NPC')", Enemy.Name);
                    }
                    return;
                }
                if ((Enemy.Entry == 50057) && !Rarekiller.Settings.Blazewing)                 // ... my Settings say don't kill Blazewing
                {
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Config says: don't kill Blazewing.");
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes.");
                    if (Rarekiller.Settings.LUAoutput)
                    {
                        Lua.DoString("print('NPCScan: don't kill NPC')", Enemy.Name);
                    }
                    return;
                }
                if ((Enemy.Entry == 596) || (Enemy.Entry == 599) || Me.IsInInstance)
                {
                    // ... Instance Mobs, don't run wild in Instances
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Don't run wild because of RareMobs in Instances.");
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes.");
                    return;
                }
                if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(Enemy.Entry)))
                // ... Mob is Blacklisted in Rarekiller/config/BlacklistedMobs.xml
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: {0} is Member of the BlacklistedMobs.xml", Enemy.Name);
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 15 Minutes.");
                    return;
                }
                if (Rarekiller.DontInteract)
                {
                    return;
                }
                #endregion

                if (Rarekiller.Settings.Alert)
                {
                    Rarekiller.Alert();
                }

                #region fly to Helperpoint for some Pandaria Rares
                if (Me.IsFlying && (Enemy.Entry == 50817 || Enemy.Entry == 50768 ||
                                    Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 ||
                                    Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50769 ||
                                    Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347 || Enemy.Entry == 50811 ||
                                    Enemy.Entry == 50821 || Enemy.Entry == 50808 || Enemy.Entry == 50820))
                {
                    WoWPoint Helperpoint = Enemy.Location;
                    if (Enemy.Entry == 50817)
                    {
                        Helperpoint = LandingPoint50817;
                    }
                    if (Enemy.Entry == 50768)
                    {
                        Helperpoint = LandingPoint50768;
                    }
                    if (Enemy.Entry == 50836)
                    {
                        Helperpoint = LandingPoint50836;
                    }
                    if (Enemy.Entry == 50782)
                    {
                        Helperpoint = LandingPoint50782;
                    }
                    if (Enemy.Entry == 50831)
                    {
                        Helperpoint = LandingPoint50831;
                    }
                    if (Enemy.Entry == 50832)
                    {
                        Helperpoint = LandingPoint50832;
                    }
                    if (Enemy.Entry == 50769)
                    {
                        Helperpoint = LandingPoint50769;
                    }
                    if (Enemy.Entry == 50822)
                    {
                        Helperpoint = LandingPoint50822;
                    }
                    if (Enemy.Entry == 50331)
                    {
                        Helperpoint = LandingPoint50331;
                    }
                    if (Enemy.Entry == 51078)
                    {
                        Helperpoint = LandingPoint51078;
                    }
                    if (Enemy.Entry == 50749)
                    {
                        Helperpoint = LandingPoint50749;
                    }
                    if (Enemy.Entry == 50334)
                    {
                        Helperpoint = LandingPoint50334;
                    }
                    if (Enemy.Entry == 50347)
                    {
                        Helperpoint = LandingPoint50347;
                    }
                    if (Enemy.Entry == 50811)
                    {
                        Helperpoint = LandingPoint50811;
                    }
                    if (Enemy.Entry == 50821)
                    {
                        Helperpoint = LandingPoint50821;
                    }
                    if (Enemy.Entry == 50808)
                    {
                        Helperpoint = LandingPoint50808;
                    }
                    if (Enemy.Entry == 50820)
                    {
                        Helperpoint = LandingPoint50820;
                    }

                    if (!Rarekiller.MoveTo(Helperpoint, Enemy, 5, false))
                    {
                        return;
                    }
                    Rarekiller.Dismount();
                }
                #endregion

                #region Check PullRange

                string UsedPullRange = Rarekiller.Settings.Range;

                // Range to 27 because of Inhouse Pandaria Mob
                if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell) && (
                        Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 ||
                        Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50768 ||
                        Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347 || Enemy.Entry == 50811 ||
                        Enemy.Entry == 50821 || Enemy.Entry == 50808 || Enemy.Entry == 50820))
                {
                    UsedPullRange = "27";
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to 27 because of Inhouse Pandaria Rare");
                }
                // Range to 3 for other Pandaria Mobs
                //else if (o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 ||
                //o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 ||
                //o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 ||
                //o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 ||
                //o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 ||
                //o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 ||
                //o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 ||
                //o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 ||
                //o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 ||
                //o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 ||
                //o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 ||
                //o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 ||
                //o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 ||
                //o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336)
                //{
                //    UsedPullRange = "3";
                //    Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to 3 because of other Pandaria Rares");
                //}

                else if (!Rarekiller.Settings.DefaultPull && (Convert.ToInt64(UsedPullRange) > Convert.ToInt64(Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull))))
                {
                    UsedPullRange = Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull);
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to {0} because of Low-Ranged Customized Spell", Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull));
                }

                else if (Rarekiller.Settings.DefaultPull && (Convert.ToInt64(UsedPullRange) > Convert.ToInt64(Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell))))
                {
                    UsedPullRange = Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell);
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to {0} because of Low-Ranged Default Spell", Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell));
                }
                #endregion

                #region Move To Mob
                if (Enemy.Entry == 50817 || Enemy.Entry == 50768 ||
                    Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 ||
                    Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50769 ||
                    Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347 || Enemy.Entry == 50811 ||
                    Enemy.Entry == 50821 || Enemy.Entry == 50808 || Enemy.Entry == 50820)
                {
                    if (!Rarekiller.MoveTo(Enemy, Convert.ToInt64(UsedPullRange), true))
                    {
                        return;
                    }
                }
                else
                {
                    if (!Rarekiller.MoveTo(Enemy, Convert.ToInt64(UsedPullRange), false))
                    {
                        return;
                    }
                }
                #endregion

                #region Special Behavior Nal'lak
                //if (Me.Combat && o.Entry == 50364) //Nal'lak
                //{
                //    WoWMovement.MoveStop();
                //    Thread.Sleep(100);
                //    if (Me.IsFlying)
                //    {
                //        WoWUnit GroundUnit = ObjectManager.GetObjectsOfType<WoWUnit>().Where(u => (!u.IsFlying)).OrderBy(u => u.Distance).FirstOrDefault(); ;
                //        if (!Rarekiller.DescendToLand(GroundUnit)) return;
                //    }
                //    Rarekiller.Dismount();
                //}
                #endregion

                #region Special Behavior Clean up Area
                if (Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347)
                {
                    List <WoWUnit> AddList = ObjectManager.GetObjectsOfType <WoWUnit>().Where(Add => !Add.IsDead && Add.IsHostile && (Add != Enemy) && Add.Location.Distance(Enemy.Location) < 27 && Add.Location.Distance(Me.Location) < 27).OrderBy(Add => Add.Distance).ToList();
                    foreach (WoWUnit Add in AddList)
                    {
                        if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell))
                        {
                            CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.RangedPullspell, Add, true);
                            Logging.Write(Colors.MediumPurple, "Rarekiller: Clean up Area, pull Add: {0}", Add.Name);
                            return;
                        }
                    }
                }
                #endregion

                #region Pull Mob
                Logging.Write(Colors.MediumPurple, "Rarekiller: Pull at Mob Location: {0} / {1} / {2}", Convert.ToString(Enemy.X), Convert.ToString(Enemy.Y), Convert.ToString(Enemy.Z));
                Logging.Write(Colors.MediumPurple, "Rarekiller: ... my Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z));
                Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Target is Flying - {0}", Enemy.IsFlying);

                Enemy.Target();
                if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell) &&
                    (Enemy.Entry == 50817 || Enemy.Entry == 50768 ||
                     Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 ||
                     Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50769 ||
                     Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347 || Enemy.Entry == 50811 ||
                     Enemy.Entry == 50821 || Enemy.Entry == 50808 || Enemy.Entry == 50820))
                {
                    CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.RangedPullspell, Enemy, true);
                }

                else if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull))
                {
                    CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, Enemy, false);
                }
                else if (SpellManager.HasSpell(Rarekiller.Spells.FastPullspell))
                {
                    CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.FastPullspell, Enemy, false);
                }
                else
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: I have no valid Pullspell - sorry");
                }

                if (Me.CurrentTarget != Enemy)
                {
                    Enemy.Target();
                }
                #endregion

                #region Quick Slowfall for known flying Mobs
                if (Rarekiller.Settings.UseSlowfall && ((Enemy.Entry == 29753) || (Enemy.Entry == 32491) || (Enemy.Entry == 32630) || (Enemy.Entry == 33687) || (Enemy.Entry == 50364)))
                {
                    Thread.Sleep(500);
                    if (Me.IsFalling)
                    {
                        Rarekiller.Slowfall.HelpFalling();
                    }
                }
                Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Use Quick Slowfall: {0} Mob: {1}", Me.IsFalling, Enemy.Name);
                #endregion

                #region Pulltimer and Pullcounter
                WaitAfterPullTimer.Reset();
                WaitAfterPullTimer.Start();
                while (WaitAfterPullTimer.IsRunning && !Rarekiller.ToonInvalidCombat && WaitAfterPullTimer.ElapsedMilliseconds < 2000)
                {
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Wait for Combat now {0} ms", WaitAfterPullTimer.ElapsedMilliseconds);
                    Thread.Sleep(100);
                }

                if (CastSuccess && Me.Combat)
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Successfully pulled {0}", Enemy.Name);
                }

                if (Enemy.Entry != 32491 && Enemy.Entry != 50005 && (Rarekiller.Settings.GuidCurrentPull != Enemy.Guid) && Me.Combat)
                {
                    Rarekiller.Settings.PullCounter     = 1;
                    Rarekiller.Settings.GuidCurrentPull = Enemy.Guid;
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Pulled {0} now first time", Enemy.Name);
                }
                else if (Me.Combat)
                {
                    Rarekiller.Settings.PullCounter++;
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Pulled {0} now {1} times", Enemy.Name, Rarekiller.Settings.PullCounter);

                    if ((Enemy.Entry == 50828 || Enemy.Entry == 50836 || Enemy.Entry == 50840 || Enemy.Entry == 50823 ||
                         Enemy.Entry == 50831 || Enemy.Entry == 50830 || Enemy.Entry == 50832 || Enemy.Entry == 50750 ||
                         Enemy.Entry == 50768 || Enemy.Entry == 50772 || Enemy.Entry == 50766 || Enemy.Entry == 50769 ||
                         Enemy.Entry == 50780 || Enemy.Entry == 50776 || Enemy.Entry == 50739 || Enemy.Entry == 50749 ||
                         Enemy.Entry == 50734 || Enemy.Entry == 50364 || Enemy.Entry == 50363 || Enemy.Entry == 50733 ||
                         Enemy.Entry == 50388 || Enemy.Entry == 50341 || Enemy.Entry == 50349 || Enemy.Entry == 50340 ||
                         Enemy.Entry == 50347 || Enemy.Entry == 50338 || Enemy.Entry == 50344 || Enemy.Entry == 50339 ||
                         Enemy.Entry == 50354 || Enemy.Entry == 50351 || Enemy.Entry == 50355 || Enemy.Entry == 50356 ||
                         Enemy.Entry == 50350 || Enemy.Entry == 50352 || Enemy.Entry == 50359 || Enemy.Entry == 50821 ||
                         Enemy.Entry == 50817 || Enemy.Entry == 50822 || Enemy.Entry == 50816 || Enemy.Entry == 50811 ||
                         Enemy.Entry == 50808 || Enemy.Entry == 50820 || Enemy.Entry == 50787 || Enemy.Entry == 50806 ||
                         Enemy.Entry == 50789 || Enemy.Entry == 50805 || Enemy.Entry == 50783 || Enemy.Entry == 50782 ||
                         Enemy.Entry == 50791 || Enemy.Entry == 51059 || Enemy.Entry == 50334 || Enemy.Entry == 51078 ||
                         Enemy.Entry == 50331 || Enemy.Entry == 50332 || Enemy.Entry == 50333 || Enemy.Entry == 50336) &&
                        Me.Level < 90)
                    {
                        RoutineManager.Current.Combat();
                    }
                }
                #endregion

                #region Move to a Save Fighting Area after Pull for some Pandaria Rares
                if ((Enemy.Entry == 50768 || Enemy.Entry == 50832) && Me.Combat)
                {
                    WoWPoint SaveHelperpoint = Enemy.Location;
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Save Fighting Point", Enemy.Entry);

                    if (Enemy.Entry == 50768)
                    {
                        SaveHelperpoint = SavePoint50768;
                    }

                    if (Enemy.Entry == 50832)
                    {
                        SaveHelperpoint = SavePoint50832;
                    }

                    if (Navigator.CanNavigateFully(Me.Location, SaveHelperpoint))
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Save Fighting Point");
                        while (Me.Location.Distance(SaveHelperpoint) > 5)
                        {
                            if (Me.IsSwimming)
                            {
                                WoWMovement.ClickToMove(SaveHelperpoint);
                            }
                            else
                            {
                                Navigator.MoveTo(SaveHelperpoint);
                            }
                            Thread.Sleep(100);
                            if (Rarekiller.ToonInvalid)
                            {
                                return;
                            }
                        }
                    }
                    else
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Wasn't able to Move to Save Fighting Point", Enemy.Entry);
                    }
                }
                #endregion

                return;
            }
            else
            {
                if (Enemy.Guid == Rarekiller.Settings.GuidCurrentPull)
                {
                    Rarekiller.Settings.PullCounter     = 0;
                    Rarekiller.Settings.GuidCurrentPull = 0;
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Set PullCounter to {0}", Rarekiller.Settings.PullCounter);
                }

                if (Enemy.CanLoot)
                {
                    if (!Rarekiller.Loothelper(Enemy))
                    {
                        return;
                    }
                }

                if (!Blacklist.Contains(Enemy.Guid, Rarekiller.Settings.Flags))
                {
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but sadly he's dead", Enemy.Name);
                    Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                    Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes.");
                }
            }
        }
        /// <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 = Navigator.GeneratePath(Me.Location, destination1);

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

                ObjectManager.Update();
                _vehicleList = ObjectManager.GetObjectsOfType <WoWUnit>()
                               .Where(ret => (ret.Entry == VehicleId) && !ret.IsDead).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.IsDead).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 = Navigator.GeneratePath(_vehicleList[0].Location, destination);

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

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

                Counter++;
            })
                                                       ),

                                         new Action(ret => LogMessage("debug", string.Empty))
                                         )
                                     )));
        }
Exemplo n.º 60
0
 public BehaviorMove(WoWPoint loc, float distance = 10f, Movement.MovementTypes type = Movement.MovementTypes.Normal, bool stuckCheck = false)
     : this(new[] { loc }, distance, type, stuckCheck)
 {
 }