コード例 #1
0
ファイル: Extension.cs プロジェクト: Marsbars/AIO-WOTLK
    public static bool GroupBuffSpell(Spell spell, int playercount = 0)
    {
        if (!spell.KnownSpell || !spell.IsSpellUsable || !spell.IsDistanceGood)
        {
            return(false);
        }
        var members = Partystuff.getPartymembers().Where(o => o.IsValid &&
                                                         o.IsAlive &&
                                                         !o.HaveBuff(spell.Id) &&
                                                         !TraceLine.TraceLineGo(o.Position)).OrderBy(o => o.HealthPercent);

        if (members.Count() > playercount)
        {
            var       u          = members.First();
            WoWPlayer bufftarget = new WoWPlayer(u.GetBaseAddress);
            if (!TraceLine.TraceLineGo(bufftarget.Position) && bufftarget.IsAlive)
            {
                ObjectManager.Me.FocusGuid = bufftarget.Guid;
                Extension.HealSpell(spell, false, false, true);
                Logging.Write("Cast" + spell + "on " + bufftarget);
                return(true);
            }
        }
        return(false);
    }
コード例 #2
0
ファイル: MountTask.cs プロジェクト: zneel/TheNoobBot
        public static bool HaveSpaceToMount()
        {
            try
            {
                Memory.WowMemory.GameFrameLock();
                Single degree = 0;
                Point  pos    = ObjectManager.ObjectManager.Me.Position;

                while (degree < 360)
                {
                    //Calculate position on a circle 60 degrees at a time and check if we can go there
                    var x          = (float)(pos.X + 2f * System.Math.Cos(Helpful.Math.DegreeToRadian(degree)));
                    var y          = (float)(pos.Y + 2f * System.Math.Sin(Helpful.Math.DegreeToRadian(degree)));
                    var currTarget = new Point(x, y, pos.Z + 3f);
                    if (TraceLine.TraceLineGo(currTarget, pos, CGWorldFrameHitFlags.HitTestAllButLiquid))
                    {
                        return(false);
                    }
                    degree += 60f; // check 6 angles arrounds 0° > 60° > 120° > 180° > 240° > 300°
                }

                return(true);
            }
            catch (Exception e)
            {
                Logging.WriteError("public static bool HaveSpaceToMount(): " + e);
                return(true);
            }
            finally
            {
                Memory.WowMemory.GameFrameUnLock();
            }
        }
コード例 #3
0
        public MultiTracesCmd(RunnableModule runnableModule, MultiTracesCmdLine multiTracesCmdLine, MeasureHeightCmd mhCmd)
            : base(runnableModule, multiTracesCmdLine)
        {
            this.Valve = multiTracesCmdLine.Valve;
            var structure = runnableModule.CommandsModule.program.ModuleStructure;

            this.multiTracesCmdLine = multiTracesCmdLine;

            foreach (var trace in this.multiTracesCmdLine.Traces)
            {
                TraceBase newTrace = trace.Clone() as TraceBase;
                if (newTrace is TraceLine)
                {
                    TraceLine traceLine = newTrace as TraceLine;
                    traceLine.Start = structure.ToMachine(runnableModule, traceLine.Start);
                    traceLine.End   = structure.ToMachine(runnableModule, traceLine.End);
                }
                else
                {
                    TraceArc traceArc = newTrace as TraceArc;
                    traceArc.Start = structure.ToMachine(runnableModule, traceArc.Start);
                    traceArc.Mid   = structure.ToMachine(runnableModule, traceArc.Mid);
                    traceArc.End   = structure.ToMachine(runnableModule, traceArc.End);
                }
                this.traces.Add(newTrace);
            }

            LineStyle       = multiTracesCmdLine.LineStyle;
            IsWeightControl = multiTracesCmdLine.IsWeightControl;
            wholeWeight     = multiTracesCmdLine.WholeWeight;
            this.OffsetX    = multiTracesCmdLine.OffsetX;
            this.OffsetY    = multiTracesCmdLine.OffsetY;
            this.associatedMeasureHeightCmd = mhCmd;
            //this.CheckRepeat();
        }
コード例 #4
0
ファイル: Extension.cs プロジェクト: Marsbars/AIO-WOTLK
    public static bool TankHealSpell(Spell spell, int setting, int playercount = 0)
    {
        if (!spell.KnownSpell || !spell.IsSpellUsable || !spell.IsDistanceGood)
        {
            return(false);
        }
        var members = Partystuff.getTanks().Where(o => o.IsValid &&
                                                  o.IsAlive &&
                                                  o.HealthPercent <= setting &&
                                                  !TraceLine.TraceLineGo(o.Position)).OrderBy(o => o.HealthPercent);

        if (members.Count() > playercount)
        {
            var       u    = members.First();
            WoWPlayer tank = new WoWPlayer(u.GetBaseAddress);
            if (!TraceLine.TraceLineGo(tank.Position) && tank.IsAlive)
            {
                ObjectManager.Me.FocusGuid = tank.Guid;
                Extension.HealSpell(spell, false, false, true);
                Logging.Write("Cast" + spell + "on " + tank);
                return(true);
            }
        }

        return(false);
    }
コード例 #5
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            if (this.listBoxPoints.SelectedIndex < 0)
            {
                return;
            }
            PointTrace pointTrace = pointsCache[this.listBoxPoints.SelectedIndex];

            if (pointTrace.PointType != TracePointType.End)
            {
                return;
            }

            int index = this.listBoxPoints.SelectedIndex;

            PointTrace pointPrev = pointsCache[this.listBoxPoints.SelectedIndex - 1];
            PointD     newPoint  = (Machine.Instance.Robot.PosXY - origin).ToPoint();
            TraceBase  trace     = this.tracesCache[pointTrace.TraceIndex];

            TraceBase tracePrev;

            if (pointTrace.TraceIndex == 0)
            {
                tracePrev = null;
            }
            else
            {
                tracePrev = this.tracesCache[pointTrace.TraceIndex - 1];
            }

            if (this.rbLine.Checked)
            {
                trace.Start = newPoint.Clone() as PointD;
                TraceLine line;
                if (tracePrev == null)
                {
                    line           = new TraceLine(pointPrev.Point.Clone() as PointD, newPoint.Clone() as PointD);
                    line.LineStyle = trace.LineStyle;
                }
                else
                {
                    line           = new TraceLine(tracePrev.End.Clone() as PointD, newPoint.Clone() as PointD);
                    line.LineStyle = trace.LineStyle;
                }
                this.tracesCache.Insert(pointTrace.TraceIndex, line);
            }
            else
            {
                TraceArc arc = new TraceArc(trace.Start, newPoint, trace.End);
                arc.LineStyle = trace.LineStyle;
                this.tracesCache[pointTrace.TraceIndex] = arc;
            }
            this.updatePointsCache();
            this.LoadLines2ListBox();
            this.LoadPoints2ListBox();

            this.listBoxPoints.SelectedIndex = index + 1;
        }
コード例 #6
0
        // Pull
        public static bool Pull(Cast cast, bool alwaysPull, List <AIOSpell> spells)
        {
            AIOSpell pullSpell = spells.Find(s => s != null && s.IsSpellUsable && s.KnownSpell);

            if (pullSpell == null)
            {
                RangeManager.SetRangeToMelee();
                return(false);
            }

            WoWUnit closestHostileFromTarget = GetClosestHostileFrom(ObjectManager.Target, 20);

            if (closestHostileFromTarget == null && !alwaysPull)
            {
                RangeManager.SetRangeToMelee();
                return(false);
            }

            float pullRange = pullSpell.MaxRange;

            if (ObjectManager.Target.GetDistance > pullRange - 2 ||
                ObjectManager.Target.GetDistance < 6 ||
                TraceLine.TraceLineGo(ObjectManager.Target.Position))
            {
                RangeManager.SetRangeToMelee();
                return(false);
            }

            if (closestHostileFromTarget != null && RangeManager.GetRange() < pullRange)
            {
                Logger.Log($"Pulling from distance (hostile unit {closestHostileFromTarget.Name} is too close)");
            }

            if (ObjectManager.Me.IsMounted)
            {
                MountTask.DismountMount();
            }

            RangeManager.SetRange(pullRange - 1);
            Thread.Sleep(300);

            if (cast.OnTarget(pullSpell))
            {
                Thread.Sleep(500);
                if (pullSpell.GetCurrentCooldown > 0)
                {
                    Usefuls.WaitIsCasting();
                    if (pullSpell.Name == "Shoot" || pullSpell.Name == "Throw" || pullSpell.Name == "Avenger's Shield")
                    {
                        Thread.Sleep(1500);
                    }
                    return(true);
                }
            }

            return(false);
        }
コード例 #7
0
 private static WoWUnit FindEnemy(IEnumerable <WoWUnit> units, Func <WoWUnit, bool> predicate)
 {
     return(units.Where(u =>
                        u.IsAlive &&
                        (int)u.Reaction < 3 &&
                        predicate(u) &&
                        !TraceLine.TraceLineGo(ObjectManager.Me.Position, u.Position, CGWorldFrameHitFlags.HitTestSpellLoS))
            .OrderBy(u => u.GetDistance).FirstOrDefault());
 }
コード例 #8
0
 private static WoWUnit FindEnemy(IEnumerable <WoWUnit> units, Func <WoWUnit, bool> rangePredicate)
 {
     return(units.Where(u =>
                        rangePredicate(u) &&
                        u.IsAlive &&
                        (int)u.Reaction < 3 &&
                        !TraceLine.TraceLineGo(RotationFramework.Me.Position, u.Position, CGWorldFrameHitFlags.HitTestWMO))
            .OrderBy(u => u.GetDistance).FirstOrDefault());
 }
