Esempio n. 1
0
        private void OnTimeChange(object sender, TimeChangedEventArgs e)
        {
            // ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            holdy.Clear();
            ready_items.Clear();

            //Monitor.Log($"{e.NewTime.ToString()} time changed.", LogLevel.Debug);

            foreach (GameLocation location in GetGameLocations())
            {
                if ((location is FarmCave && cfg.showCaveItems) || (!(location is FarmCave) && !cfg.showCaveItems))
                {
                    if (location.IsFarm || location.IsGreenhouse)
                    {
                        OverlaidDictionary.ValuesCollection locationObjects = GetLocationObjects(location);
                        CheckMachineItems(locationObjects);
                        CheckCrops(location);
                        if (cfg.showAnimalDroppings)
                        {
                            CheckAnimalDroppings(locationObjects);
                        }
                    }
                }
            }

            if (holdy.Count > 0)
            {
                ShowNotification();
            }
        }
Esempio n. 2
0
        private void CheckAnimalDroppings(OverlaidDictionary.ValuesCollection locationObjects)
        {
            List <SObject> truffles = new List <SObject>();

            foreach (SObject obj in locationObjects)
            {
                if (obj.ParentSheetIndex == 165) //autograbber
                {
                    Chest objItems = (Chest)obj.heldObject.Value;
                    foreach (SObject item in objItems.items)
                    {
                        if (animalDroppingCatIds.Contains(item.Category) || animalDroppingsIds.Contains(item.parentSheetIndex))
                        {
                            {
                                ready_item = item;

                                if (!holdy.ContainsKey(ready_item.name))
                                {
                                    holdy.Add(ready_item.name, 0);
                                    ready_items.Add(ready_item.name, ready_item);
                                }

                                holdy[ready_item.name]++;
                            }
                        }
                    }
                }

                //animal droppings
                if (animalDroppingCatIds.Contains(obj.Category) || animalDroppingsIds.Contains(obj.parentSheetIndex))
                {
                    {
                        ready_item = obj;

                        if (!holdy.ContainsKey(ready_item.name))
                        {
                            holdy.Add(ready_item.name, 0);
                            ready_items.Add(ready_item.name, ready_item);
                        }

                        holdy[ready_item.name]++;

                        if (ready_item.ParentSheetIndex == 430)
                        {
                            truffles.Add(ready_item);
                        }
                    }
                }
            }

            if (truffles.Count > 0 && cfg.harvestTrufflesToGrabbers)
            {
                TruffleGrabber(truffles);
            }
        }
Esempio n. 3
0
        private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
        {
            // ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            //if (e.Button.Equals(SButton.F5))
            //{
            //    int itemId = 430;
            //    int x, y;
            //    x = 74; y = 19;
            //    Game1.getLocationFromName("Farm").dropObject(new StardewValley.Object(itemId, 1, false, -1, 0), new Vector2(x, y) * 64f, Game1.viewport, true, (Farmer)null);
            //}

            if (e.Button.Equals(this.cfg.keyToCheck))
            {
                // print button presses to the console window
                Monitor.Log($"{Game1.player.Name} pressed {e.Button}.", LogLevel.Debug);

                holdy.Clear();
                holdy_previous.Clear();
                ready_items.Clear();

                foreach (GameLocation location in GetGameLocations())
                {
                    if ((location is FarmCave && cfg.showCaveItems) || (!(location is FarmCave) && !cfg.showCaveItems))
                    {
                        if (location.IsFarm || location.IsGreenhouse)
                        {
                            OverlaidDictionary.ValuesCollection locationObjects = GetLocationObjects(location);
                            CheckMachineItems(locationObjects);
                            CheckCrops(location);
                            if (cfg.showAnimalDroppings)
                            {
                                CheckAnimalDroppings(locationObjects);
                            }
                        }
                    }
                }

                if (holdy.Count > 0)
                {
                    ShowNotification();
                }
            }
        }
Esempio n. 4
0
        private void CheckMachineItems(OverlaidDictionary.ValuesCollection locationObjects)
        {
            foreach (SObject obj in locationObjects)
            {
                if (obj is Chest || !IsSpawnedWorldItem(obj))
                {
                    if (obj.readyForHarvest) //machine items
                    {
                        //obj.heldObject.Value.displayName - crafting machine name
                        //this.Monitor.Log($"{obj.Name} = {obj.Type} = {obj.readyForHarvest} = {obj.heldObject.Value.displayName}");
                        ready_item = obj.heldObject.Value; //obj.heldObject.Value.DisplayName;
                                                           //save object = obj.heldObject.Value

                        if (!holdy.ContainsKey(ready_item.name))
                        {
                            holdy.Add(ready_item.name, 0);
                            ready_items.Add(ready_item.name, ready_item);
                        }

                        holdy[ready_item.name]++;
                    }
                }
            }
        }