private void assignFrom(ColoredCropWithDecay coloredJunk)
 {
     ParentSheetIndex                = coloredJunk.ParentSheetIndex;
     Name                            = coloredJunk.Name;
     DisplayName                     = coloredJunk.DisplayName;
     Price                           = coloredJunk.Price;
     Edibility                       = coloredJunk.Edibility;
     color.Value                     = coloredJunk.color.Value;
     Type                            = coloredJunk.Type;
     Category                        = coloredJunk.Category;
     setOutdoors.Value               = coloredJunk.setOutdoors.Value;
     setIndoors.Value                = coloredJunk.setIndoors.Value;
     Fragility                       = coloredJunk.Fragility;
     isLamp.Value                    = coloredJunk.isLamp;
     SpecialVariable                 = coloredJunk.SpecialVariable;
     Scale                           = coloredJunk.scale;
     Quality                         = coloredJunk.quality;
     IsSpawnedObject                 = coloredJunk.isSpawnedObject;
     IsRecipe                        = coloredJunk.isRecipe;
     HasBeenInInventory              = coloredJunk.HasBeenInInventory;
     HasBeenPickedUpByFarmer         = coloredJunk.HasBeenPickedUpByFarmer;
     uses.Value                      = coloredJunk.uses.Value;
     questItem.Value                 = coloredJunk.questItem;
     questId.Value                   = coloredJunk.questId;
     preserve.Value                  = coloredJunk.preserve.Value;
     preservedParentSheetIndex.Value = coloredJunk.preservedParentSheetIndex.Value;
 }
Пример #2
0
 private static void transformObject(NetObjectList <Item> items, SObject item, CustomCropsDecayData data)
 {
     if (data.decayDays.TryGetValue(item.Quality, out int decayDays))
     {
         if (item is ColoredObject coloredObject)
         {
             ColoredCropWithDecay crop = ColoredCropWithDecay.copyFrom(coloredObject);
             crop.decayDays = decayDays;
             for (int i = 0; i < items.Count; i++)
             {
                 if (items[i] == item)
                 {
                     items[i] = crop;
                 }
             }
         }
         else
         {
             CropWithDecay crop = CropWithDecay.copyFrom(item);
             crop.decayDays = decayDays;
             for (int i = 0; i < items.Count; i++)
             {
                 if (items[i] == item)
                 {
                     items[i] = crop;
                 }
             }
         }
     }
 }
        public override Item getOne()
        {
            ColoredCropWithDecay one = copyFrom(this);

            one.Stack       = 1;
            one.harvestDate = harvestDate;
            one.decayDays   = decayDays;
            return(one);
        }
        public dynamic getReplacement()
        {
            if (this.harvestDate.AddDays((int)this.decayDays) < SDate.Now())
            {
                ColoredCropWithDecay coloredJunk = copyFrom(new ColoredObject(168, Stack, color));
                assignFrom(coloredJunk);
            }
            Item item = base.getOne();

            item.Stack = this.Stack;
            return(item);
        }
        public static ColoredCropWithDecay copyFrom(ColoredObject replacement)
        {
            ColoredCropWithDecay obj1 = new ColoredCropWithDecay((int)replacement.parentSheetIndex, replacement.Stack, (Color)replacement.color)
            {
                Quality                 = replacement.quality,
                Price                   = replacement.price,
                HasBeenInInventory      = replacement.HasBeenInInventory,
                HasBeenPickedUpByFarmer = replacement.hasBeenPickedUpByFarmer,
                SpecialVariable         = replacement.SpecialVariable
            };

            obj1.preserve.Set(replacement.preserve.Value);
            obj1.preservedParentSheetIndex.Set(replacement.preservedParentSheetIndex.Value);
            obj1.Name = replacement.Name;
            return(obj1);
        }
        public override bool canStackWith(ISalable other)
        {
            if (other == null)
            {
                return(false);
            }
            if (!(other is ColoredCropWithDecay))
            {
                return(false);
            }
            ColoredCropWithDecay otherCrop = (other as ColoredCropWithDecay);

            if (!this.color.Value.Equals(otherCrop.color.Value))
            {
                return(false);
            }
            return((maximumStackSize() > 1) && (other.maximumStackSize() > 1) && (this.ParentSheetIndex == otherCrop.ParentSheetIndex) && (this.bigCraftable.Value == otherCrop.bigCraftable.Value) && (this.quality.Value == otherCrop.quality.Value) && this.harvestDate == otherCrop.harvestDate && (int)this.decayDays == (int)otherCrop.decayDays);
        }
 public ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement)
 {
     return(ColoredCropWithDecay.copyFrom((ColoredObject)replacement));
 }