Esempio n. 1
0
 private void assignFrom(CropWithDecay junk)
 {
     ParentSheetIndex                = junk.ParentSheetIndex;
     Name                            = junk.Name;
     DisplayName                     = junk.DisplayName;
     Price                           = junk.Price;
     Edibility                       = junk.Edibility;
     Type                            = junk.Type;
     Category                        = junk.Category;
     setOutdoors.Value               = junk.setOutdoors.Value;
     setIndoors.Value                = junk.setIndoors.Value;
     Fragility                       = junk.Fragility;
     isLamp.Value                    = junk.isLamp;
     SpecialVariable                 = junk.SpecialVariable;
     Scale                           = junk.scale;
     Quality                         = junk.quality;
     IsSpawnedObject                 = junk.isSpawnedObject;
     IsRecipe                        = junk.isRecipe;
     HasBeenInInventory              = junk.HasBeenInInventory;
     HasBeenPickedUpByFarmer         = junk.HasBeenPickedUpByFarmer;
     uses.Value                      = junk.uses.Value;
     questItem.Value                 = junk.questItem;
     questId.Value                   = junk.questId;
     preserve.Value                  = junk.preserve.Value;
     preservedParentSheetIndex.Value = junk.preservedParentSheetIndex.Value;
 }
Esempio n. 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;
                 }
             }
         }
     }
 }
Esempio n. 3
0
        public override Item getOne()
        {
            CropWithDecay one = copyFrom(this);

            one.Stack       = 1;
            one.harvestDate = harvestDate;
            one.decayDays   = decayDays;
            return(one);
        }
Esempio n. 4
0
        public dynamic getReplacement()
        {
            if (this.harvestDate.AddDays((int)this.decayDays) < SDate.Now())
            {
                CropWithDecay junk = copyFrom(new SObject(168, Stack));
                assignFrom(junk);
            }
            Item item = base.getOne();

            item.Stack = this.Stack;
            return(item);
        }
Esempio n. 5
0
        public override bool canStackWith(ISalable other)
        {
            if (other == null)
            {
                return(false);
            }
            if (!(other is CropWithDecay))
            {
                return(false);
            }
            CropWithDecay otherCrop = (other as CropWithDecay);

            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);
        }
Esempio n. 6
0
        public static CropWithDecay copyFrom(SObject replacement)
        {
            if (replacement.bigCraftable)
            {
                int parentSheetIndex = replacement.ParentSheetIndex;
                if (replacement.name.Contains("Seasonal"))
                {
                    parentSheetIndex = replacement.ParentSheetIndex - replacement.ParentSheetIndex % 4;
                }
                return(new CropWithDecay(replacement.tileLocation, parentSheetIndex)
                {
                    IsRecipe = replacement.isRecipe,
                    name = replacement.name,
                    DisplayName = replacement.DisplayName,
                    SpecialVariable = replacement.SpecialVariable
                });
            }
            CropWithDecay @object = new CropWithDecay(replacement.tileLocation, replacement.parentSheetIndex, 1);

            @object.Scale                           = replacement.scale;
            @object.Quality                         = replacement.quality;
            @object.IsSpawnedObject                 = replacement.isSpawnedObject;
            @object.IsRecipe                        = replacement.isRecipe;
            @object.Stack                           = replacement.Stack;
            @object.SpecialVariable                 = replacement.SpecialVariable;
            @object.Price                           = replacement.price;
            @object.name                            = replacement.name;
            @object.DisplayName                     = replacement.DisplayName;
            @object.HasBeenInInventory              = replacement.HasBeenInInventory;
            @object.HasBeenPickedUpByFarmer         = replacement.HasBeenPickedUpByFarmer;
            @object.uses.Value                      = replacement.uses.Value;
            @object.questItem.Value                 = replacement.questItem;
            @object.questId.Value                   = replacement.questId;
            @object.preserve.Value                  = replacement.preserve.Value;
            @object.preservedParentSheetIndex.Value = replacement.preservedParentSheetIndex.Value;
            return(@object);
        }
Esempio n. 7
0
 public ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement)
 {
     return(CropWithDecay.copyFrom((SObject)replacement));
 }