コード例 #9
0
ファイル: Extension.cs プロジェクト: Marsbars/AIO-WOTLK
    //Gives Attackingunits which are Casting, interrupt after 30% Casttime

    public static WoWUnit InterruptableUnit(float distance)
    {
        return(ObjectManager.GetWoWUnitAttackables(distance).Where(x =>
                                                                   x.InCombat &&
                                                                   x.HasTarget &&
                                                                   x.IsCast &&
                                                                   /*x.CanInterruptCasting &&*/
                                                                   (((x.CastingTimeLeft / 1000) / x.CastingSpell.CastTime) * 100) < 70 &&
                                                                   !TraceLine.TraceLineGo(ObjectManager.Me.Position, x.Position, CGWorldFrameHitFlags.HitTestSpellLoS)).OrderBy(x => x.GetDistance).FirstOrDefault());
    }
コード例 #10
0
        public MultiTraces(MultiTracesCmd multiTracesCmd, CoordinateCorrector coordinateCorrector)
        {
            this.RunnableModule = multiTracesCmd.RunnableModule;
            if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode)
            {
                this.Valve = ValveType.Valve1;
            }
            else if (this.RunnableModule.Mode == ModuleMode.DualFallow)
            {
                this.Valve = ValveType.Both;
            }
            else
            {
                this.Valve = ValveType.Valve2;
            }

            foreach (var item in multiTracesCmd.Traces)
            {
                TraceBase newTrace = item.Clone() as TraceBase;
                if (newTrace is TraceLine)
                {
                    TraceLine traceLine = newTrace as TraceLine;
                    traceLine.Start = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceLine.Start, Executor.Instance.Program.ExecutantOriginOffset);
                    traceLine.End   = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceLine.End, Executor.Instance.Program.ExecutantOriginOffset);
                }
                else
                {
                    TraceArc traceArc = newTrace as TraceArc;
                    traceArc.Start = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceArc.Start, Executor.Instance.Program.ExecutantOriginOffset);
                    traceArc.Mid   = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceArc.Mid, Executor.Instance.Program.ExecutantOriginOffset);
                    traceArc.End   = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceArc.End, Executor.Instance.Program.ExecutantOriginOffset);
                }

                //newTrace.Param = multiTracesCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetLineParam(newLine.LineStyle);
                this.traces.Add(newTrace);
                Log.Dprint(string.Format("{0}: {1}", item.GetType(), item));
            }
            //param = multiTracesCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetLineParam(multiTracesCmd.LineStyle);
            isWeightControl     = multiTracesCmd.IsWeightControl;
            wholeWeight         = multiTracesCmd.WholeWeight;
            this.OffsetX        = multiTracesCmd.OffsetX;
            this.OffsetY        = multiTracesCmd.OffsetY;
            Program             = multiTracesCmd.RunnableModule.CommandsModule.Program;
            this.multiTracesCmd = multiTracesCmd;
            if (multiTracesCmd.AssociatedMeasureHeightCmd != null)
            {
                curMeasureHeightValue = multiTracesCmd.AssociatedMeasureHeightCmd.RealHtValue;
            }
            else
            {
                curMeasureHeightValue = this.RunnableModule.MeasuredHt;
            }
        }
コード例 #11
0
        public static void TraceLogInlineEnd(string message)
        {
            if (LogLevel > eTraceType.Info)
            {
                return;
            }
#if NETFX
            try { Trace.WriteLine(message); } catch { }
#elif UNIVERSAL
            try { Debug.WriteLine(message); } catch { }
#endif
            try { TraceLine?.Invoke(eTraceType.Info, message); } catch { }
        }
コード例 #12
0
 public static WoWUnit FindFriend(Func <WoWUnit, bool> predicate)
 {
     if (ObjectManager.Me.HealthPercent < 70)
     {
         return(ObjectManager.Me);
     }
     return(ObjectManager.GetObjectWoWPlayer().Where(u =>
                                                     u.IsAlive &&
                                                     u.Reaction == Reaction.Friendly &&
                                                     predicate(u) &&
                                                     !TraceLine.TraceLineGo(ObjectManager.Me.Position, u.Position, CGWorldFrameHitFlags.HitTestSpellLoS)).
            OrderBy(u => u.HealthPercent).FirstOrDefault());
 }
コード例 #13
0
        public static void TraceError(string message, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberNameAttribute] string method = "")
        {
            if (LogLevel > eTraceType.Error)
            {
                return;
            }
#if NETFX
#if DEBUG
            try { var p = Path.GetFileName(filePath); } catch { Debug.Assert(false, "Invalid Log message"); };
#endif
            try { Trace.WriteLine(String.Format("{0} ERROR {1} [{2}:{3}] :: {4}", DateTime.Now, Path.GetFileName(filePath), method, lineNumber, message)); } catch { }
#elif UNIVERSAL
            try { Debug.WriteLine(String.Format("{0} ERROR {1} [{2}:{3}] :: {4}", DateTime.Now, Path.GetFileName(filePath), method, lineNumber, message)); } catch { }
#endif
            try { TraceLine?.Invoke(eTraceType.Error, String.Format("{0} ERROR {1} [{2}:{3}] :: {4}", DateTime.Now, Path.GetFileName(filePath), method, lineNumber, message)); } catch { }
        }
コード例 #14
0
        public static WoWUnit FindFriend(Func <WoWUnit, bool> predicate)
        {
            if (RotationFramework.Me.HealthPercent < 60)
            {
                return(RotationFramework.Me);
            }

            return(RotationFramework.Units
                   .Where(u =>
                          u.IsAlive &&
                          u.Reaction == Reaction.Friendly &&
                          predicate(u) &&
                          !TraceLine.TraceLineGo(u.Position))
                   .OrderBy(u => u.HealthPercent)
                   .FirstOrDefault());
        }
コード例 #15
0
ファイル: WarriorTank.cs プロジェクト: QiMata/WoWBot
        protected override void PullNextMob()
        {
            var closestHostile = ObjectManager.GetWoWUnitHostile()
                                 .Where(x => !x.IsDead &&
                                        !TraceLine.TraceLineGo(ObjectManager.Me.Position, x.Position, CGWorldFrameHitFlags.HitTestSpellLoS))
                                 .OrderBy(x => x.GetDistance2D)
                                 .FirstOrDefault();

            if (closestHostile == null)
            {
                return;
            }

            closestHostile.TargetEnemy();
            MovementManager.Face(closestHostile);
            MovementManager.StopMove();
            SpellManager.CastSpellByNameLUA("Shoot Crossbow");
        }
コード例 #16
0
        public static void TraceErrorException(Exception ex, string message = null, bool reportIt = true, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberNameAttribute] string method = "")
        {
            if (LogLevel > eTraceType.Critical)
            {
                return;
            }
#if DEBUG
            try { var p = Path.GetFileName(filePath); } catch { Debug.Assert(false, "Invalid Log message"); };
#endif
            var fileName = Path.GetFileName(filePath);
            var failure  = new YIncident()
            {
                FilePath = filePath, FileName = fileName, LineNumber = lineNumber, Method = method
            };
            failure.StackTrace = new StackTrace(ex, true);
            if (message != null)
            {
                failure.Messages.Add(message);
            }

#if NETFX
            try { Trace.WriteLine("Exception caught!" + (message == null ? "" : " Msg: " + message) + " Stack trace: " + ex.StackTrace + "" + Environment.NewLine); } catch { }
#elif UNIVERSAL
            try { Debug.WriteLine("Exception caught! Stack trace: " + ex.StackTrace + "" + Environment.NewLine); } catch { }
#endif
            try { TraceLine?.Invoke(eTraceType.Error, "Exception caught! Stack trace: " + ex.StackTrace + "" + Environment.NewLine); } catch { }

            while (ex != null)
            {
                failure.Messages.Add(ex.Message);
#if NETFX
                try { Trace.WriteLine(String.Format("{0} ERROR {1} [{2}:{3}] :: {4}", DateTime.Now, fileName, method, lineNumber, "Exception : " + ex.Message + "" + Environment.NewLine)); } catch { }
#elif UNIVERSAL
                Debug.WriteLine(String.Format("{0} ERROR {1} [{2}:{3}] :: {4}", DateTime.Now, fileName, method, lineNumber, "Exception : " + ex.Message + "" + Environment.NewLine));
#endif
                try { TraceLine?.Invoke(eTraceType.Error, String.Format("{0} ERROR {1} [{2}:{3}] :: {4}", DateTime.Now, fileName, method, lineNumber, "Exception : " + ex.Message + "" + Environment.NewLine)); } catch { }
                ex = ex.InnerException;
            }

            if (reportIt)
            {
                ThrowYIncident?.Invoke(failure);
            }
        }
コード例 #17
0
        private void btnTeachEnd_Click(object sender, EventArgs e)
        {
            tbEndX.Text = (Machine.Instance.Robot.PosX - origin.X).ToString("0.000");
            tbEndY.Text = (Machine.Instance.Robot.PosY - origin.Y).ToString("0.000");
            if (!tbEndX.IsValid || !tbEndY.IsValid)
            {
                //MessageBox.Show("Please input valid values.");
                MessageBox.Show("请输入正确的值.");
                return;
            }
            //机械坐标->系统坐标
            this.tempEndPoint = pattern.SystemRel(tbEndX.Value, tbEndY.Value);
            if (hasSamePoints())
            {
                MessageBox.Show("存在相同点,请检查.");
                return;
            }
            TraceBase newTrace = null;

            if (this.rbLine.Checked)
            {
                newTrace = new TraceLine(this.tempStartPoint.Clone() as PointD, this.tempEndPoint.Clone() as PointD);
            }
            else
            {
                newTrace = new TraceArc(this.tempStartPoint.Clone() as PointD, this.tempMidPoint.Clone() as PointD, this.tempEndPoint.Clone() as PointD);
            }
            newTrace.LineStyle = this.comboBoxLineType.SelectedIndex;
            this.tracesCache.Add(newTrace);
            this.updatePointsCache();
            this.LoadLines2ListBox();
            this.LoadPoints2ListBox();
            listBoxLines.SelectedIndex  = listBoxLines.Items.Count - 1;
            listBoxPoints.SelectedIndex = listBoxPoints.Items.Count - 1;
            // 本段终点为下一段轨迹的起点
            this.tempStartPoint.X = this.tempEndPoint.X;
            this.tempStartPoint.Y = this.tempEndPoint.Y;
            this.tbStartX.Text    = this.tempStartPoint.X.ToString("0.000");
            this.tbStartY.Text    = this.tempStartPoint.Y.ToString("0.000");
            this.tbMidX.Text      = this.tempMidPoint.X.ToString("0.000");
            this.tbMidY.Text      = this.tempMidPoint.Y.ToString("0.000");
        }
