37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
namespace Harmony.RecipePatches
|
|
{
|
|
[HarmonyPatch(typeof(Recipe))]
|
|
[HarmonyPatch("IsUnlocked")]
|
|
public class IsUnlockedPatch
|
|
{
|
|
public static void Postfix(Recipe __instance, ref bool __result, EntityPlayer _ep)
|
|
{
|
|
string recipeName = __instance.GetName();
|
|
|
|
//Log.Out("RecipePatches-IsUnlocked itemClassName: " + recipeName);
|
|
if (_ep.Buffs.GetCustomVar(recipeName) == 1f)
|
|
{
|
|
//Log.Out("RecipePatches-IsUnlocked KNOWN itemClassName: " + recipeName);
|
|
__result = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(Recipe))]
|
|
[HarmonyPatch("GetCraftingTier")]
|
|
public class GetCraftingTierPatch
|
|
{
|
|
public static bool Prefix(Recipe __instance, ref int __result, EntityPlayer _ep)
|
|
{
|
|
__result = (int)EffectManager.GetValue(PassiveEffects.CraftingTier, _originalValue: 1f, _entity: (EntityAlive)_ep, _recipe: __instance, tags: __instance.tags);
|
|
|
|
if (__result > 5)
|
|
{
|
|
__result = 5;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|