コード例 #1
0
        /// <summary>Get the output item.</summary>
        public override ITrackedStack GetOutput()
        {
            // get raw output
            SObject output = this.Machine.heldObject;

            if (output == null)
            {
                return(null);
            }

            // get flower data
            SObject.HoneyType type   = SObject.HoneyType.Wild;
            string            prefix = "Wild";
            int addedPrice           = 0;

            if (this.Location is Farm)
            {
                Crop flower = Utility.findCloseFlower(this.Tile);
                if (flower != null)
                {
                    string[] flowerData = Game1.objectInformation[flower.indexOfHarvest].Split('/');
                    prefix     = flowerData[0];
                    addedPrice = Convert.ToInt32(flowerData[1]) * 2;
                    switch (flower.indexOfHarvest)
                    {
                    case 376:
                        type = SObject.HoneyType.Poppy;
                        break;

                    case 591:
                        type = SObject.HoneyType.Tulip;
                        break;

                    case 593:
                        type = SObject.HoneyType.SummerSpangle;
                        break;

                    case 595:
                        type = SObject.HoneyType.FairyRose;
                        break;

                    case 597:
                        type = SObject.HoneyType.BlueJazz;
                        break;
                    }
                }
            }

            // build object
            SObject result = new SObject(output.parentSheetIndex, output.stack)
            {
                name      = $"{prefix} Honey",
                price     = output.price + addedPrice,
                honeyType = type
            };

            // yield
            return(new TrackedItem(result, onEmpty: this.Reset));
        }
コード例 #2
0
        public static SObject FlowerFromHoneyType(SObject.HoneyType honeyType)
        {
            if (honeyType == SObject.HoneyType.Wild)
            {
                return(null);
            }

            return(new SObject(Vector2.Zero, (int)honeyType, null, false, false, false, false));
        }
コード例 #3
0
        /// <summary>Get the output item.</summary>
        public override ITrackedStack GetOutput()
        {
            // get raw output
            SObject output = this.Machine.heldObject.Value;

            if (output == null)
            {
                return(null);
            }

            // get flower data
            SObject.HoneyType type   = SObject.HoneyType.Wild;
            string            prefix = type.ToString();
            int addedPrice           = 0;

            if (this.Location is Farm)
            {
                Crop flower = Utility.findCloseFlower(this.Location, this.Tile);
                if (flower != null)
                {
                    string[] flowerData = Game1.objectInformation[flower.indexOfHarvest.Value].Split('/');
                    prefix     = flowerData[0];
                    addedPrice = Convert.ToInt32(flowerData[1]) * 2;
                    if (!this.HoneyTypes.TryGetValue(flower.indexOfHarvest.Value, out type))
                    {
                        type = SObject.HoneyType.Wild;
                    }
                }
            }

            // build object
            SObject result = new SObject(output.ParentSheetIndex, output.Stack)
            {
                name  = $"{prefix} Honey",
                Price = output.Price + addedPrice
            };

            result.honeyType.Value = type;

            // yield
            return(new TrackedItem(result, onEmpty: this.Reset));
        }