Esempio n. 1
0
        public static void Postfix(ref FarmAnimal __instance)
        {
            if (!Config.HasAnimal(__instance.type.Value) ||
                !IsNewDay(ref __instance) ||
                !CurrentDrops.IsAltered)
            {
                return;
            }
            if (!__instance.isBaby() && __instance.daysSinceLastLay.Value >= __instance.daysToLay.Value)
            {
                if (RegisterGameEvents.IsModLoaded("Paritee.BetterFarmAnimalVariety"))
                {
                    HandleItemDrop(CurrentDrops.NewDrop, ref __instance);
                }

                if (Config.HasExtraDrop(__instance.type.Value))
                {
                    var extraDrop = Config.GetExtraDropForAnimal(__instance.type.Value);
                    if (extraDrop != -1)
                    {
                        HandleItemDrop(extraDrop, ref __instance);
                    }
                }
            }

            __instance.defaultProduceIndex.Value = CurrentDrops.DefaultDrop;
            __instance.deluxeProduceIndex.Value  = CurrentDrops.DeluxeDrop;
            CurrentDrops.DefaultDrop             = -1;
            CurrentDrops.DefaultDrop             = -1;

            CurrentDrops.IsAltered = false;
        }
Esempio n. 2
0
        public static bool Prefix(ref FarmAnimal __instance)
        {
            if (!Config.HasAnimal(__instance.type.Value))
            {
                return(true);
            }
            UpdateOrInsert(ref __instance);

            CurrentDrops.DefaultDrop = __instance.defaultProduceIndex.Value;
            CurrentDrops.DeluxeDrop  = __instance.deluxeProduceIndex.Value;
            CurrentDrops.IsAltered   = true;

            CurrentDrops.NewDrop = Config.GetMainDropForAnimal(__instance.type.Value);
            __instance.defaultProduceIndex.Value = CurrentDrops.NewDrop;
            __instance.deluxeProduceIndex.Value  = -1;

            if (RegisterGameEvents.IsModLoaded("Paritee.BetterFarmAnimalVariety"))
            {
                __instance.pushAccumulator = 1;
            }

            return(true);
        }