コード例 #18
0
        public static void TraceWarning(Exception ex, string message, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberNameAttribute] string method = "")
        {
            if (LogLevel > eTraceType.Warning)
            {
                return;
            }
#if DEBUG
            try { var p = Path.GetFileName(filePath); } catch { Debug.Assert(false, "Invalid Log message"); };
#endif
            //two spaces after warn not a typo
            while (ex != null)
            {
                var stack = ex.StackTrace;
#if NETFX
                try { Trace.WriteLine(String.Format("{0} Warn  {1} [{2}:{3}] :: {4}", DateTime.Now, Path.GetFileName(filePath), method, lineNumber, message + " (" + ex.Message + ")" + Environment.NewLine + "StackTrace : " + stack)); } catch { }
#elif UNIVERSAL
                try { Debug.WriteLine(String.Format("{0} Warn  {1} [{2}:{3}] :: {4}", DateTime.Now, Path.GetFileName(filePath), method, lineNumber, message + " (" + ex.Message + ")" + Environment.NewLine + "StackTrace : " + stack)); } catch { }
#endif
                try { TraceLine?.Invoke(eTraceType.Warning, String.Format("{0} Warn  {1} [{2}:{3}] :: {4}", DateTime.Now, Path.GetFileName(filePath), method, lineNumber, message + " (" + ex.Message + ")" + Environment.NewLine + "StackTrace : " + stack)); } catch { }
                ex = ex.InnerException;
            }
        }
コード例 #19
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.listBoxPoints.SelectedIndex < 0)
            {
                return;
            }
            PointTrace pointTrace = pointsCache[this.listBoxPoints.SelectedIndex];
            TraceBase  trace      = this.tracesCache[pointTrace.TraceIndex];
            TraceBase  traceNext  = null;
            TraceBase  traceNew   = null;

            if (pointTrace.PointType == TracePointType.End)
            {
                // 删除连接点,则同时删除2条相邻轨迹,用一条直线轨迹替代
                if (this.tracesCache.Count - 1 >= pointTrace.TraceIndex + 1)
                {
                    traceNext          = this.tracesCache[pointTrace.TraceIndex + 1];
                    traceNew           = new TraceLine(trace.Start, traceNext.End);
                    traceNew.LineStyle = trace.LineStyle;
                }
                this.tracesCache.Remove(trace);
                if (traceNext != null)
                {
                    this.tracesCache.Remove(traceNext);
                    this.tracesCache.Insert(pointTrace.TraceIndex, traceNew);
                }
            }
            else if (pointTrace.PointType == TracePointType.Mid)
            {
                traceNew           = new TraceLine(trace.Start, trace.End);
                traceNew.LineStyle = trace.LineStyle;
                this.tracesCache.Remove(trace);
                this.tracesCache.Insert(pointTrace.TraceIndex, traceNew);
            }
            this.updatePointsCache();
            this.LoadLines2ListBox();
            this.LoadPoints2ListBox();
        }
コード例 #20
0
        public MultiTracesDrawCmd(List <TraceBase> traces, bool enable)
        {
            for (int i = 0; i < traces.Count; i++)
            {
                if (traces[i] is TraceLine)
                {
                    TraceLine line       = (TraceLine)traces[i];
                    PointF[]  linePoints = new PointF[2];
                    PointF    lineStart  = DrawingUtils.Instance.CoordinateTrans(new PointF((float)line.Start.X, (float)line.Start.Y));
                    PointF    lineEnd    = DrawingUtils.Instance.CoordinateTrans(new PointF((float)line.End.X, (float)line.End.Y));
                    linePoints[0] = lineStart;
                    linePoints[1] = lineEnd;
                    this.linesData.Add(linePoints);
                }
                else if (traces[i] is TraceArc)
                {
                    TraceArc traceArc  = (TraceArc)traces[i];
                    PointF[] arcPoints = new PointF[3];
                    PointF   arcStart  = DrawingUtils.Instance.CoordinateTrans(new PointF((float)traceArc.Start.X, (float)traceArc.Start.Y));
                    PointF   arcCenter = DrawingUtils.Instance.CoordinateTrans(new PointF((float)traceArc.Center.X, (float)traceArc.Center.Y));
                    PointF   arcEnd    = DrawingUtils.Instance.CoordinateTrans(new PointF((float)traceArc.End.X, (float)traceArc.End.Y));
                    arcPoints[0] = arcStart;
                    arcPoints[1] = arcCenter;
                    arcPoints[2] = arcEnd;

                    float degree = (float)traceArc.Degree;
                    this.arcsData.Add(new Tuple <PointF[], float>(arcPoints, degree));
                }

                if (i == traces.Count - 1 && traces[i] is TraceLine)
                {
                    this.lastTrackIsLine = true;
                }
            }

            this.enable = enable;
            this.SetTrack(new PointF(0, 0), Properties.Settings.Default.TrackNormalColor);
        }
コード例 #21
0
    private void Purifying()
    {
        var members = getPartymembers().Where(o => !TraceLine.TraceLineGo(o.Position)).OrderBy(o => o.HealthPercent);

        if (members.Count() > 0)
        {
            var       u          = members.First();
            WoWPlayer healTarget = new WoWPlayer(u.GetBaseAddress);
            if (!TraceLine.TraceLineGo(healTarget.Position) && healTarget.IsAlive)
            {
                //Interact.InteractGameObject(healTarget.GetBaseAddress, false);
                if (Lua.LuaDoString <bool>("for j=1,40 do local m=5; local d={UnitDebuff(\"{healTarget}\",j)}; if (d[5]==\"Poison\" or d[5]==\"Disease\") and d[7]>m then j=41 return 1 end end;"))
                {
                    ObjectManager.Me.FocusGuid = healTarget.Guid;
                    Extension.HealSpell(Purify, false, false, true);
                    Logging.WriteDebug("Purified " + healTarget.Name);
                    return;
                }
                return;
            }
        }
        return;
    }
コード例 #22
0
            public void Read()
            {
                try
                {
                    do
                    {
                        if (cancelTS.Token.IsCancellationRequested)
                        {
                            //Debug.WriteLine("Request to cancel Task received.");
                            break;
                        }

                        NativeMethods.SetEvent(_bufferReadyEvent);
                        uint wait = NativeMethods.WaitForSingleObject(_dataReadyEvent, WaitTimeout);
                        if (stop)
                        {
                            return;
                        }

                        if (!Enabled)
                        {
                            continue;
                        }

                        if (wait == WAIT_OBJECT_0) // we don't care about other return values
                        {
                            int    pid  = Marshal.ReadInt32(_file);
                            string text = Marshal.PtrToStringAnsi(new IntPtr(_file.ToInt64() + Marshal.SizeOf(typeof(int)))).TrimEnd(null);
                            if (string.IsNullOrEmpty(text))
                            {
                                continue;
                            }

                            TraceLine line = new TraceLine();
                            line.Index       = _id++;
                            line.Pid         = pid;
                            line.ProcessName = GetProcessName(line.Pid);
                            line.Text        = text;

                            if (!_watch.IsRunning)
                            {
                                _watch.Start();
                                // small hack; we ensure the first has 0 ticks
                                line.Ticks = 0;
                            }
                            else
                            {
                                line.Ticks = _watch.ElapsedTicks;
                            }

                            if (FilterPID > 0 && pid == FilterPID)
                            {
                                if (ToolWindowControl.RedirectToLog)
                                {
                                    TraceSpyLogger.Instance.WriteLine(line.ToString());
                                }
                                else
                                {
                                    Queue.Add(line);
                                }
                            }
                            else if (FilterPID == 0)
                            {
                                if (ToolWindowControl.RedirectToLog)
                                {
                                    TraceSpyLogger.Instance.WriteLine(line.ToString());
                                }
                                else
                                {
                                    Queue.Add(line);
                                }
                            }
                        }
                    }while (true);
                }
                catch
                {
                }
            }
