Ejemplo n.º 1
0
        private void workerFetch_DoWork(object sender, DoWorkEventArgs e)
        {
            PlayerMobile _self           = PlayerMobile.GetPlayer();
            var          _fetchItem      = new Item(new Serial(FetchItem));
            var          _fetchContainer = new Item(new Serial(FetchItem));

            if (FetchItemType == "Armor")
            {
                _fetchContainer = new Item(new Serial(ArmorList.Where(x => x.ID == FetchItem).First().ContainerID));
            }
            else if (FetchItemType == "Jewelry")
            {
                _fetchContainer = new Item(new Serial(JewelryList.Where(x => x.ID == FetchItem).First().ContainerID));
            }
            else if (FetchItemType == "Weapon")
            {
                _fetchContainer = new Item(new Serial(WeaponsList.Where(x => x.ID == FetchItem).First().ContainerID));
            }
            else if (FetchItemType == "Shield")
            {
                _fetchContainer = new Item(new Serial(ShieldList.Where(x => x.ID == FetchItem).First().ContainerID));
            }


            var _moveHelper = MovingHelper.GetMovingHelper();

            while (_fetchContainer.Distance > 1)
            {
                _moveHelper.newMoveXY((ushort)_fetchContainer.Location.X, (ushort)_fetchContainer.Location.Y, true, 1, false);
            }

            _fetchContainer.DoubleClick();

            Thread.Sleep(1500);

            List <uint> _findList  = new List <uint>();
            List <Item> _container = new List <Item>();

            Stealth.Client.FindTypeEx(0xFFFF, 0xFFFF, _fetchContainer.Serial.Value, false);
            if (!(Stealth.Client.GetFindCount() == 0))
            {
                _findList = Stealth.Client.GetFindList();
            }

            foreach (uint _item in _findList)
            {
                _container.Add(new Item(new Serial(_item)));
            }

            foreach (Item _i in _container)
            {
                if (_i.Serial.Value == FetchItem)
                {
                    MessageBox.Show("true");
                }
            }
            Stealth.Client.MoveItem(_fetchItem.Serial.Value, 1, _self.Backpack.Serial.Value, 0, 0, 0);

            workerFetch.CancelAsync();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
        {
            switch (e.Type)
            {
            case EventType.FileSwitch:
                this.GenerateSurroundMenuItems();
                UpdateMenuItems();
                break;

            case EventType.UIStarted:
                // Expose plugin's refactor main menu & context menu...
                EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "CodeRefactor.Menu", this.refactorMainMenu));
                EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "CodeRefactor.ContextMenu", this.refactorContextMenu));
                // Watch resolved context for menu item updating...
                ASComplete.OnResolvedContextChanged += OnResolvedContextChanged;
                this.UpdateMenuItems();
                break;

            case EventType.Command:
                DataEvent de = (DataEvent)e;
                string[]  args;
                string    oldPath;
                string    newPath;
                switch (de.Action)
                {
                case ProjectFileActionsEvents.FileRename:
                    args    = de.Data as string[];
                    oldPath = args[0];
                    newPath = args[1];
                    if (Directory.Exists(oldPath) && IsValidForMove(oldPath, newPath))
                    {
                        MovingHelper.AddToQueue(new Dictionary <string, string> {
                            { oldPath, newPath }
                        }, true, true);
                        e.Handled = true;
                    }
                    else if (IsValidForRename(oldPath, newPath))
                    {
                        RenameFile(oldPath, newPath);
                        e.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileMove:
                    args    = de.Data as string[];
                    oldPath = args[0];
                    newPath = args[1];
                    if (IsValidForMove(oldPath, newPath))
                    {
                        MovingHelper.AddToQueue(new Dictionary <string, string> {
                            { oldPath, newPath }
                        });
                        e.Handled = true;
                    }
                    break;
                }
                break;
            }
        }
Ejemplo n.º 3
0
 public SteeringBehaviours(MovingEntity movingEntity)
 {
     _wallWeightCollision = 10f;
     _movingHelper        = new MovingHelper();
     _feelers             = new List <Vector2>();
     WanderDistance       = 3f;
     WanderRadius         = 1.7f;
     WanderJitter         = 1f;
     WallDetectionLenght  = 50f;
     _actor = movingEntity;
 }
