Code: Select all
                    foreach (Item _item in Containers)
                    {
                        workerSearch.ReportProgress(0, "moving to next container...");
                        _moverWatch.Restart();
                        while (_item.Distance > 1)
                        {
                            if (_moverWatch.Elapsed.Seconds > 15)
                                break;
                            workerSearch.ReportProgress(0, "trying to move...");
                            var _movingHelper = MovingHelper.GetMovingHelper();
                            _movingHelper.newMoveXY((ushort)_item.Location.X, (ushort)_item.Location.Y, true, 1, false);
                            Thread.Sleep(250);
                        }
                        SearchContainer(_item);
                        FindContainers();
                    }This is the other code that this happens on:
Code: Select all
                    foreach (Location _location in _rail.Path.Skip(StartLocation))
                    {
                        
                        lock (thisLock)
                        {
                            _n++;
                            Point2D _position = new Point2D(_location.X, _location.Y);
                            workerSearch.ReportProgress(0, "Moving to location " + _n.ToString() + _position.ToString());
                            Stealth.Client.newMoveXY((ushort)_location.X, (ushort)_location.Y, true, 10,
                                StealthSearch ? false : true);
                            while (!Geometry.InRange(Self.Location, _position, 16))
                            {
                                while (PauseSearch) Thread.Sleep(1000);
                                if (workerSearch.CancellationPending)
                                {
                                    e.Cancel = true;
                                    break;
                                }
                                workerSearch.ReportProgress(0, "trying to move  to: " + _position.ToString());
                                Self.Movement.Step(Convert.ToByte(Geometry.GetDirectionTo(Self.Location, _position)), true);
                                Stealth.Client.newMoveXY((ushort)_location.X, (ushort)_location.Y, true, 10,
                                StealthSearch ? false : true);
                            }
                            if (workerSearch.CancellationPending)
                            {
                                e.Cancel = true;
                                break;
                            }
                        }
                    } //end foreach location

