Exemplo n.º 1
0
        public static void getAllCropsNeededToBeWatered()
        {
            foreach (var v in Game1.player.currentLocation.terrainFeatures)
            {
                if (v.Value is StardewValley.TerrainFeatures.HoeDirt)
                {
                    if ((v.Value as StardewValley.TerrainFeatures.HoeDirt).crop != null)
                    {
                        //cropsToWater.Add(v.Key);
                        //If my dirt needs to be watered and the crop isn't fully grown.
                        if ((v.Value as StardewValley.TerrainFeatures.HoeDirt).state == 0 && isCropFullGrown((v.Value as StardewValley.TerrainFeatures.HoeDirt).crop) == false)
                        {
                            TileNode t = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.LightSkyBlue));
                            t.placementAction(Game1.currentLocation, (int)v.Key.X * Game1.tileSize, (int)v.Key.Y * Game1.tileSize);
                            //StardustCore.Utilities.masterAdditionList.Add(new StardustCore.DataNodes.PlacementNode(t, Game1.currentLocation, (int)v.Key.X * Game1.tileSize, (int)v.Key.Y * Game1.tileSize));
                            Utilities.tileExceptionList.Add(new TileExceptionMetaData(t, "Water"));
                            cropsToWater.Add(t);
                        }
                    }
                }
            }

            //Instead of just running this function I should add it to my execution queue.
            foreach (var v in cropsToWater)
            {
                object[] obj = new object[1];
                obj[0] = v;
                // ExecutionCore.TaskList.taskList.Add(new Task(new Action<object>(waterSingleCrop), obj));
                StardewValley.Tools.WateringCan w = new StardewValley.Tools.WateringCan();
                ExecutionCore.TaskList.taskList.Add(new ExecutionCore.CustomTask(waterSingleCrop, obj, new ExecutionCore.TaskMetaData("Water Crop", new StaminaPrerequisite(true, 3), new ToolPrerequisite(true, w.GetType(), 1))));
                //   waterSingleCrop(v);
            }
        }
Exemplo n.º 2
0
        public static void goToShippingBinSetUp()
        {
            List <TileNode> shippingTiles = new List <TileNode>();

            if (Game1.player.currentLocation.name == "Farm")
            {
                //CHEATING AND STUPID WAY BUT WILL PATH TO SHIPPING BIN.
                for (int i = 0; i <= 1; i++)
                {
                    TileNode t = new TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Brown));
                    t.fakePlacementAction(Game1.currentLocation, 71 + i, 14);
                    Utilities.tileExceptionList.Add(new TileExceptionMetaData(t, "ShippingBin"));
                    shippingTiles.Add(t);
                }
            }
            int ok = 0;

            object[]        objList  = new object[3];
            List <TileNode> tempList = new List <TileNode>();

            foreach (var v in shippingTiles)
            {
                tempList.Add(v);
            }
            objList[0] = tempList;

            // ExecutionCore.TaskList.taskList.Add(new Task(new Action<object>(waterSingleCrop), obj));
            StardewValley.Tools.WateringCan w = new StardewValley.Tools.WateringCan();
            //ModCore.CoreMonitor.Log("Processing water tiles:" + shippingTiles.Count.ToString() + " / " + twingCount.ToString());
            ok++;
            int numberOfUses = 1;

            ExecutionCore.CustomTask task = new ExecutionCore.CustomTask(goToShippingBin, objList, new ExecutionCore.TaskMetaData("GoToShippingBin", null, null, null, null, null));

            task.objectParameterDataArray = objList;

            if (task.taskMetaData.cost == Int32.MaxValue)
            {
                Utilities.clearExceptionListWithNames(true);
                return;
            }
            objList[1] = task.taskMetaData.pathsToTake[0];
            objList[2] = task.taskMetaData.pathsToTake[0].ElementAt(0);
            ExecutionCore.TaskList.taskList.Add(task);
            Utilities.clearExceptionListWithName("Child");
            Utilities.tileExceptionList.Clear();
        }
Exemplo n.º 3
0
        private void waterAllFields(object sender, EventArgs e)
        {
            GameLocation farm    = Game1.getFarm();
            int          watered = 0;

            foreach (var tf in farm.terrainFeatures)
            {
                TerrainFeature feature = tf.Value;
                if (feature is HoeDirt)
                {
                    this.Monitor.Log("test");
                    watered++;
                    StardewValley.Tools.WateringCan wc = Game1.player.items.OfType <StardewValley.Tools.WateringCan>().FirstOrDefault();
                    feature.performToolAction(wc, 0, tf.Key);
                }
            }
            this.Monitor.Log("Watered " + watered + " tiles");
        }