コード例 #23
0
ファイル: IsAttacked.cs プロジェクト: zneel/TheNoobBot
 public void StrikeFirst()
 {
     if (_stealthSpell == null)
     {
         _stealthSpell = new Spell("Stealth");
     }
     if (_prowlSpell == null)
     {
         _prowlSpell = new Spell("Prowl");
     }
     if (IgnoreStrikeBackCreatureList.Count <= 0)
     {
         Logging.Write("Loading IgnoreStrikeBackCreatureList...");
         string[] forceLootCreatureList = Others.ReadFileAllLines(Application.StartupPath + "\\Data\\IgnoreStrikeBackCreatureList.txt");
         for (int i = 0; i <= forceLootCreatureList.Length - 1; i++)
         {
             int creatureId = Others.ToInt32(forceLootCreatureList[i]);
             if (creatureId > 0 && !IgnoreStrikeBackCreatureList.Contains(creatureId))
             {
                 IgnoreStrikeBackCreatureList.Add(creatureId);
             }
         }
         if (IgnoreStrikeBackCreatureList.Count > 0)
         {
             Logging.Write("Loaded " + IgnoreStrikeBackCreatureList.Count + " creatures to ignore in Strike Back system.");
         }
     }
     while (Products.Products.IsStarted)
     {
         Thread.Sleep(1500); // no need to spam, this is supposed to be more "human", and human have brainlag anyway.
         if (Fight.InFight)
         {
             continue;
         }
         if (Usefuls.BadBottingConditions)
         {
             continue;
         }
         if ((ObjectManager.ObjectManager.Me.IsMounted && (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying)))
         {
             continue;
         }
         if (_stealthSpell.HaveBuff || _prowlSpell.HaveBuff)
         {
             continue;
         }
         if (ObjectManager.ObjectManager.Me.HealthPercent <= 40)
         {
             continue;
         }
         if (ObjectManager.ObjectManager.Me.GetDurability <= nManagerSetting.CurrentSetting.RepairWhenDurabilityIsUnderPercent)
         {
             continue;
         }
         WoWUnit unit = ObjectManager.ObjectManager.GetUnitInAggroRange();
         if (unit == null || !unit.IsValid || unit.IsDead || nManagerSetting.IsBlackListedZone(unit.Position) && unit.GetDistance > 10f)
         {
             continue;
         }
         if (unit.InCombat || unit.IsTrivial)
         {
             continue;
         }
         if (IgnoreStrikeBackCreatureList.Contains(unit.Entry))
         {
             continue;
         }
         if (unit.IsElite && System.Math.Abs(ObjectManager.ObjectManager.Me.Level - unit.Level) < 0 || System.Math.Abs(ObjectManager.ObjectManager.Me.Level - unit.Level) < -6)
         {
             //nManagerSetting.AddBlackListZone(unit.Position, 15f);
             continue; // automatically add potentially dangerous target location to blacklist to avoid suiciding farming near an elite.
         }
         if (unit.Health > (ObjectManager.ObjectManager.Me.Health * 15))
         {
             continue;
         }
         if (TraceLine.TraceLineGo(ObjectManager.ObjectManager.Me.Position, unit.Position, CGWorldFrameHitFlags.HitTestAllButLiquid))
         {
             continue;
         }
         if (unit.GetMove) // only decide to attack if the unit move towards us or patrol.
         {
             _unitToPull = unit;
         }
     }
 }
コード例 #24
0
        // Approach spell target
        private void ApproachSpellTarget()
        {
            Timer limit = new Timer(10000);

            if (CurrentSpellTarget != null)
            {
                Logger.Log($"Approaching {CurrentSpellTarget.Name} to cast {CurrentSpell.Name} ({CurrentSpellTarget.GetDistance}/{CurrentSpell.MaxRange}");
                MovementManager.Go(PathFinder.FindPath(CurrentSpellTarget.Position), false);
                Thread.Sleep(1000);
                while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                       !limit.IsReady &&
                       (CurrentSpellTarget.IsAlive || CurrentSpell.OnDeadTarget) &&
                       (CurrentSpellTarget.GetDistance > CurrentSpell.MaxRange - 2 || TraceLine.TraceLineGo(CurrentSpellTarget.Position)))
                {
                    Thread.Sleep(100);
                }
                MovementManager.StopMoveNewThread();
            }
            else if (CurrentSpellLocation != null)
            {
                Logger.Log($"Approaching {CurrentSpellLocation} to cast {CurrentSpell.Name}");
                MovementManager.Go(PathFinder.FindPath(CurrentSpellLocation), false);
                Thread.Sleep(1000);
                while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                       !limit.IsReady &&
                       (CurrentSpellLocation.DistanceTo(ObjectManager.Me.Position) > CurrentSpell.MaxRange - 2))
                {
                    Thread.Sleep(100);
                }
                MovementManager.StopMoveNewThread();
            }
        }