Ejemplo n.º 4
0
        public RaillessMining()
        {
            this.playerMobile = PlayerMobile.GetPlayer();
            this.movingHelper = MovingHelper.GetMovingHelper();

            this.smeltWeight   = WindowsRegistry.GetValueOrDefault(@"Software\ScriptSDK.SantiagoUO\RaillessMining\" + playerMobile.Name, "SmeltWeight", 350);
            this.smelt1x1      = WindowsRegistry.GetValueOrDefault(@"Software\ScriptSDK.SantiagoUO\RaillessMining\" + playerMobile.Name, "Smelt1x1", false);
            this.bankWeight    = WindowsRegistry.GetValueOrDefault(@"Software\ScriptSDK.SantiagoUO\RaillessMining\" + playerMobile.Name, "BankWeight", 100);
            this.dropContainer = new Container(EasyUOHelper.ConvertToStealthID(WindowsRegistry.GetValue(@"Software\ScriptSDK.SantiagoUO\RaillessMining\" + playerMobile.Name, "DropContainerId")));
            this.pickaxesCount = WindowsRegistry.GetValueOrDefault(@"Software\ScriptSDK.SantiagoUO\RaillessMining\" + playerMobile.Name, "PickaxesCount", 2);
        }
Ejemplo n.º 5
0
        static void MoveFile(string fileName)
        {
            MoveDialog dialog = new MoveDialog(fileName);

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Dictionary <string, string> oldPathToNewPath = new Dictionary <string, string>();

            foreach (string file in dialog.MovingFiles)
            {
                oldPathToNewPath[file] = dialog.SelectedDirectory;
            }
            MovingHelper.AddToQueue(oldPathToNewPath, true, false, dialog.FixPackages);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Invoked when the user selects the "Move" command
        /// </summary>
        static void MoveClicked(object sender, EventArgs e)
        {
            MoveDialog dialog = new MoveDialog(PluginBase.MainForm.CurrentDocument.FileName);

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Dictionary <string, string> oldPathToNewPath = new Dictionary <string, string>();

            foreach (string file in dialog.MovingFiles)
            {
                oldPathToNewPath[file] = dialog.SelectedDirectory;
            }
            MovingHelper.AddToQueue(oldPathToNewPath, true, false, dialog.FixPackages);
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Plateau  plateau  = new Plateau(5, 5);
            Position position = new Position(1, 2);


            Rover rover = new Rover(plateau, position, DirectionStatus.N);

            MovingHelper.AllProcessDiagram(rover, "LMLMLMLMM");
            Console.WriteLine(MovingHelper.LastPosition(rover)); // ====>> Must Be 1 3 N !


            MovingHelper.SetPosition(rover, 3, 3, DirectionStatus.E);
            MovingHelper.AllProcessDiagram(rover, "MMRMMRMRRM");
            Console.WriteLine(MovingHelper.LastPosition(rover)); // ====>> Must Be 5 1 E !

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
Ejemplo n.º 8
0
        public void Start()
        {
            var tiles = UltimaTileReader.GetLumberSpots(TILE_SCAN_DISTANCE);

            while (tiles.Count > 0)
            {
                Data.Point3D playerLocation  = PlayerMobile.GetPlayer().Location;
                var          nearestTreeTile = tiles.OrderBy(tile => Math.Sqrt(Math.Pow((tile.X - playerLocation.X), 2) + Math.Pow((tile.Y - playerLocation.Y), 2))).First();

                MovingHelper.GetMovingHelper().newMoveXY(nearestTreeTile.X, nearestTreeTile.Y, true, 1, true);

                var hatchet = ObjectsFinder.FindInBackpackOrPaperdoll <Item>(EasyUOItem.HATCHETS);
                if (hatchet.Count == 0)
                {
                    return;
                }

                if (ChopTree(hatchet.First(), nearestTreeTile) == ChopTreeResult.DONE)
                {
                    tiles.Remove(nearestTreeTile);
                }
            }
        }
Ejemplo n.º 9
0
        private void workerSearch_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                XConfig.Engine = ShardEngine.Broadsword;

                Scanner.Initialize();

                Scanner.Range         = 20;
                Scanner.VerticalRange = 0;

                //start the stopwatch for searching
                Stopwatch _loggerWatch = new Stopwatch();
                Stopwatch _moverWatch  = new Stopwatch();
                _loggerWatch.Start();
                _moverWatch.Start();

                if (Multisearch == true)
                {
                    Stealth.Client.ClilocSpeech += onClilocSpeech;

                    FindContainers();

                    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();
                    }
                }
                else
                {
                    Item _result    = RequestTarget();
                    Item _container = new Item(new Serial(_result.Serial.Value));
                    //Item _container = new Item(new Serial(0x4388622D));
                    SearchContainer(_container);
                }

                _loggerWatch.Stop();

                workerSearch.ReportProgress(0, "Finished searching!");
                workerSearch.ReportProgress(0, "Took: " + _loggerWatch.Elapsed);

                workerSearch.CancelAsync();
            }
            catch (Exception x)
            {
                workerSearch.ReportProgress(0, "Exception Message: " + x.Message.ToString());
                workerSearch.ReportProgress(0, "Exception Stack Trace: " + x.StackTrace.ToString());
                workerSearch.ReportProgress(0, "Exception Source: " + x.Source.ToString());
                workerSearch.CancelAsync();
            }
        }