예제 #1
0
        public static bool DetectHarvestableBerryBush(ref Bush __instance, ref bool __state)
        {
            try
            {
                // if other mods also define a __state variable of type bool they will have different values (aka harmony does not make us fight over the __state variable)
                __state = BerryBushLogic.IsHarvestableBush(__instance) && __instance.tileSheetOffset == 1;

                return(true);
            }
            catch (Exception e)
            {
                mod.ErrorLog("There was an exception in a patch", e);
                __state = false;
                return(true);
            }
        }
예제 #2
0
        public static void FixBerryQuality(ref Bush __instance, ref bool __state)
        {
            try
            {
                // config calls are in ChangeBerryQualityAndGiveExp
                if (__state && BerryBushLogic.IsHarvestableBush(__instance) && __instance.tileSheetOffset == 0)
                {
                    var maxShake = mod.Helper.Reflection.GetField <float>(__instance, "maxShake");

                    if (maxShake.GetValue() == 0.0245436933f)
                    {
                        BerryBushLogic.ChangeBerryQualityAndGiveExp(__instance, mod);
                    }
                }
            }
            catch (Exception e)
            {
                mod.ErrorLog("There was an exception in a patch", e);
            }
        }