コード例 #25
0
        public bool AdvancedCast(AIOSpell spell, bool stopWandAndCast = true, bool onSelf = false, WoWUnit onUnitFocus = null, Vector3 location = null)
        {
            WoWUnit Me     = ObjectManager.Me;
            float   buffer = 600;

            if (IsApproachingTarget)
            {
                return(true);
            }

            CurrentSpell         = spell;
            CurrentSpellLocation = location;

            CombatDebug("*----------- INTO PRE CAST FOR " + CurrentSpell.Name);

            if (!CurrentSpell.KnownSpell ||
                IsBackingUp ||
                Me.CastingTimeLeft > buffer ||
                !CurrentSpell.IsForcedCooldownReady ||
                Me.IsStunned)
            {
                return(false);
            }

            // Define target
            if (onUnitFocus != null)
            {
                CurrentSpellTarget = onUnitFocus;
            }
            else if (CurrentSpellLocation != null)
            {
                CurrentSpellTarget = null;
            }
            else if (onSelf)
            {
                CurrentSpellTarget = ObjectManager.Me;
            }
            else
            {
                if (CurrentSpell.MaxRange <= 0 && ObjectManager.Target.GetDistance > RangeManager.GetMeleeRangeWithTarget())
                {
                    return(false);
                }
                CurrentSpellTarget = ObjectManager.Target;
            }

            // Now that we know the target
            if (CurrentSpellLocation == null)
            {
                if (CurrentSpellTarget == null ||
                    CurrentSpellTarget.GetDistance > 100 ||
                    (CurrentSpellTarget.IsDead && !CurrentSpell.OnDeadTarget) ||
                    (CurrentSpell.MinRange > 0 && CurrentSpellTarget.GetDistance <= CurrentSpell.MinRange) ||
                    UnitImmunities.Contains(CurrentSpellTarget, CurrentSpell.Name) ||
                    (!CurrentSpellTarget.IsValid && !CurrentSpell.OnDeadTarget))    // double check this
                {
                    return(false);
                }
            }

            CombatDebug("*----------- INTO CAST FOR " + CurrentSpell.Name);

            // CHECK COST
            if (CurrentSpell.PowerType == -2 && Me.Health < CurrentSpell.Cost)
            {
                CombatDebug($"{CurrentSpell.Name}: Not enough health {CurrentSpell.Cost}/{Me.Health}, SKIPPING");
                return(false);
            }
            else if (CurrentSpell.PowerType == 0 && Me.Mana < CurrentSpell.Cost)
            {
                CombatDebug($"{CurrentSpell.Name}: Not enough mana {CurrentSpell.Cost}/{Me.Mana}, SKIPPING");
                return(false);
            }
            else if (CurrentSpell.PowerType == 1 && Me.Rage < CurrentSpell.Cost)
            {
                CombatDebug($"{CurrentSpell.Name}: Not enough rage {CurrentSpell.Cost}/{Me.Rage}, SKIPPING");
                return(false);
            }
            else if (CurrentSpell.PowerType == 2 && ObjectManager.Pet.Focus < CurrentSpell.Cost)
            {
                CombatDebug($"{CurrentSpell.Name}: Not enough pet focus {CurrentSpell.Cost}/{ObjectManager.Pet.Focus}, SKIPPING");
                return(false);
            }
            else if (CurrentSpell.PowerType == 3 && Me.Energy < CurrentSpell.Cost)
            {
                CombatDebug($"{CurrentSpell.Name}: Not enough energy {CurrentSpell.Cost}/{Me.Energy}, SKIPPING");
                return(false);
            }

            // DON'T CAST BECAUSE WANDING
            if (WandSpell != null &&
                ToolBox.UsingWand() &&
                !stopWandAndCast)
            {
                CombatDebug("Didn't cast because we were wanding");
                return(false);
            }

            // COOLDOWN CHECKS
            float _spellCD = CurrentSpell.GetCurrentCooldown;

            CombatDebug($"Cooldown is {_spellCD}");

            if (_spellCD >= 500)
            {
                CombatDebug("Didn't cast because cd is too long");
                return(false);
            }

            // STOP WAND FOR CAST
            if (WandSpell != null &&
                ToolBox.UsingWand() &&
                stopWandAndCast)
            {
                StopWandWaitGCD(WandSpell);
            }


            // Wait for remaining Cooldown
            if (_spellCD > 0f && _spellCD < buffer)
            {
                CombatDebug($"{CurrentSpell.Name} is almost ready, waiting");
                while (CurrentSpell.GetCurrentCooldown > 0 && CurrentSpell.GetCurrentCooldown < 500)
                {
                    Thread.Sleep(50);
                }
                Thread.Sleep(50); // safety
            }

            if (!CurrentSpell.IsSpellUsable)
            {
                CombatDebug("Didn't cast because spell somehow not usable");
                return(false);
            }

            bool stopMove = CurrentSpell.CastTime > 0 || CurrentSpell.IsChannel;

            if (CurrentSpellLocation != null || CurrentSpellTarget.Guid != Me.Guid)
            {
                Vector3 spellPosition = CurrentSpellLocation != null ? CurrentSpellLocation : CurrentSpellTarget.Position;
                if (CurrentSpell.MaxRange > 0 && spellPosition.DistanceTo(Me.Position) > CurrentSpell.MaxRange || TraceLine.TraceLineGo(spellPosition))
                {
                    if (Me.HaveBuff("Spirit of Redemption"))
                    {
                        return(false);
                    }

                    Logger.LogFight($"Target not in range/sight, recycling {CurrentSpell.Name}");

                    if (Fight.InFight)
                    {
                        IsApproachingTarget = true;
                    }
                    else
                    {
                        ApproachSpellTarget();
                    }

                    return(true);
                }
            }

            if (onUnitFocus != null)
            {
                ObjectManager.Me.FocusGuid = CurrentSpellTarget.Guid;
            }

            string unit = onUnitFocus != null ? "focus" : "target";

            unit = onSelf || CurrentSpellLocation != null ? "player" : unit;

            // Wait for remaining cast in case of buffer
            while (Me.CastingTimeLeft > 0)
            {
                Thread.Sleep(25);
            }

            if (stopMove)
            {
                MovementManager.StopMoveNewThread();
            }

            if (CombatLogON)
            {
                string rankString = CurrentSpell.Rank > 0 ? $"(Rank {CurrentSpell.Rank})" : "";
                string target     = CurrentSpellLocation != null?CurrentSpellLocation.ToString() : CurrentSpellTarget.Name;

                Logger.Log($"[Spell] Casting {CurrentSpell.Name.Replace("()", "")} {rankString} on {target}");
            }

            CurrentSpell.Launch(stopMove, false, true, unit);

            if (CurrentSpell.IsClickOnTerrain)
            {
                ClickOnTerrain.Pulse(CurrentSpellLocation);
            }

            Thread.Sleep(50);

            ToolBox.ClearCursor();

            // Wait for channel to end
            if (CurrentSpell.IsChannel)
            {
                CombatDebug($"{CurrentSpell.Name} is channel, wait cast");
                while (ToolBox.GetChannelTimeLeft("player") < 0)
                {
                    Thread.Sleep(50);
                }

                CurrentSpell.StartForcedCooldown();
                return(true);
            }

            // Wait for instant cast GCD
            if (CurrentSpell.CastTime <= 0)
            {
                CurrentSpell.StartForcedCooldown();
                Timer gcdLimit = new Timer(1500);
                CombatDebug($"{CurrentSpell.Name} is instant, wait GCD");
                while (DefaultBaseSpell.GetCurrentCooldown > buffer && !gcdLimit.IsReady)
                {
                    Thread.Sleep(50);
                }

                if (gcdLimit.IsReady)
                {
                    Logger.LogError("We had to resort to timer wait (GCD)");
                }

                return(true);
            }

            if (CurrentSpell.CastTime > 0)
            {
                // Wait for cast to end
                buffer = CurrentSpell.PreventDoubleCast ? 0 : buffer;
                CombatDebug($"{CurrentSpell.Name} is normal, wait until {buffer} left");
                while (Me.CastingTimeLeft > buffer)
                {
                    if (CurrentSpell.IsResurrectionSpell && CurrentSpellTarget.IsAlive)
                    {
                        Lua.RunMacroText("/stopcasting");
                    }

                    Thread.Sleep(50);
                }
                CurrentSpell.StartForcedCooldown();
            }

            return(true);
        }
        protected override void BuffRotation()
        {
            if (!Me.HaveBuff("Drink") || Me.ManaPercentage > 95)
            {
                base.BuffRotation();

                // Unending Breath
                if (!Me.HaveBuff("Unending Breath") &&
                    settings.UseUnendingBreath &&
                    cast.OnSelf(UnendingBreath))
                {
                    return;
                }

                // Demon Skin
                if (!Me.HaveBuff("Demon Skin") &&
                    !DemonArmor.KnownSpell &&
                    !FelArmor.KnownSpell &&
                    cast.OnSelf(DemonSkin))
                {
                    return;
                }

                // Demon Armor
                if ((!Me.HaveBuff("Demon Armor")) &&
                    !FelArmor.KnownSpell &&
                    cast.OnSelf(DemonArmor))
                {
                    return;
                }

                // Fel Armor
                if (!Me.HaveBuff("Fel Armor") &&
                    cast.OnSelf(FelArmor))
                {
                    return;
                }

                // Health Funnel OOC
                if (ObjectManager.Pet.HealthPercent < 50 &&
                    Me.HealthPercent > 40 &&
                    ObjectManager.Pet.GetDistance < 19 &&
                    !ObjectManager.Pet.InCombatFlagOnly &&
                    settings.HealthFunnelOOC)
                {
                    Lua.LuaDoString("PetWait();");
                    MovementManager.StopMove();
                    Fight.StopFight();

                    if (WarlockPetAndConsumables.MyWarlockPet().Equals("Voidwalker"))
                    {
                        cast.PetSpell("Consume Shadows", false, true);
                    }

                    if (cast.OnSelf(HealthFunnel))
                    {
                        Thread.Sleep(500);
                        Usefuls.WaitIsCasting();
                        Lua.LuaDoString("PetFollow();");
                        return;
                    }
                    Lua.LuaDoString("PetFollow();");
                }

                // Health Stone
                if (!WarlockPetAndConsumables.HaveHealthstone() &&
                    cast.OnSelf(CreateHealthStone))
                {
                    return;
                }

                // Create Soul Stone
                if (!WarlockPetAndConsumables.HaveSoulstone() &&
                    cast.OnSelf(CreateSoulstone))
                {
                    return;
                }

                // PARTY Soul Stone
                if (CreateSoulstone.KnownSpell &&
                    ToolBox.HaveOneInList(WarlockPetAndConsumables.SoulStones()) &&
                    ToolBox.GetItemCooldown(WarlockPetAndConsumables.SoulStones()) <= 0)
                {
                    WoWPlayer noSoulstone = AIOParty.GroupAndRaid
                                            .Find(m => !m.HaveBuff("Soulstone Resurrection") &&
                                                  m.GetDistance < 20 &&
                                                  m.Name != "Unknown" &&
                                                  !TraceLine.TraceLineGo(Me.Position, m.Position) &&
                                                  (m.WowClass == WoWClass.Paladin || m.WowClass == WoWClass.Priest || m.WowClass == WoWClass.Shaman || m.WowClass == WoWClass.Druid));
                    if (noSoulstone != null)
                    {
                        Logger.Log($"Using Soulstone on {noSoulstone.Name}");
                        MovementManager.StopMoveNewThread();
                        MovementManager.StopMoveToNewThread();
                        Lua.RunMacroText($"/target {noSoulstone.Name}");
                        if (ObjectManager.Target.Name == noSoulstone.Name)
                        {
                            ToolBox.UseFirstMatchingItem(WarlockPetAndConsumables.SoulStones());
                            Usefuls.WaitIsCasting();
                            Lua.RunMacroText("/cleartarget");
                            ToolBox.ClearCursor();
                        }
                    }
                }

                // PARTY Drink
                if (AIOParty.PartyDrink(settings.PartyDrinkName, settings.PartyDrinkThreshold))
                {
                    return;
                }

                // Life Tap
                if (Me.HealthPercent > Me.ManaPercentage &&
                    settings.UseLifeTap &&
                    cast.OnSelf(LifeTap))
                {
                    return;
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// Open a port, open an OpenPort, or create a mock ECU stream.
        /// </summary>
        /// <param name="portName">COM port name, passthru DLL name, or "Mock ECU".</param>
        /// <param name="baudRate">Baud rate to use for COM port.</param>
        /// <returns>Stream.</returns>
        public static Stream GetDataStream(
            string portName,
            int baudRate,
            ref SerialPort port,
            TraceLine traceLine)
        {
            if (portName == SsmUtility.MockEcuDisplayName)
            {
                MockEcuStream.Image = new EcuImage2F12785206();
                return(MockEcuStream.CreateInstance());
            }

            if (SsmUtility.OpenPort20DisplayName.Equals(portName, StringComparison.OrdinalIgnoreCase))
            {
                portName = SsmUtility.OpenPort20PortName;
            }

            if (portName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
            {
                PassThruStream passThruStream = PassThruStream.GetInstance(portName);
                passThruStream.OpenSsmChannel();
                return(passThruStream);
            }

            Stream stream = null;

            if (port == null)
            {
                traceLine("SsmUtility.GetDataStream: Creating port.");
                port              = new SerialPort(portName, baudRate, Parity.None, 8);
                port.ReadTimeout  = 500;
                port.WriteTimeout = 500;
            }

            if (port.IsOpen)
            {
                traceLine("SsmUtility.GetDataStream: Port already open, draining input queue...");
                int bytesToRead = 0;
                while ((bytesToRead = port.BytesToRead) > 0)
                {
                    Trace.WriteLine("SsmUtility.GetDataStream: " + bytesToRead.ToString(CultureInfo.InvariantCulture) + " bytes in queue, reading...");
                    byte[] buffer = new byte[bytesToRead];
                    port.Read(buffer, 0, buffer.Length);
                    traceLine("SsmUtility.GetDataStream: Read completed.");
                    Thread.Sleep(500);
                }
            }
            else
            {
                traceLine("SsmUtility.GetDataStream: Port not open.");

                bool exists = false;
                foreach (string name in System.IO.Ports.SerialPort.GetPortNames())
                {
                    if (string.Compare(name, port.PortName, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        traceLine("SsmUtility.GetDataStream: Port " + name + " exists.");
                        exists = true;
                        break;
                    }
                }

                if (exists)
                {
                    port.Open();
                    Trace.WriteLine("SsmUtility.GetDataStream: Port opened.");
                }
                else
                {
                    string message = "Port " + port.PortName + " does not exist.";
                    throw new IOException(message);
                }
            }

            stream = port.BaseStream;
            Trace.WriteLine("SsmUtility.GetDataStream: Input queue drained, returning stream.");
            return(stream);
        }
コード例 #28
0
ファイル: ArchaeologyStates.cs プロジェクト: zneel/TheNoobBot
 private bool IsPointOutOfWater(Point p)
 {
     return(!TraceLine.TraceLineGo(new Point(p.X, p.Y, p.Z + 1000), p, Enums.CGWorldFrameHitFlags.HitTestLiquid));
 }
コード例 #29
0
ファイル: ArchaeologyStates.cs プロジェクト: zneel/TheNoobBot
        public override void Run()
        {
            try
            {
                if (MovementManager.InMovement)
                {
                    return;
                }

                // Get if this zone is last zone
                if (LastZone != digsitesZone.id)
                {
                    _nbTryFarmInThisZone = 0; // Reset nb try farm if zone is not last zone
                }
                LastZone = digsitesZone.id;   // Set lastzone

                // Solving Every X Min
                if (timerAutoSolving == null)
                {
                    timerAutoSolving = new Timer(SolvingEveryXMin * 1000 * 60);
                }
                if (timerAutoSolving.IsReady && !ObjectManager.ObjectManager.Me.IsDeadMe &&
                    !ObjectManager.ObjectManager.Me.InCombat)
                {
                    MovementManager.StopMove();
                    LongMove.StopLongMove();
                    if (Archaeology.SolveAllArtifact(UseKeystones) > 0)
                    {
                        if (CrateRestored)
                        {
                            Archaeology.CrateRestoredArtifact();
                        }
                    }
                    timerAutoSolving = new Timer(SolvingEveryXMin * 1000 * 60);
                }

                if (MovementManager.InMovement)
                {
                    return;
                }

                // Loop farm in zone // We must check Me.IsIndoor because no archeology is indoor
                int nbStuck = 0; // Nb of stuck direct
                try
                {
                    if (myState != LocState.LocalMove)
                    {
                        MountTask.DismountMount();
                    }

                    ObjectManager.WoWGameObject t =
                        ObjectManager.ObjectManager.GetNearestWoWGameObject(
                            ObjectManager.ObjectManager.GetWoWGameObjectByEntry(Archaeology.ArchaeologyItemsFindList));
                    if (t.IsValid) // If found then loot
                    {
                        nbCastSurveyError  = 0;
                        _lastGreenPosition = new Point();
                        _AntiPingPong      = false;
                        _greenCount        = 0;
                        if (myState == LocState.Looting)
                        {
                            if (timerLooting != null && timerLooting.IsReady)
                            {
                                MovementsAction.Jump();
                                Thread.Sleep(1500);
                            }
                            else
                            {
                                return;
                            }
                        }
                        bool         ValidPath;
                        List <Point> points = PathFinder.FindPath(t.Position, out ValidPath, false);
                        if (!ValidPath)
                        {
                            points.Add(t.Position);
                        }
                        MovementManager.Go(points);
                        if (nbLootAttempt > 2)
                        {
                            MovementManager.StopMove();
                            LongMove.StopLongMove();
                            if (Archaeology.SolveAllArtifact(UseKeystones) == 0)
                            {
                                nManagerSetting.AddBlackList(t.Guid); // bugged artifacts not lootable
                                Logging.Write("Black-listing bugged artifact");
                            }
                            else if (CrateRestored)
                            {
                                Archaeology.CrateRestoredArtifact();
                            }
                            nbLootAttempt = 0;
                            return;
                        }
                        Logging.Write("Loot " + t.Name);
                        Timer timer = new Timer(1000 * Math.DistanceListPoint(points) / 3);

                        while (MovementManager.InMovement && !timer.IsReady && t.GetDistance > 3.5f)
                        {
                            Thread.Sleep(100);
                            if (ObjectManager.ObjectManager.Me.InInevitableCombat || ObjectManager.ObjectManager.Me.IsDeadMe)
                            {
                                return;
                            }
                        }
                        MovementManager.StopMove(); // avoid a red wow error
                        Thread.Sleep(150);
                        Interact.InteractWith(t.GetBaseAddress);
                        while (ObjectManager.ObjectManager.Me.IsCast)
                        {
                            Thread.Sleep(100);
                        }
                        if (ObjectManager.ObjectManager.Me.InCombat)
                        {
                            return;
                        }
                        Statistics.Farms++;
                        nbLootAttempt++;
                        myState = LocState.Looting;
                        if (timerLooting == null)
                        {
                            timerLooting = new Timer(1000 * 5);
                        }
                        else
                        {
                            timerLooting.Reset();
                        }
                        return;
                    }
                    if (_nbTryFarmInThisZone > MaxTryByDigsite) // If try > config try black list
                    {
                        nbLootAttempt = 0;
                        BlackListDigsites.Add(digsitesZone.id);
                        Logging.Write("Black List Digsite: " + digsitesZone.name);
                        myState           = LocState.LocalMove;
                        nbCastSurveyError = 0;
                        return;
                    }
                    bool moreMovementNeeded = false;
                    if (qPOI != null && !qPOI.ValidPoint && qPOI.Center.DistanceTo2D(ObjectManager.ObjectManager.Me.Position) < 40.0f)
                    {
#pragma warning disable 168
                        // We call qPOI.MiddlePoint to make the WoWQuestPOIPoint instance compute the middle point, but I don't care were it is
                        Point p = qPOI.MiddlePoint; // we are near enough to compute it
#pragma warning restore 168
                        if (Usefuls.IsFlying)
                        {
                            moreMovementNeeded = true;
                            MovementManager.StopMove();
                        }
                    }
                    // Go To Zone
                    if (qPOI != null && (moreMovementNeeded || !qPOI.IsInside(ObjectManager.ObjectManager.Me.Position)))
                    {
                        if (MountTask.GetMountCapacity() == MountCapacity.Feet || MountTask.GetMountCapacity() == MountCapacity.Ground)
                        {
                            int LodestoneID = 117389;
                            if (!_travelDisabled && ItemsManager.GetItemCount(LodestoneID) > 0 &&
                                Usefuls.RealContinentId == 1116 &&
                                qPOI.Center.DistanceTo2D(ObjectManager.ObjectManager.Me.Position) > 3000f)
                            {
                                ObjectManager.WoWItem item = ObjectManager.ObjectManager.GetWoWItemById(LodestoneID);
                                if (item != null && item.IsValid && !ItemsManager.IsItemOnCooldown(LodestoneID) && ItemsManager.IsItemUsable(LodestoneID))
                                {
                                    Logging.Write("Using a Draenor Archaeologist's Lodestone");
                                    Products.Products.InManualPause = true; // Prevent triggering "Player teleported"
                                    ItemsManager.UseItem(LodestoneID);
                                    Thread.Sleep(3000 + Usefuls.Latency);
                                    digsitesZone = new Digsite(); // Reset the choice made
                                    return;
                                }
                            }
                            Logging.Write("Not inside, then go to Digsite " + digsitesZone.name);
                            Point me = ObjectManager.ObjectManager.Me.Position;
                            if (_travelLocation != null && _travelLocation.DistanceTo(me) > 0.1f)
                            {
                                if (Products.Products.TravelRegenerated && Products.Products.TravelFrom.IsValid)
                                {
                                    _travelLocation = Products.Products.TravelFrom;
                                    Products.Products.TravelRegenerated = false;
                                }
                            }
                            if ((_travelLocation == null || _travelLocation.DistanceTo(me) > 0.1f) && !_travelDisabled && !Usefuls.IsFlying)
                            {
                                MovementManager.StopMove();
                                Logging.Write("Calling travel system to go to digsite " + digsitesZone.name + " (" + digsitesZone.id + ")...");
                                Products.Products.TravelToContinentId   = Usefuls.ContinentId;
                                Products.Products.TravelTo              = qPOI.Center;
                                Products.Products.TravelFromContinentId = Usefuls.ContinentId;
                                Products.Products.TravelFrom            = me;
                                // Pass the check for valid destination as a lambda
                                Products.Products.TargetValidationFct = qPOI.IsInside;
                                _travelLocation = Products.Products.TravelFrom;
                                return;
                            }
                            if (_travelLocation.DistanceTo(me) <= 0.1f)
                            {
                                _travelDisabled = true;
                            }
                            List <Point> newPath;
                            newPath = PathFinder.FindPath(qPOI.Center);
                            MovementManager.Go(newPath);
                        }
                        else if (qPOI.ValidPoint)
                        {
                            if (moreMovementNeeded || !qPOI.IsInside(ObjectManager.ObjectManager.Me.Position))
                            {
                                Point destination = new Point(qPOI.MiddlePoint);
                                destination.Type = "flying";
                                if (moreMovementNeeded)
                                {
                                    Logging.Write("Landing on the digsite");
                                }
                                else
                                {
                                    Logging.Write("Not inside, then go to Digsite " + digsitesZone.name + "; X: " + destination.X + "; Y: " + destination.Y + "; Z: " + (int)destination.Z);
                                }
                                MovementManager.Go(new List <Point>(new[] { destination })); // MoveTo Digsite
                            }
                        }
                        else
                        {
                            // here we need to go to center, THEN compute middle point
                            Point destination = qPOI.Center;
                            destination.Z   += 40.0f;
                            destination.Type = "flying";
                            Logging.Write("Go to Digsite " + digsitesZone.name + "; X: " + destination.X + "; Y: " + destination.Y + "; Z: " + (int)destination.Z);
                            MovementManager.Go(new List <Point>(new[] { destination })); // MoveTo Digsite
                        }
                        myState = LocState.LocalMove;
                        return;
                    }
                    // Find loot with Survey
                    nbLootAttempt = 0;
                    t             = ObjectManager.ObjectManager.GetNearestWoWGameObject(
                        ObjectManager.ObjectManager.GetWoWGameObjectByDisplayId(Archaeology.SurveyList));
                    if (t.GetBaseAddress == 0 || myState == LocState.GoingNextPoint ||
                        // recast if we moved even if last is still spawned
                        myState == LocState.Looting)
                    // after we looted we need to recast survey spell, even if the previous one is still spawned
                    {
                        if (!Archaeology.DigsiteZoneIsAvailable(digsitesZone))
                        {
                            return;
                        }

                        if (myState == LocState.LocalMove)
                        {
                            MountTask.DismountMount();
                        }

                        surveySpell.Launch();
                        myState = LocState.Survey;
                        if (ObjectManager.ObjectManager.Me.InCombat)
                        {
                            return;
                        }
                        Thread.Sleep(1750 + Usefuls.Latency); // let's wait a fair bit
                        nbCastSurveyError++;
                        if (nbCastSurveyError > 3)
                        {
                            if (ObjectManager.ObjectManager.Me.Position.DistanceTo2D(qPOI.MiddlePoint) < 5)
                            {
                                // This means we are in a wrong digsite
                                List <Digsite> listDigsitesZone;
                                if (!_inSecondDigSiteWithSameName)
                                {
                                    listDigsitesZone = Archaeology.GetDigsitesZoneAvailable(t.Name);
                                }
                                else // very very rare case I had: back to the first digsite with same name after the 2nd one
                                {
                                    listDigsitesZone = Archaeology.GetDigsitesZoneAvailable();
                                }
                                foreach (Digsite dg in listDigsitesZone)
                                {
                                    if (dg.name == t.Name)
                                    {
                                        digsitesZone = dg;
                                    }
                                }
                                WoWResearchSite OneSite;
                                if (!_inSecondDigSiteWithSameName)
                                {
                                    OneSite = WoWResearchSite.FromName(digsitesZone.name, true);
                                }
                                else
                                {
                                    OneSite = WoWResearchSite.FromName(digsitesZone.name, false);
                                }
                                qPOI = WoWQuestPOIPoint.FromSetId(OneSite.Record.QuestIdPoint);
                                _inSecondDigSiteWithSameName = !_inSecondDigSiteWithSameName;
                                nbCastSurveyError            = 0;
                                return;
                            }
                            if (MountTask.GetMountCapacity() == MountCapacity.Feet || MountTask.GetMountCapacity() == MountCapacity.Ground)
                            {
                                Logging.Write("Too many errors, then go to Digsite " + digsitesZone.name);
                                List <Point> newPath = PathFinder.FindPath(qPOI.Center);
                                MovementManager.Go(newPath);
                            }
                            else
                            {
                                if (qPOI != null)
                                {
                                    Point destination = qPOI.MiddlePoint;
                                    Logging.Write("Too many errors, then go to Digsite " + digsitesZone.name + "; X: " + destination.X + "; Y: " + destination.Y + "; Z: " + (int)destination.Z);
                                    MovementManager.Go(new List <Point>(new[] { destination })); // MoveTo Digsite
                                }
                            }
                            nbCastSurveyError = 0;
                            return;
                        }
                        _nbTryFarmInThisZone++;
                        return;
                    }
                    if (myState == LocState.GoingNextPoint)
                    {
                        return;
                    }
                    nbCastSurveyError = 0; // Reset try cast survey
                    if ((ObjectManager.ObjectManager.Me.InCombat &&
                         !(ObjectManager.ObjectManager.Me.IsMounted &&
                           (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))))
                    {
                        return;
                    }
                    Point p0;
                    float angle;
                    {
                        Point p;
                        float distance, distanceMin, distanceMax, decrement, increment;
                        if (t.DisplayId == 10103) // Survey Tool (Red) 100 yard
                        {
                            distance           = 90f;
                            distanceMin        = 20f;
                            distanceMax        = 210f;
                            increment          = 8f;
                            decrement          = 8f;
                            _lastGreenPosition = new Point();
                            _AntiPingPong      = false;
                            _greenCount        = 0;
                        }
                        else if (t.DisplayId == 10102) // Survey Tool (Yellow) 50 yard
                        {
                            distance           = 46f;
                            distanceMin        = 20f;
                            distanceMax        = 60f;
                            increment          = 7f;
                            decrement          = 6.5f;
                            _lastGreenPosition = new Point();
                            _AntiPingPong      = false;
                            _greenCount        = 0;
                        }
                        else // Survey Tool (Green) 25 yard (t.DisplayId == 10101)
                        {
                            _greenCount++;
                            increment = 4f;
                            if (_greenCount >= 10)
                            {
                                _greenCount        = 0;
                                _lastGreenPosition = new Point();
                                Point destination = qPOI.MiddlePoint;
                                _AntiPingPong = false;
                                Logging.Write("Stuck, then go to Digsite " + digsitesZone.name + "; X: " + destination.X + "; Y: " + destination.Y + "; Z: " + (int)destination.Z);
                                MountTask.Mount(true, true);
                                MovementManager.Go(new List <Point>(new[] { destination })); // MoveTo Digsite
                                return;
                            }
                            if (_AntiPingPong)
                            {
                                Logging.Write("Ping-pong detected, shortening the distance");
                                distance    = 11f;
                                distanceMin = 6f;
                                distanceMax = 16f;
                                decrement   = 4f;
                            }
                            else
                            {
                                distance    = 19f;
                                distanceMin = 7f;
                                distanceMax = 41f;
                                decrement   = 3f;
                            }
                        }
                        {
                            float d = distance;
                            p0    = new Point(t.Position);
                            angle = t.Orientation;
                            p     = Math.GetPosition2DOfAngleAndDistance(p0, angle, d);
                            p.Z   = PathFinder.GetZPosition(p, true);
                            bool valid;
                            PathFinder.FindPath(p, out valid);
                            if (qPOI != null)
                            {
                                bool IamOutOfWater = IsPointOutOfWater(ObjectManager.ObjectManager.Me.Position);
                                while (!valid || p.Z == 0 || !qPOI.IsInside(p) || !(!IamOutOfWater || IsPointOutOfWater(p)))
                                {
                                    if (d + increment > distanceMax)
                                    {
                                        break;
                                    }
                                    d += increment;
                                    Point newone = Math.GetPosition2DOfAngleAndDistance(p0, angle, d);
                                    if (qPOI.IsInside(newone))
                                    {
                                        p    = new Point(newone);
                                        p.Z += d / 10.0f; // just so that GetZ don't find caves too easiely
                                        p.Z  = PathFinder.GetZPosition(p, true);
                                        if (p.Z == 0)     // if p == 0 we don't care about the path
                                        {
                                            valid = false;
                                        }
                                        else if (Math.DistanceListPoint(PathFinder.FindLocalPath(p, out valid)) > d * 4 && d > 30)
                                        {
                                            valid = false;
                                        }
                                    }
                                    // Since these direction are approximate, also search in a pi/5 angle
                                    if (!valid /* && t.DisplayId == 10103*/)
                                    {
                                        float angleplus = Math.FixAngle(angle + ((float)System.Math.PI / 10f));
                                        newone = Math.GetPosition2DOfAngleAndDistance(p0, angleplus, d);
                                        p      = new Point(newone);
                                        p.Z   += d / 10.0f; // just so that GetZ don't find caves too easiely
                                        p.Z    = PathFinder.GetZPosition(p, true);
                                        if (p.Z == 0)       // if p == 0 we don't care about the path
                                        {
                                            valid = false;
                                        }
                                        else if (Math.DistanceListPoint(PathFinder.FindLocalPath(p, out valid)) > d * 4 && d > 30)
                                        {
                                            valid = false;
                                        }
                                        if (valid)
                                        {
                                            Logging.Write("Angles+ for distance " + d);
                                        }
                                    }
                                    if (!valid /* && t.DisplayId == 10103*/)
                                    {
                                        float angleminus = Math.FixAngle(angle - ((float)System.Math.PI / 10f));
                                        newone = Math.GetPosition2DOfAngleAndDistance(p0, angleminus, d);
                                        p      = new Point(newone);
                                        p.Z   += d / 10.0f; // just so that GetZ don't find caves too easiely
                                        p.Z    = PathFinder.GetZPosition(p, true);
                                        if (p.Z == 0)       // if p == 0 we don't care about the path
                                        {
                                            valid = false;
                                        }
                                        else if (Math.DistanceListPoint(PathFinder.FindLocalPath(p, out valid)) > d * 4 && d > 30)
                                        {
                                            valid = false;
                                        }
                                        if (valid)
                                        {
                                            Logging.Write("Angles- for distance " + d);
                                        }
                                    }
                                }
                                if (!valid || p.Z == 0 || !qPOI.IsInside(p) || !(!IamOutOfWater || IsPointOutOfWater(p)))
                                {
                                    d = distance;
                                    while (!valid || p.Z == 0 || !qPOI.IsInside(p) || !(!IamOutOfWater || IsPointOutOfWater(p)))
                                    {
                                        if (d - decrement < distanceMin)
                                        {
                                            break;
                                        }
                                        d -= decrement;
                                        Point newone = Math.GetPosition2DOfAngleAndDistance(p0, angle, d);
                                        if (qPOI.IsInside(newone))
                                        {
                                            p    = new Point(newone);
                                            p.Z += d / 10.0f; // just so that the the GetZ don't find caves too easiely
                                            p.Z  = PathFinder.GetZPosition(p, true);
                                            if (p.Z == 0)     // if p == 0 we don't care about the path
                                            {
                                                valid = false;
                                            }
                                            else if (Math.DistanceListPoint(PathFinder.FindLocalPath(p, out valid)) > d * 4 && d > 30)
                                            {
                                                valid = false;
                                            }
                                        }
                                        // Since these direction are approximate, also search in a pi/5 angle
                                        if (!valid /* && t.DisplayId == 10103*/)
                                        {
                                            float angleplus = Math.FixAngle(angle + ((float)System.Math.PI / 10f));
                                            newone = Math.GetPosition2DOfAngleAndDistance(p0, angleplus, d);
                                            p      = new Point(newone);
                                            p.Z   += d / 10.0f; // just so that GetZ don't find caves too easiely
                                            p.Z    = PathFinder.GetZPosition(p, true);
                                            if (p.Z == 0)       // if p == 0 we don't care about the path
                                            {
                                                valid = false;
                                            }
                                            else if (Math.DistanceListPoint(PathFinder.FindLocalPath(p, out valid)) > d * 4 && d > 30)
                                            {
                                                valid = false;
                                            }
                                            if (valid)
                                            {
                                                Logging.Write("Angles+ for distance " + d);
                                            }
                                        }
                                        if (!valid /* && t.DisplayId == 10103*/)
                                        {
                                            float angleminus = Math.FixAngle(angle - ((float)System.Math.PI / 10f));
                                            newone = Math.GetPosition2DOfAngleAndDistance(p0, angleminus, d);
                                            p      = new Point(newone);
                                            p.Z   += d / 10.0f; // just so that GetZ don't find caves too easiely
                                            p.Z    = PathFinder.GetZPosition(p, true);
                                            if (p.Z == 0)       // if p == 0 we don't care about the path
                                            {
                                                valid = false;
                                            }
                                            else if (Math.DistanceListPoint(PathFinder.FindLocalPath(p, out valid)) > d * 4 && d > 30)
                                            {
                                                valid = false;
                                            }
                                            if (valid)
                                            {
                                                Logging.Write("Angles- for distance " + d);
                                            }
                                        }
                                    }
                                }
                            }
                            // check pingpong but not a second time
                            if (_AntiPingPong)
                            {
                                _AntiPingPong = false;
                            }
                            else if (t.DisplayId == 10101 && _lastGreenPosition.IsValid && p.DistanceTo2D(_lastGreenPosition) <= 7f)
                            {
                                _AntiPingPong = true;
                            }
                            // then remmember the last Green Position
                            if (t.DisplayId == 10101)
                            {
                                _lastGreenPosition = new Point(ObjectManager.ObjectManager.Me.Position);
                            }
                            if (_AntiPingPong)
                            {
                                myState = LocState.LocalMove;
                                return;
                            }
                            Logging.Write("Distance " + d + " selected");
                        }
                        myState = LocState.GoingNextPoint;

                        // Find Path
                        bool         resultB;
                        List <Point> points = PathFinder.FindLocalPath(p, out resultB, false);

                        // If path not found find nearer
                        if (points.Count <= 0)
                        {
                            Point pt = Math.GetPosition2DOfAngleAndDistance(p0, angle, 15);
                            pt.Z   = ObjectManager.ObjectManager.Me.Position.Z;
                            points = PathFinder.FindLocalPath(pt, out resultB, false);
                            if (points.Count > 0 && resultB)
                            {
                                p = new Point(pt);
                            }
                        }

                        // Go to next position
                        if ((!resultB && p.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 10) ||
                            nbStuck >= 2)
                        // Use fly mount
                        {
                            p.Z = PathFinder.GetZPosition(p);

                            if (p.Z == 0)
                            {
                                p.Z = ObjectManager.ObjectManager.Me.Position.Z + 35;
                            }
                            else
                            {
                                p.Z = p.Z + 5.0f;
                            }

                            if ((ObjectManager.ObjectManager.Me.InCombat &&
                                 !(ObjectManager.ObjectManager.Me.IsMounted &&
                                   (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))))
                            {
                                return;
                            }
                            MountTask.Mount(true, true);
                            LongMove.LongMoveByNewThread(p);
                            Timer timer = new Timer(2000 * points[points.Count - 1].DistanceTo(ObjectManager.ObjectManager.Me.Position) / 3);

                            while (LongMove.IsLongMove && !timer.IsReady &&
                                   ObjectManager.ObjectManager.Me.Position.DistanceTo2D(p) > 0.5f)
                            {
                                if ((ObjectManager.ObjectManager.Me.InCombat &&
                                     !(ObjectManager.ObjectManager.Me.IsMounted &&
                                       (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))))
                                {
                                    LongMove.StopLongMove();
                                    return;
                                }
                                Thread.Sleep(100);
                            }
                            LongMove.StopLongMove();
                            while (MovementManager.IsUnStuck)
                            {
                                if (ObjectManager.ObjectManager.Me.IsDeadMe)
                                {
                                    return;
                                }
                                Thread.Sleep(100);
                                LongMove.StopLongMove();
                            }
                            MovementManager.StopMove();
                            MountTask.DismountMount();
// ReSharper disable RedundantAssignment
                            nbStuck = 0;
// ReSharper restore RedundantAssignment
                        }
                        else //  walk to next position
                        {
                            float d1 = Math.DistanceListPoint(points);
                            float d2 = points[0].DistanceTo(points[points.Count - 1]);
                            // here we will try to shortcut the path using a fly mount
                            if (MountTask.GetMountCapacity() == MountCapacity.Fly && d1 > 80 && d1 > (d2 * 2))
                            {
                                Point startpoint = new Point(ObjectManager.ObjectManager.Me.Position);
                                Point endpoint   = new Point(points[points.Count - 1]);
                                float z1         = startpoint.Z;
                                float z2         = endpoint.Z;
                                float zref       = System.Math.Max(z1, z2) + 6.0f;
                                Point pref1      = new Point(startpoint);
                                pref1.Z = zref;
                                Point pref2 = new Point(endpoint);
                                pref2.Z = zref;
                                bool badres = TraceLine.TraceLineGo(startpoint, pref1) ||
                                              TraceLine.TraceLineGo(pref1, pref2) ||
                                              TraceLine.TraceLineGo(pref2, endpoint);
                                if (!badres)
                                {
                                    Logging.Write("Flying to shortcut the path");
                                    MountTask.Mount(true, true);
                                    if (Usefuls.IsFlying) // Failsafe: in case we are indoor don't try
                                    {
                                        points   = new List <Point>();
                                        pref1.Z += 2f;
                                        pref2.Z += 2f;
                                        points.Add(pref1);
                                        points.Add(pref2);
                                        points.Add(endpoint);
                                    }
                                }
                            }
                            if (d1 > nManagerSetting.CurrentSetting.MinimumDistanceToUseMount && !nManagerSetting.CurrentSetting.UseGroundMount)
                            {
                                MountTask.Mount();
                            }
                            if (Usefuls.IsFlying)
                            {
                                for (int i = 0; i < points.Count; i++)
                                {
                                    points[i].Type = "flying";
                                }
                            }
                            MovementManager.Go(points);
                            float d = Math.DistanceListPoint(points) / 3;
                            if (d > 200)
                            {
                                d = 200;
                            }
                            float tm_t = 1000 * d / 2 + 1500;
                            if (Usefuls.IsSwimming)
                            {
                                tm_t /= 0.6f;
                            }
                            Timer timer = new Timer(tm_t);
                            while (MovementManager.InMovement && !timer.IsReady &&
                                   ObjectManager.ObjectManager.Me.Position.DistanceTo2D(p) > 0.5f)
                            {
                                if ((ObjectManager.ObjectManager.Me.InCombat &&
                                     !(ObjectManager.ObjectManager.Me.IsMounted &&
                                       (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))))
                                {
                                    return;
                                }
                                Thread.Sleep(100);
                            }
                            // incremente nbstuck if player is stuck
                            if (ObjectManager.ObjectManager.Me.Position.DistanceTo(t.Position) < 5 ||
                                (MovementManager.InMovement && !ObjectManager.ObjectManager.Me.InInevitableCombat &&
                                 timer.IsReady))
                            {
// ReSharper disable RedundantAssignment
                                nbStuck++;
                            }
// ReSharper restore RedundantAssignment
                            else
                            {
// ReSharper disable RedundantAssignment
                                nbStuck = 0;
                            }
// ReSharper restore RedundantAssignment
                            if (ObjectManager.ObjectManager.Me.InInevitableCombat)
                            {
                                return;
                            }
                            MovementManager.StopMove();
                            while (MovementManager.IsUnStuck)
                            {
                                if (ObjectManager.ObjectManager.Me.IsDeadMe)
                                {
                                    return;
                                }
                                Thread.Sleep(100);
                                MovementManager.StopMove();
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            catch
            {
            }
        }
コード例 #30
0
        internal void AddOstTraces(CIContainer aContainer)
        {
            CITraceData traceData = aContainer.Traces;

            //
            if (traceData != null && traceData.Lines.Length > 0)
            {
                foreach (CITrace ciTrace in traceData)
                {
                    System.Text.StringBuilder line = new System.Text.StringBuilder();

                    TraceLine trace = ciTrace;

                    // Type
                    string type = string.Empty;
                    switch (trace.Type)
                    {
                    case TraceLine.TType.ETypeBinary:
                        type = "Bin";
                        break;

                    case TraceLine.TType.ETypeRaw:
                        type = "Raw";
                        break;

                    case TraceLine.TType.ETypeText:
                        type = "Text";
                        break;

                    default:
                        type = "Unknown";
                        break;
                    }
                    if (string.IsNullOrEmpty(type) == false)
                    {
                        line.Append(type);
                    }

                    // Context id
                    if (trace.ContextId != 0)
                    {
                        line.Append(" " + "0x" + trace.ContextId.ToString("x8"));
                    }

                    // Time stamp
                    line.Append(" " + trace.TimeStamp.ToString());

                    // Prefix
                    string prefix = trace.Prefix;
                    if (string.IsNullOrEmpty(prefix) == false)
                    {
                        line.Append(" " + prefix);
                    }

                    // Suffix
                    string suffix = trace.Suffix;
                    if (string.IsNullOrEmpty(suffix) == false)
                    {
                        line.Append(" " + suffix);
                    }

                    if (trace.HasIdentifier)
                    {
                        // Component/group/id triplet
                        TraceIdentifier identifier = trace.Identifier;
                        line.Append(" C:" + "0x" + identifier.Component.ToString("x8"));
                        line.Append(" G:" + identifier.Group.ToString());
                        line.Append(" I:" + identifier.Id.ToString());
                        // File & line
                        TraceLocation location = identifier.Location;
                        //
                        string file       = location.File;
                        string lineNumber = location.Line.ToString();
                        //
                        if (string.IsNullOrEmpty(file) == false && string.IsNullOrEmpty(lineNumber) == false)
                        {
                            line.Append(" " + file);
                            line.Append(":" + lineNumber);
                        }
                    }

                    // Payload
                    string payload = trace.Payload;
                    line.Append(" " + payload);
                    iOstTraces.Add(line.ToString());
                }
            }
        }