예제 #1
0
        public override void Execute()
        {
            if (_wvm.CurrentWorld == null)
            {
                return;
            }

            FindChestWithPluginView view = new FindChestWithPluginView();

            if (view.ShowDialog() == false)
            {
                return;
            }

            string         itemName  = view.ItemToFind.ToLower();
            List <Vector2> locations = new List <Vector2>();

            foreach (var chest in _wvm.CurrentWorld.Chests)
            {
                if (chest.Items.Count(c => c.GetName().ToLower().Contains(itemName)) > 0)
                {
                    locations.Add(new Vector2(chest.X, chest.Y));
                }
            }

            // show the result view with the list of locations
            FindLocationResultView resultView = new FindLocationResultView(locations);

            resultView.Show();
        }
        public override void Execute()
        {
            if (_wvm.CurrentWorld == null)
            {
                return;
            }

            List <Vector2> locations = new List <Vector2>();

            // Search the whole World
            for (int x = 0; x < _wvm.CurrentWorld.TilesWide; x++)
            {
                for (int y = 0; y < _wvm.CurrentWorld.TilesHigh; y++)
                {
                    // Check if a tile is a chest
                    if (_wvm.CurrentWorld.Tiles[x, y].Type == (int)TileType.PlanteraBulb)
                    {
                        if (!findConnectedTitle(locations, x, y))
                        {
                            locations.Add(new Vector2(x, y));
                        }
                    }
                }
            }

            // show the result view with the list of locations
            FindLocationResultView resultView = new FindLocationResultView(locations);

            resultView.Show();
        }