예제 #1
0
        public static void Patch()
        {
            Harmony harmony = new Harmony(Id);

            try
            {
                BushPatches.Patch(harmony);
            }
            catch (Exception ex)
            {
                Log.E("" + ex);
            }
            try
            {
                CraftingPagePatches.Patch(harmony);
            }
            catch (Exception ex)
            {
                Log.E("" + ex);
            }
            try
            {
                // Perform other miscellaneous patches
                Type[] types;

                // Upgrade cooking tool in any instance it's claimed by the player, including interactions with Clint's shop and mail delivery mods
                harmony.Patch(
                    original: AccessTools.Method(typeof(StardewValley.Tool), "actionWhenClaimed"),
                    prefix: new HarmonyMethod(typeof(HarmonyPatches), nameof(Tool_ActionWhenClaimed_Prefix)));

                // Handle sale price bonus profession for Cooking skill by affecting object sale multipliers
                harmony.Patch(
                    original: AccessTools.Method(typeof(StardewValley.Object), "getPriceAfterMultipliers"),
                    postfix: new HarmonyMethod(typeof(HarmonyPatches), nameof(Object_GetPriceAfterMultipliers_Postfix)));

                // Hide buffs in cooked foods not yet eaten
                if (ModEntry.HideBuffIconsOnItems)
                {
                    types = new Type[]
                    {
                        typeof(SpriteBatch), typeof(System.Text.StringBuilder),
                        typeof(SpriteFont), typeof(int), typeof(int), typeof(int),
                        typeof(string), typeof(int), typeof(string[]), typeof(Item), typeof(int), typeof(int),
                        typeof(int), typeof(int), typeof(int), typeof(float), typeof(CraftingRecipe),
                        typeof(IList <Item>)
                    };
                    harmony.Patch(
                        original: AccessTools.Method(typeof(StardewValley.Menus.IClickableMenu), "drawHoverText", parameters: types),
                        prefix: new HarmonyMethod(typeof(HarmonyPatches), nameof(IClickableMenu_DrawHoverText_Prefix)));
                }
            }
            catch (Exception ex)
            {
                Log.E("" + ex);
            }
        }
예제 #2
0
        public static void Patch()
        {
            var harmony = HarmonyInstance.Create(Id);

            try
            {
                BushPatches.Patch(harmony);
            }
            catch (Exception ex)
            {
                Log.E("" + ex);
            }
            try
            {
                CommunityCentrePatches.Patch(harmony);
            }
            catch (Exception ex)
            {
                Log.E("" + ex);
            }
            try
            {
                CraftingPagePatches.Patch(harmony);
            }
            catch (Exception ex)
            {
                Log.E("" + ex);
            }
            try
            {
                // Perform other miscellaneous patches

                // Upgrade cooking tool in any instance it's claimed by the player, including through interactions with Clint's shop and mail delivery
                harmony.Patch(
                    original: AccessTools.Method(typeof(StardewValley.Tools.GenericTool), "actionWhenClaimed"),
                    prefix: new HarmonyMethod(typeof(HarmonyPatches), nameof(GenericTool_ActionWhenClaimed_Prefix)));
                // Handle sale price bonus profession for Cooking skill by affecting object sale multipliers
                harmony.Patch(
                    original: AccessTools.Method(typeof(StardewValley.Object), "getPriceAfterMultipliers"),
                    prefix: new HarmonyMethod(typeof(HarmonyPatches), nameof(Object_GetPriceAfterMultipliers_Postfix)));
            }
            catch (Exception ex)
            {
                Log.E("" + ex);
            }
        }